| 1 |
Fromscip-debian debian hilive 2.0a-6 hilive/patches/`0005-Upgrade-to-SeqAn-2.5.0.patch`#From.: Enrico Seiler <[email protected]scip-debian . . . identity/`[email protected]`.> |
| 2 |
Datescip-debian debian hilive 2.0a-6 hilive/patches/`0005-Upgrade-to-SeqAn-2.5.0.patch`#Date.: Tue, 26 Nov 2024 17:45:08 +0100 |
| 3 |
Subjectscip-debian debian hilive 2.0a-6 hilive/patches/`0005-Upgrade-to-SeqAn-2.5.0.patch`#Subject.: Upgrade to SeqAn 2.5.0. |
| 4 |
|
| 5 |
--- |
| 6 |
CMakeLists.txt | 2 +- |
| 7 |
lib/alnout.cpp | 36 ++++++++++++++++++------------------ |
| 8 |
lib/alnout.h | 34 +++++++++++++++++----------------- |
| 9 |
lib/alnread.cpp | 32 ++++++++++++++++---------------- |
| 10 |
lib/alnread.h | 4 ++-- |
| 11 |
lib/kindex.cpp | 22 +++++++++++----------- |
| 12 |
lib/kindex.h | 10 +++++----- |
| 13 |
lib/tools.cpp | 12 ++++++------ |
| 14 |
lib/tools.h | 2 +- |
| 15 |
lib/tools_static.h | 2 +- |
| 16 |
10 files changed, 78 insertions(+), 78 deletions(-) |
| 17 |
|
| 18 |
diff --git a/CMakeLists.txtscip-debian debian hilive 2.0a-6 hilive/upstream/`CMakeLists.txt`: b/CMakeLists.txtscip-debian debian hilive 2.0a-6 hilive/upstream/`CMakeLists.txt`: |
| 19 |
index aea27d4..7e06a9a 100644 |
| 20 |
--- a/CMakeLists.txt |
| 21 |
+++ b/CMakeLists.txt |
| 22 |
@@ -10,7 +10,7 @@ project( HiLive VERSION 2.0 LANGUAGES CXX ) |
| 23 |
################### |
| 24 |
|
| 25 |
# Set CXX Standard |
| 26 |
|
| 27 |
+set( CMAKE_CXX_STANDARD 17 ) |
| 28 |
set( CMAKE_CXX_SANDARD_REQUIRED ON ) |
| 29 |
set( CMAKE_CXX_EXTENSIONS OFF ) |
| 30 |
|
| 31 |
diff --git a/lib/alnout.cppscip-debian debian hilive 2.0a-6 hilive/upstream/`lib/alnout.cpp`: b/lib/alnout.cppscip-debian debian hilive 2.0a-6 hilive/upstream/`lib/alnout.cpp`: |
| 32 |
index f582e1e..169bce1 100755 |
| 33 |
--- a/lib/alnout.cpp |
| 34 |
+++ b/lib/alnout.cpp |
| 35 |
@@ -47,7 +47,7 @@ void AlnOut::init() { |
| 36 |
bfos.set_context(idx->getSeqNames(), idx->getSeqLengths()); |
| 37 |
|
| 38 |
// Init the header (the same object can be used for all output streams) |
| 39 |
|
| 40 |
+ seqan2::BamHeader header = getBamHeader(); |
| 41 |
|
| 42 |
// Init output stream for each barcode (plus undetermined if keep_all_barcodes is set) |
| 43 |
for ( unsigned barcode=0; barcode < (barcodes.size() + 1); barcode ++) { |
| 44 |
@@ -292,7 +292,7 @@ void AlnOut::__write_tile_to_bam__ ( Task t ) { |
| 45 |
mateAlignments.push_back(e->get_alignment()); |
| 46 |
} |
| 47 |
|
| 48 |
|
| 49 |
+ std::vector<std::vector<seqan2::BamAlignmentRecord>> mateRecords(mateAlignments.size(), std::vector<seqan2::BamAlignmentRecord>(0)); |
| 50 |
|
| 51 |
// if the filter file is available and the filter flag is 0 then skip |
| 52 |
if (filters.size() != 0 && filters.next() == false) |
| 53 |
@@ -333,7 +333,7 @@ void AlnOut::__write_tile_to_bam__ ( Task t ) { |
| 54 |
mateAlignments[mateAlignmentIndex]->cycle -= 1; |
| 55 |
|
| 56 |
// Init record with information about the read |
| 57 |
|
| 58 |
+ seqan2::BamAlignmentRecord mate_record; |
| 59 |
mate_record.qName = readname.str(); |
| 60 |
mate_record.flag = 0; |
| 61 |
|
| 62 |
@@ -413,7 +413,7 @@ void AlnOut::__write_tile_to_bam__ ( Task t ) { |
| 63 |
} |
| 64 |
|
| 65 |
// get CIGAR-String |
| 66 |
|
| 67 |
+ seqan2::String<seqan2::CigarElement<> > cigar = (*it)->returnSeqanCigarString(); |
| 68 |
|
| 69 |
// Get NM:i value |
| 70 |
unsigned nm = (*it)->get_nm(); |
| 71 |
@@ -425,7 +425,7 @@ void AlnOut::__write_tile_to_bam__ ( Task t ) { |
| 72 |
unsigned deletionSum = 0; |
| 73 |
unsigned supposed_cigar_length = mateCycles[mateAlignmentIndex]; |
| 74 |
|
| 75 |
|
| 76 |
+ for (seqan2::Iterator<seqan2::String<seqan2::CigarElement<> > >::Type elem = seqan2::begin(cigar); elem != end(cigar); ++elem) { |
| 77 |
if ((elem->operation == 'M') || (elem->operation == 'I') || (elem->operation == 'S') || (elem->operation == '=') || (elem->operation == 'X')) |
| 78 |
cigarElemSum += elem->count; |
| 79 |
|
| 80 |
@@ -464,7 +464,7 @@ void AlnOut::__write_tile_to_bam__ ( Task t ) { |
| 81 |
goto nextmate; |
| 82 |
} |
| 83 |
|
| 84 |
|
| 85 |
+ seqan2::BamAlignmentRecord record = mate_record; |
| 86 |
|
| 87 |
record.rID = CountType(p->gid / 2); |
| 88 |
|
| 89 |
@@ -485,40 +485,40 @@ void AlnOut::__write_tile_to_bam__ ( Task t ) { |
| 90 |
|
| 91 |
record.cigar = cigar; |
| 92 |
if ( idx->isReverse(p->gid) ) |
| 93 |
|
| 94 |
+ seqan2::reverse(record.cigar); |
| 95 |
|
| 96 |
if ( printedMateAlignments > 0 ) { // if current seed is secondary alignment |
| 97 |
record.flag = addSAMFlag(record.flag, SAMFlag::SEC_ALIGNMENT); |
| 98 |
|
| 99 |
|
| 100 |
+ seqan2::clear(record.seq); |
| 101 |
+ seqan2::clear(record.qual); |
| 102 |
} |
| 103 |
|
| 104 |
if ( idx->isReverse(p->gid) ) { // if read matched reverse complementary |
| 105 |
|
| 106 |
|
| 107 |
+ seqan2::reverseComplement(record.seq); |
| 108 |
+ seqan2::reverse(record.qual); |
| 109 |
record.flag = addSAMFlag(record.flag, SAMFlag::SEQ_RC); |
| 110 |
} |
| 111 |
|
| 112 |
// Dictionary for additional SAM tags |
| 113 |
|
| 114 |
+ seqan2::BamTagsDict dict; |
| 115 |
|
| 116 |
// Alignment Score |
| 117 |
|
| 118 |
+ seqan2::appendTagValue(dict, "AS", curr_seed_score); |
| 119 |
|
| 120 |
// Barcode sequence |
| 121 |
if (barcode!="") |
| 122 |
|
| 123 |
+ seqan2::appendTagValue(dict, "BC", barcode); |
| 124 |
|
| 125 |
// Number of mismatches |
| 126 |
|
| 127 |
+ seqan2::appendTagValue(dict, "NM", nm); |
| 128 |
|
| 129 |
// MD:Z string |
| 130 |
std::string mdz = (*it)->getMDZString(); |
| 131 |
if ( idx->isReverse(p->gid)) |
| 132 |
mdz = reverse_mdz(mdz); |
| 133 |
|
| 134 |
+ seqan2::appendTagValue(dict, "MD", mdz); |
| 135 |
|
| 136 |
|
| 137 |
+ record.tags = seqan2::host(dict); |
| 138 |
|
| 139 |
// fill records list |
| 140 |
mateRecords[mateAlignmentIndex].push_back(record); |
| 141 |
@@ -561,7 +561,7 @@ void AlnOut::__write_tile_to_bam__ ( Task t ) { |
| 142 |
return; |
| 143 |
} |
| 144 |
|
| 145 |
|
| 146 |
+void AlnOut::setMateSAMFlags( std::vector<std::vector<seqan2::BamAlignmentRecord>> & mateRecords ) { |
| 147 |
for ( CountType i=0; i<mateRecords.size(); i++ ) { |
| 148 |
|
| 149 |
// Stop if not paired |
| 150 |
diff --git a/lib/alnout.hscip-debian debian hilive 2.0a-6 hilive/upstream/`lib/alnout.h`: b/lib/alnout.hscip-debian debian hilive 2.0a-6 hilive/upstream/`lib/alnout.h`: |
| 151 |
index 4723925..eaad85c 100644 |
| 152 |
--- a/lib/alnout.h |
| 153 |
+++ b/lib/alnout.h |
| 154 |
@@ -20,7 +20,7 @@ struct Atomic_bfo { |
| 155 |
private: |
| 156 |
|
| 157 |
/** The BamFileOut stream.*/ |
| 158 |
|
| 159 |
+ seqan2::BamFileOut bfo; |
| 160 |
|
| 161 |
/** The atomic flag to perform a spinlock while writing.*/ |
| 162 |
std::atomic_flag flag = ATOMIC_FLAG_INIT; |
| 163 |
@@ -55,7 +55,7 @@ public: |
| 164 |
* Set the context of the BamFileOut stream. |
| 165 |
* @param context The new context. |
| 166 |
*/ |
| 167 |
|
| 168 |
+ void setContext ( seqan2::BamIOContext<seqan2::StringSet<seqan2::CharString> > & context ) { |
| 169 |
bfo.context = context; |
| 170 |
} |
| 171 |
|
| 172 |
@@ -63,22 +63,22 @@ public: |
| 173 |
* Write the header to the output file. |
| 174 |
* @param header The header for the output file. |
| 175 |
*/ |
| 176 |
|
| 177 |
|
| 178 |
+ void writeHeader ( seqan2::BamHeader & header ) { |
| 179 |
+ seqan2::writeHeader( bfo, header ); |
| 180 |
} |
| 181 |
|
| 182 |
/** |
| 183 |
* Write records to the output file in a "thread-safe" manner. |
| 184 |
* @param records Reference to a vector containing a set of records. |
| 185 |
*/ |
| 186 |
|
| 187 |
+ void writeRecords ( std::vector<seqan2::BamAlignmentRecord> & records ) { |
| 188 |
|
| 189 |
if ( records.size() == 0 ) |
| 190 |
return; |
| 191 |
|
| 192 |
lock(); |
| 193 |
|
| 194 |
|
| 195 |
+ seqan2::writeRecords(bfo, records); |
| 196 |
|
| 197 |
unlock(); |
| 198 |
|
| 199 |
@@ -88,7 +88,7 @@ public: |
| 200 |
* Write records to the output file in a "thread-safe" manner. |
| 201 |
* @param records Reference to a vector containing an other vector of records. |
| 202 |
*/ |
| 203 |
|
| 204 |
+ void writeRecords ( std::vector<std::vector<seqan2::BamAlignmentRecord>> & records ) { |
| 205 |
|
| 206 |
if ( records.size() == 0 ) |
| 207 |
return; |
| 208 |
@@ -96,7 +96,7 @@ public: |
| 209 |
lock(); |
| 210 |
|
| 211 |
for ( auto & subvector : records) |
| 212 |
|
| 213 |
+ seqan2::writeRecords(bfo, subvector); |
| 214 |
|
| 215 |
unlock(); |
| 216 |
|
| 217 |
@@ -115,9 +115,9 @@ class BamFileOutDeque { |
| 218 |
std::deque<Atomic_bfo> bfos; |
| 219 |
|
| 220 |
/** All fields needed for the context of the BamFileOut streams. */ |
| 221 |
|
| 222 |
|
| 223 |
|
| 224 |
+ seqan2::BamIOContext<seqan2::StringSet<seqan2::CharString> > context; |
| 225 |
+ seqan2::StringSet<seqan2::CharString> refNames; |
| 226 |
+ seqan2::NameStoreCache<seqan2::StringSet<seqan2::CharString> > refNamesCache; |
| 227 |
|
| 228 |
public: |
| 229 |
|
| 230 |
@@ -127,12 +127,12 @@ public: |
| 231 |
* @param seq_length Lengths of all sequences in the database |
| 232 |
*/ |
| 233 |
void set_context(std::vector<std::string> & seq_names, std::vector<uint32_t> & seq_lengths) { |
| 234 |
|
| 235 |
+ seqan2::NameStoreCache<seqan2::StringSet<seqan2::CharString> > rnc(refNames); |
| 236 |
refNamesCache = rnc; |
| 237 |
|
| 238 |
+ seqan2::BamIOContext<seqan2::StringSet<seqan2::CharString> > cxt(refNames, refNamesCache); |
| 239 |
context = cxt; |
| 240 |
|
| 241 |
|
| 242 |
+ seqan2::contigNames(context) = seq_names; |
| 243 |
+ seqan2::contigLengths(context) = seq_lengths; |
| 244 |
} |
| 245 |
|
| 246 |
/** |
| 247 |
@@ -246,7 +246,7 @@ private: |
| 248 |
bool add_task( Task t, ItemStatus status ); |
| 249 |
|
| 250 |
// TODO: documentation |
| 251 |
|
| 252 |
+ void findPairs( std::vector<std::vector<seqan2::BamAlignmentRecord>> & mateRecords ); |
| 253 |
|
| 254 |
/** |
| 255 |
* Set the SAM fields according to the information about the other mates. |
| 256 |
@@ -254,7 +254,7 @@ private: |
| 257 |
* For the last mate, refer to the first mate (as it is done for paired end data) |
| 258 |
* @param reference to a vecor of vectors for SAM records of each mate. |
| 259 |
*/ |
| 260 |
|
| 261 |
+ void setMateSAMFlags( std::vector<std::vector<seqan2::BamAlignmentRecord>> & records ); |
| 262 |
|
| 263 |
/** |
| 264 |
* Create a temporary align file that is sorted by score. |
| 265 |
diff --git a/lib/alnread.cppscip-debian debian hilive 2.0a-6 hilive/upstream/`lib/alnread.cpp`: b/lib/alnread.cppscip-debian debian hilive 2.0a-6 hilive/upstream/`lib/alnread.cpp`: |
| 266 |
index 6c3fbae..920e0a9 100755 |
| 267 |
--- a/lib/alnread.cpp |
| 268 |
+++ b/lib/alnread.cpp |
| 269 |
@@ -1,13 +1,13 @@ |
| 270 |
#include "alnread.h" |
| 271 |
|
| 272 |
|
| 273 |
|
| 274 |
+seqan2::String<seqan2::CigarElement<> > Seed::returnSeqanCigarString() const { |
| 275 |
|
| 276 |
bool extended_cigar = globalAlignmentSettings.get_extended_cigar(); |
| 277 |
|
| 278 |
|
| 279 |
+ typedef seqan2::String<seqan2::CigarElement<> > TSeqanCigarString; |
| 280 |
TSeqanCigarString seqanCigarString; |
| 281 |
|
| 282 |
+ seqan2::CigarElement<> cigarElem; |
| 283 |
|
| 284 |
for (CigarVector::const_iterator it = cigar_data.begin(); it != cigar_data.end(); ++it) { |
| 285 |
|
| 286 |
@@ -15,7 +15,7 @@ seqan::String<seqan::CigarElement<> > Seed::returnSeqanCigarString() const { |
| 287 |
if (it == cigar_data.begin() && (*it).operation==NO_MATCH) { |
| 288 |
cigarElem.operation='S'; |
| 289 |
cigarElem.count=(*it).length; |
| 290 |
|
| 291 |
+ seqan2::appendValue(seqanCigarString, cigarElem); |
| 292 |
continue; |
| 293 |
} |
| 294 |
|
| 295 |
@@ -23,7 +23,7 @@ seqan::String<seqan::CigarElement<> > Seed::returnSeqanCigarString() const { |
| 296 |
if ((*it).operation==NO_MATCH) { |
| 297 |
cigarElem.operation= extended_cigar ? 'X' : 'M'; |
| 298 |
cigarElem.count=(*it).length; |
| 299 |
|
| 300 |
+ seqan2::appendValue(seqanCigarString, cigarElem); |
| 301 |
continue; |
| 302 |
} |
| 303 |
|
| 304 |
@@ -31,7 +31,7 @@ seqan::String<seqan::CigarElement<> > Seed::returnSeqanCigarString() const { |
| 305 |
else if((*it).operation==DELETION) { |
| 306 |
cigarElem.operation='D'; |
| 307 |
cigarElem.count=(*it).length; |
| 308 |
|
| 309 |
+ seqan2::appendValue(seqanCigarString, cigarElem); |
| 310 |
continue; |
| 311 |
} |
| 312 |
|
| 313 |
@@ -39,7 +39,7 @@ seqan::String<seqan::CigarElement<> > Seed::returnSeqanCigarString() const { |
| 314 |
else if((*it).operation==INSERTION) { |
| 315 |
cigarElem.operation='I'; |
| 316 |
cigarElem.count=(*it).length; |
| 317 |
|
| 318 |
+ seqan2::appendValue(seqanCigarString, cigarElem); |
| 319 |
continue; |
| 320 |
} |
| 321 |
|
| 322 |
@@ -47,7 +47,7 @@ seqan::String<seqan::CigarElement<> > Seed::returnSeqanCigarString() const { |
| 323 |
else { |
| 324 |
cigarElem.operation= extended_cigar ? '=' : 'M'; |
| 325 |
cigarElem.count=(*it).length; |
| 326 |
|
| 327 |
+ seqan2::appendValue(seqanCigarString, cigarElem); |
| 328 |
continue; |
| 329 |
|
| 330 |
} |
| 331 |
@@ -395,8 +395,8 @@ std::vector<GenomePosType> Seed::getPositions( CountType firstPosition, CountTyp |
| 332 |
std::vector<GenomePosType> position_list; |
| 333 |
|
| 334 |
// Get occurences |
| 335 |
|
| 336 |
|
| 337 |
+ auto positions = seqan2::getOccurrences(it); |
| 338 |
+ CountType sub_positions = seqan2::length(positions); |
| 339 |
position_list.reserve( std::min ( seed_positions, sub_positions ) ); |
| 340 |
|
| 341 |
// Put positions into the return list |
| 342 |
@@ -656,7 +656,7 @@ void ReadAlignment::extendSeed(char base, USeed origin, SeedVec & newSeeds){ |
| 343 |
{ |
| 344 |
// Handle matching nucleotide first (this should be the default case) |
| 345 |
FMTopDownIterator it(idx->idx, origin->vDesc); |
| 346 |
|
| 347 |
+ if ( seqan2::goDown(it, seqan2::DnaString(base)) ) { |
| 348 |
getMatchSeeds( tbr, tbr, it, origin, newSeeds ); |
| 349 |
handled_range += (it.vDesc.range.i2 - it.vDesc.range.i1); |
| 350 |
} |
| 351 |
@@ -683,7 +683,7 @@ void ReadAlignment::extendSeed(char base, USeed origin, SeedVec & newSeeds){ |
| 352 |
|
| 353 |
FMTopDownIterator it(idx->idx, origin->vDesc); |
| 354 |
|
| 355 |
|
| 356 |
+ if ( seqan2::goDown(it, seqan2::DnaString(index_base)) ) { |
| 357 |
|
| 358 |
// Handle no_match |
| 359 |
getMatchSeeds( tbr, index_base, it, origin, newSeeds ); |
| 360 |
@@ -851,7 +851,7 @@ void ReadAlignment::recursive_goDown(CountType base_repr, USeed origin, SeedVec |
| 361 |
FMTopDownIterator it(idx->idx, origin->vDesc); |
| 362 |
|
| 363 |
// Only consider paths existing in the index |
| 364 |
|
| 365 |
+ if ( goDown(it, seqan2::DnaString(revtwobit_repr( base_repr )))) { |
| 366 |
|
| 367 |
// copy data from origin seed |
| 368 |
USeed s (new Seed); |
| 369 |
@@ -894,7 +894,7 @@ void ReadAlignment::recursive_goDown(CountType base_repr, USeed origin, SeedVec |
| 370 |
FMTopDownIterator it(idx->idx, origin->vDesc); |
| 371 |
|
| 372 |
// Only consider paths existing in the index |
| 373 |
|
| 374 |
+ if ( goDown(it, seqan2::DnaString(revtwobit_repr(b)))) { |
| 375 |
|
| 376 |
// copy data from origin seed |
| 377 |
USeed s (new Seed); |
| 378 |
@@ -926,7 +926,7 @@ void ReadAlignment::createSeeds(SeedVec & newSeeds) { |
| 379 |
std::string anchor_seq = getSequenceString().substr( sequenceLen - globalAlignmentSettings.get_anchor_length(), globalAlignmentSettings.get_anchor_length()); |
| 380 |
|
| 381 |
FMTopDownIterator it(idx->idx); |
| 382 |
|
| 383 |
+ if ( seqan2::goDown(it, seqan2::Dna5String(anchor_seq)) ) { |
| 384 |
USeed seed ( new Seed() ); |
| 385 |
seed->max_as = max_as; |
| 386 |
if ( cycle != globalAlignmentSettings.get_anchor_length() ) |
| 387 |
@@ -1189,7 +1189,7 @@ std::vector<uint8_t> ReadAlignment::getMAPQs() const { |
| 388 |
return mapqs; |
| 389 |
} |
| 390 |
|
| 391 |
|
| 392 |
+void ReadAlignment::addReadInfoToRecord(seqan2::BamAlignmentRecord & record) const { |
| 393 |
record.seq = getSequenceString(); |
| 394 |
record.qual = getQualityString(); |
| 395 |
} |
| 396 |
diff --git a/lib/alnread.hscip-debian debian hilive 2.0a-6 hilive/upstream/`lib/alnread.h`: b/lib/alnread.hscip-debian debian hilive 2.0a-6 hilive/upstream/`lib/alnread.h`: |
| 397 |
index f800b80..9ed4305 100644 |
| 398 |
--- a/lib/alnread.h |
| 399 |
+++ b/lib/alnread.h |
| 400 |
@@ -39,7 +39,7 @@ struct Seed { |
| 401 |
* @return CIGAR string in SeqAn format |
| 402 |
* TODO: give extended CIGAR information as a parameter instead of inside the function. |
| 403 |
*/ |
| 404 |
|
| 405 |
+ seqan2::String<seqan2::CigarElement<> > returnSeqanCigarString() const; |
| 406 |
|
| 407 |
/** |
| 408 |
* Get the alignment score of a seed (AS:i). |
| 409 |
@@ -407,7 +407,7 @@ public: |
| 410 |
*/ |
| 411 |
std::vector<uint8_t> getMAPQs() const; |
| 412 |
|
| 413 |
|
| 414 |
+ void addReadInfoToRecord(seqan2::BamAlignmentRecord & record) const; |
| 415 |
|
| 416 |
}; // END class ReadAlignment |
| 417 |
|
| 418 |
diff --git a/lib/kindex.cppscip-debian debian hilive 2.0a-6 hilive/upstream/`lib/kindex.cpp`: b/lib/kindex.cppscip-debian debian hilive 2.0a-6 hilive/upstream/`lib/kindex.cpp`: |
| 419 |
index 22ca65c..6be1b89 100644 |
| 420 |
--- a/lib/kindex.cpp |
| 421 |
+++ b/lib/kindex.cpp |
| 422 |
@@ -23,20 +23,20 @@ int KixBuild::create_index( const std::string &fname, const std::string &iname, |
| 423 |
} |
| 424 |
|
| 425 |
// modify sequences for index building (reverse and add reverse complement) |
| 426 |
|
| 427 |
+ seqan2::StringSet<seqan2::DnaString> all_seqs; |
| 428 |
|
| 429 |
for(uint16_t i = 0; i < length(seqs); i++) { |
| 430 |
|
| 431 |
|
| 432 |
|
| 433 |
|
| 434 |
+ seqan2::ModifiedString<seqan2::DnaString, seqan2::ModReverse> rev(seqs[i]); |
| 435 |
+ seqan2::appendValue(all_seqs, rev); |
| 436 |
+ seqan2::complement(seqs[i]); |
| 437 |
+ seqan2::appendValue(all_seqs, seqs[i]); |
| 438 |
} |
| 439 |
|
| 440 |
// Define the index |
| 441 |
FMIndex idx(all_seqs); |
| 442 |
|
| 443 |
// Force the index to be created |
| 444 |
|
| 445 |
+ if( ! seqan2::indexCreate(idx) ) |
| 446 |
return 4; |
| 447 |
|
| 448 |
// Save the index to file |
| 449 |
@@ -61,7 +61,7 @@ int KixBuild::add_fasta(const std::string &fname, bool convert_spaces, bool trim |
| 450 |
std::string line; // current line of fasta file |
| 451 |
std::string seq_name; // name of the current sequence |
| 452 |
bool startNewSequence = false; // true if last line was a header / new sequence begins |
| 453 |
|
| 454 |
+ seqan2::DnaString newSeq = ""; // current DNA sequence |
| 455 |
|
| 456 |
while(getline(infile, line)) { |
| 457 |
|
| 458 |
@@ -79,7 +79,7 @@ int KixBuild::add_fasta(const std::string &fname, bool convert_spaces, bool trim |
| 459 |
|
| 460 |
// add last sequence to sequence vector (if exist) |
| 461 |
if ( newSeq != "" ) { |
| 462 |
|
| 463 |
+ seqan2::appendValue(seqs, newSeq); |
| 464 |
} |
| 465 |
|
| 466 |
// trim the header (remove leading and trailing whitespaces) |
| 467 |
@@ -125,7 +125,7 @@ int KixBuild::add_fasta(const std::string &fname, bool convert_spaces, bool trim |
| 468 |
|
| 469 |
// append the last sequence to the StringSet |
| 470 |
if ( newSeq != "" ) { |
| 471 |
|
| 472 |
+ seqan2::appendValue(seqs, newSeq); |
| 473 |
} |
| 474 |
|
| 475 |
return seq_lengths.size(); |
| 476 |
@@ -134,7 +134,7 @@ int KixBuild::add_fasta(const std::string &fname, bool convert_spaces, bool trim |
| 477 |
|
| 478 |
int KixBuild::save_fmindex( FMIndex & idx, const std::string &iname ) { |
| 479 |
const char * filename = iname.c_str(); |
| 480 |
|
| 481 |
+ return seqan2::save(idx, filename); |
| 482 |
} |
| 483 |
|
| 484 |
int KixBuild::save_metadata( const std::string &iname ) { |
| 485 |
@@ -227,7 +227,7 @@ int KixRun::load_fmindex( std::string index_name ) { |
| 486 |
|
| 487 |
const char * filename = index_name.c_str(); |
| 488 |
|
| 489 |
|
| 490 |
+ if ( seqan2::open(idx, filename) != 1 ) // function returns 1 on success |
| 491 |
return 1; |
| 492 |
return 0; |
| 493 |
|
| 494 |
diff --git a/lib/kindex.hscip-debian debian hilive 2.0a-6 hilive/upstream/`lib/kindex.h`: b/lib/kindex.hscip-debian debian hilive 2.0a-6 hilive/upstream/`lib/kindex.h`: |
| 495 |
index 5742035..c8f8283 100644 |
| 496 |
--- a/lib/kindex.h |
| 497 |
+++ b/lib/kindex.h |
| 498 |
@@ -12,22 +12,22 @@ |
| 499 |
/** |
| 500 |
* FM-Index Config. |
| 501 |
*/ |
| 502 |
|
| 503 |
+typedef seqan2::FastFMIndexConfig<void, uint64_t,2 ,1> FMIConfig; |
| 504 |
|
| 505 |
/** |
| 506 |
* FM-Index data type. |
| 507 |
*/ |
| 508 |
|
| 509 |
+typedef seqan2::Index<seqan2::StringSet<seqan2::DnaString>, seqan2::FMIndex<void, FMIConfig> > FMIndex; |
| 510 |
|
| 511 |
/** |
| 512 |
* Iterator to go through the FM index structure. |
| 513 |
*/ |
| 514 |
|
| 515 |
+typedef seqan2::Iterator<FMIndex, seqan2::TopDown<> >::Type FMTopDownIterator; |
| 516 |
|
| 517 |
/** |
| 518 |
* Data type to find a store a node in the FM index. |
| 519 |
*/ |
| 520 |
|
| 521 |
+typedef seqan2::Iter<FMIndex,seqan2::VSTree<seqan2::TopDown<seqan2::Preorder>>>::TVertexDesc FMVertexDescriptor; |
| 522 |
|
| 523 |
inline bool operator==(const FMVertexDescriptor l, FMVertexDescriptor r) { |
| 524 |
return l.range == r.range; |
| 525 |
@@ -76,7 +76,7 @@ class KixBuild { |
| 526 |
std::vector<uint32_t> seq_lengths; |
| 527 |
|
| 528 |
/** Sequences in the index. */ |
| 529 |
|
| 530 |
+ seqan2::StringSet<seqan2::DnaString> seqs; |
| 531 |
|
| 532 |
private: |
| 533 |
|
| 534 |
diff --git a/lib/tools.cppscip-debian debian hilive 2.0a-6 hilive/upstream/`lib/tools.cpp`: b/lib/tools.cppscip-debian debian hilive 2.0a-6 hilive/upstream/`lib/tools.cpp`: |
| 535 |
index f5120f3..bb9595d 100644 |
| 536 |
--- a/lib/tools.cpp |
| 537 |
+++ b/lib/tools.cpp |
| 538 |
@@ -4,25 +4,25 @@ |
| 539 |
////////// SAM/BAM output ////////// |
| 540 |
//////////////////////////////////// |
| 541 |
|
| 542 |
|
| 543 |
+seqan2::BamHeader getBamHeader() { |
| 544 |
std::stringstream ss; |
| 545 |
ss.str(std::string()); |
| 546 |
ss << HiLive_VERSION_MAJOR << "." << HiLive_VERSION_MINOR; |
| 547 |
|
| 548 |
|
| 549 |
+ seqan2::BamHeader header; |
| 550 |
resize(header, 2); |
| 551 |
|
| 552 |
// @HD header. |
| 553 |
|
| 554 |
|
| 555 |
+ seqan2::resize(header[0].tags, 2); |
| 556 |
+ header[0].type = seqan2::BAM_HEADER_FIRST; |
| 557 |
header[0].tags[0].i1 = "VN"; |
| 558 |
header[0].tags[0].i2 = "1.5"; |
| 559 |
header[0].tags[1].i1 = "GO"; |
| 560 |
header[0].tags[1].i2 = "query"; |
| 561 |
|
| 562 |
// @PG header. |
| 563 |
|
| 564 |
|
| 565 |
+ seqan2::resize(header[1].tags, 3); |
| 566 |
+ header[1].type = seqan2::BAM_HEADER_PROGRAM; |
| 567 |
header[1].tags[0].i1 = "ID"; |
| 568 |
header[1].tags[0].i2 = "hilive"; |
| 569 |
header[1].tags[1].i1 = "PN"; |
| 570 |
diff --git a/lib/tools.hscip-debian debian hilive 2.0a-6 hilive/upstream/`lib/tools.h`: b/lib/tools.hscip-debian debian hilive 2.0a-6 hilive/upstream/`lib/tools.h`: |
| 571 |
index 6f4167f..b9114c2 100644 |
| 572 |
--- a/lib/tools.h |
| 573 |
+++ b/lib/tools.h |
| 574 |
@@ -134,7 +134,7 @@ inline uint16_t getMateCycle( uint16_t mate_number, uint16_t seq_cycle ) { |
| 575 |
* @return The BAM header. |
| 576 |
* @author Tobias Loka |
| 577 |
*/ |
| 578 |
|
| 579 |
+seqan2::BamHeader getBamHeader(); |
| 580 |
|
| 581 |
/** |
| 582 |
* Name of a temporary SAM/BAM file (for the time it is written). |
| 583 |
diff --git a/lib/tools_static.hscip-debian debian hilive 2.0a-6 hilive/upstream/`lib/tools_static.h`: b/lib/tools_static.hscip-debian debian hilive 2.0a-6 hilive/upstream/`lib/tools_static.h`: |
| 584 |
index 99d084a..d353c88 100644 |
| 585 |
--- a/lib/tools_static.h |
| 586 |
+++ b/lib/tools_static.h |
| 587 |
@@ -36,7 +36,7 @@ inline bool gp_compare (GenomePosType i,GenomePosType j) { |
| 588 |
* @param r Second record. |
| 589 |
* @return true, if l has a lower positions than r. |
| 590 |
*/ |
| 591 |
|
| 592 |
+inline bool compare_records_by_pos(const seqan2::BamAlignmentRecord & l, const seqan2::BamAlignmentRecord & r) { |
| 593 |
if ( l.rID == r.rID ) |
| 594 |
return l.beginPos < r.beginPos; |
| 595 |
return l.rID < r.rID; |