Skip to content

Commit

Permalink
Merge pull request #13 from seqan/complement_output
Browse files Browse the repository at this point in the history
[FIX] always write found matches to file
  • Loading branch information
eaasna authored Jul 14, 2023
2 parents 35c7f5d + 08f6aca commit e886796
Show file tree
Hide file tree
Showing 6 changed files with 2,725 additions and 23 deletions.
22 changes: 8 additions & 14 deletions include/stellar/app/stellar.main.tpp
Original file line number Diff line number Diff line change
Expand Up @@ -155,14 +155,11 @@ _stellarMain(
_postproccessQueryMatches(databaseStrand, refLen, options, forwardMatches, disabledQueryIDs);
}); // measure_time

if (_shouldWriteOutputFile(databaseStrand, forwardMatches))
stellar_runtime.forward_strand_stellar_time.output_eps_matches_time.measure_time([&]()
{
stellar_runtime.forward_strand_stellar_time.output_eps_matches_time.measure_time([&]()
{
// output forwardMatches on positive database strand
_writeAllQueryMatchesToFile(forwardMatches, queryIDs, databaseStrand, options.outputFormat, outputFile);
}); // measure_time
}
// output forwardMatches on positive database strand
_writeAllQueryMatchesToFile(forwardMatches, queryIDs, databaseStrand, options.outputFormat, outputFile);
}); // measure_time

outputStatistics = _computeOutputStatistics(forwardMatches);
}); // measure_time
Expand Down Expand Up @@ -219,14 +216,11 @@ _stellarMain(
_postproccessQueryMatches(databaseStrand, refLen, options, reverseMatches, disabledQueryIDs);
}); // measure_time

if (_shouldWriteOutputFile(databaseStrand, reverseMatches))
stellar_runtime.reverse_strand_stellar_time.output_eps_matches_time.measure_time([&]()
{
stellar_runtime.reverse_strand_stellar_time.output_eps_matches_time.measure_time([&]()
{
// output reverseMatches on negative database strand
_writeAllQueryMatchesToFile(reverseMatches, queryIDs, databaseStrand, options.outputFormat, outputFile);
}); // measure_time
}
// output reverseMatches on negative database strand
_writeAllQueryMatchesToFile(reverseMatches, queryIDs, databaseStrand, options.outputFormat, outputFile);
}); // measure_time

outputStatistics.mergeIn(_computeOutputStatistics(reverseMatches));
}); // measure_time
Expand Down
10 changes: 1 addition & 9 deletions include/stellar/stellar_launcher.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,6 @@
namespace stellar
{

template <typename TAlphabet, typename TId>
bool _shouldWriteOutputFile(bool const databaseStrand, StringSet<QueryMatches<StellarMatch<String<TAlphabet> const, TId> > > const & matches)
{
// if databaseStrand == true always outputs
// if databaseStrand == false only outputs if TAlphabet == Dna5 or TAlphabet == Rna5
return databaseStrand || IsSameType<TAlphabet, Dna5>::VALUE || IsSameType<TAlphabet, Rna5>::VALUE;
}

template <typename TAlphabet, typename TId>
void _postproccessQueryMatches(bool const databaseStrand, uint64_t const & refLen,
StellarOptions const & options,
Expand All @@ -37,7 +29,7 @@ void _postproccessQueryMatches(bool const databaseStrand, uint64_t const & refLe

// adjust length for each matches of a single query (only for dna5 and rna5)
// TODO: WHY? This seems like an arbitrary restriction
if (_shouldWriteOutputFile(databaseStrand, matches))
if (databaseStrand || IsSameType<TAlphabet, Dna5>::VALUE || IsSameType<TAlphabet, Rna5>::VALUE)
_postproccessLengthAdjustment(refLen, matches);
}

Expand Down
97 changes: 97 additions & 0 deletions test/cli/gold_standard/dna_both/minLen20.gff
Original file line number Diff line number Diff line change
Expand Up @@ -602,3 +602,100 @@ seq1 Stellar eps-matches 739905 739923 95 + . seq2;seq2Range=623901,623920;cigar
seq1 Stellar eps-matches 841474 841492 95 + . seq2;seq2Range=619616,619635;cigar=9M1I10M;mutations=10A
seq1 Stellar eps-matches 912127 912145 95 + . seq2;seq2Range=281234,281253;cigar=3M1I16M;mutations=4A
seq1 Stellar eps-matches 997497 997515 95 + . seq2;seq2Range=570509,570528;cigar=15M1I4M;mutations=16G
seq1 Stellar eps-matches 765718 765740 95.6521 - . seq2;seq2Range=480465,480487;cigar=23M;mutations=15T
seq1 Stellar eps-matches 259870 259892 95.6521 - . seq2;seq2Range=242055,242077;cigar=23M;mutations=14T
seq1 Stellar eps-matches 986804 986825 95.4545 - . seq2;seq2Range=255704,255725;cigar=22M;mutations=9G
seq1 Stellar eps-matches 795116 795137 95.4545 - . seq2;seq2Range=100168,100188;cigar=15M1D6M;mutations=
seq1 Stellar eps-matches 590053 590074 95.4545 - . seq2;seq2Range=245228,245249;cigar=22M;mutations=17A
seq1 Stellar eps-matches 563210 563231 95.4545 - . seq2;seq2Range=355253,355274;cigar=22M;mutations=4A
seq1 Stellar eps-matches 353237 353258 95.4545 - . seq2;seq2Range=905108,905129;cigar=22M;mutations=3G
seq1 Stellar eps-matches 971517 971537 95.4545 - . seq2;seq2Range=55261,55282;cigar=9M1I12M;mutations=10T
seq1 Stellar eps-matches 960203 960223 95.238 - . seq2;seq2Range=617579,617598;cigar=19M1D1M;mutations=
seq1 Stellar eps-matches 887924 887944 95.238 - . seq2;seq2Range=527360,527380;cigar=21M;mutations=7T
seq1 Stellar eps-matches 814505 814525 95.238 - . seq2;seq2Range=546149,546168;cigar=8M1D12M;mutations=
seq1 Stellar eps-matches 721801 721821 95.4545 - . seq2;seq2Range=739398,739419;cigar=10M1I11M;mutations=11C
seq1 Stellar eps-matches 576858 576878 95.238 - . seq2;seq2Range=491562,491582;cigar=21M;mutations=3C
seq1 Stellar eps-matches 558950 558970 95.238 - . seq2;seq2Range=683633,683652;cigar=12M1D8M;mutations=
seq1 Stellar eps-matches 479518 479538 95.238 - . seq2;seq2Range=83080,83100;cigar=21M;mutations=19C
seq1 Stellar eps-matches 433635 433655 95.238 - . seq2;seq2Range=879014,879033;cigar=2M1D18M;mutations=
seq1 Stellar eps-matches 215664 215684 95.238 - . seq2;seq2Range=212347,212367;cigar=21M;mutations=10G
seq1 Stellar eps-matches 182569 182589 95.238 - . seq2;seq2Range=29771,29791;cigar=21M;mutations=13A
seq1 Stellar eps-matches 995415 995434 95 - . seq2;seq2Range=228306,228325;cigar=20M;mutations=8G
seq1 Stellar eps-matches 930403 930422 95 - . seq2;seq2Range=832382,832400;cigar=15M1D4M;mutations=
seq1 Stellar eps-matches 924969 924988 95 - . seq2;seq2Range=932201,932219;cigar=18M1D1M;mutations=
seq1 Stellar eps-matches 915539 915558 95.238 - . seq2;seq2Range=799352,799372;cigar=8M1I12M;mutations=9C
seq1 Stellar eps-matches 886471 886490 95 - . seq2;seq2Range=337574,337592;cigar=16M1D3M;mutations=
seq1 Stellar eps-matches 875106 875125 95 - . seq2;seq2Range=127516,127535;cigar=20M;mutations=9G
seq1 Stellar eps-matches 860711 860730 95 - . seq2;seq2Range=137910,137928;cigar=6M1D13M;mutations=
seq1 Stellar eps-matches 857248 857267 95.238 - . seq2;seq2Range=911396,911416;cigar=16M1I4M;mutations=17A
seq1 Stellar eps-matches 805362 805381 95 - . seq2;seq2Range=46863,46882;cigar=20M;mutations=4G
seq1 Stellar eps-matches 782079 782098 95 - . seq2;seq2Range=744396,744414;cigar=8M1D11M;mutations=
seq1 Stellar eps-matches 763601 763620 95 - . seq2;seq2Range=245161,245179;cigar=10M1D9M;mutations=
seq1 Stellar eps-matches 761138 761157 95 - . seq2;seq2Range=849566,849585;cigar=20M;mutations=7C
seq1 Stellar eps-matches 715611 715630 95 - . seq2;seq2Range=769274,769293;cigar=20M;mutations=11A
seq1 Stellar eps-matches 698067 698086 95 - . seq2;seq2Range=872432,872451;cigar=20M;mutations=4G
seq1 Stellar eps-matches 687547 687566 95 - . seq2;seq2Range=870365,870383;cigar=10M1D9M;mutations=
seq1 Stellar eps-matches 677977 677996 95 - . seq2;seq2Range=439433,439452;cigar=20M;mutations=11C
seq1 Stellar eps-matches 673645 673664 95 - . seq2;seq2Range=874398,874416;cigar=14M1D5M;mutations=
seq1 Stellar eps-matches 645038 645057 95 - . seq2;seq2Range=234191,234209;cigar=8M1D11M;mutations=
seq1 Stellar eps-matches 644858 644877 95 - . seq2;seq2Range=676277,676295;cigar=7M1D12M;mutations=
seq1 Stellar eps-matches 644813 644832 95 - . seq2;seq2Range=865801,865819;cigar=17M1D2M;mutations=
seq1 Stellar eps-matches 641510 641529 95 - . seq2;seq2Range=607675,607693;cigar=13M1D6M;mutations=
seq1 Stellar eps-matches 620345 620364 95 - . seq2;seq2Range=670708,670727;cigar=20M;mutations=16G
seq1 Stellar eps-matches 589984 590003 95 - . seq2;seq2Range=562730,562749;cigar=20M;mutations=3T
seq1 Stellar eps-matches 584612 584631 95.238 - . seq2;seq2Range=427382,427402;cigar=19M1I1M;mutations=20G
seq1 Stellar eps-matches 579568 579587 95 - . seq2;seq2Range=894330,894348;cigar=19M1D;mutations=
seq1 Stellar eps-matches 563144 563163 95 - . seq2;seq2Range=603709,603727;cigar=13M1D6M;mutations=
seq1 Stellar eps-matches 559003 559022 95.238 - . seq2;seq2Range=545195,545215;cigar=15M1I5M;mutations=16A
seq1 Stellar eps-matches 555342 555361 95 - . seq2;seq2Range=244036,244054;cigar=4M1D15M;mutations=
seq1 Stellar eps-matches 554010 554029 95 - . seq2;seq2Range=500180,500199;cigar=20M;mutations=19A
seq1 Stellar eps-matches 529470 529489 95.238 - . seq2;seq2Range=261759,261779;cigar=15M1I5M;mutations=16G
seq1 Stellar eps-matches 494432 494451 95 - . seq2;seq2Range=109070,109088;cigar=8M1D11M;mutations=
seq1 Stellar eps-matches 486491 486510 95 - . seq2;seq2Range=60990,61009;cigar=20M;mutations=14G
seq1 Stellar eps-matches 479793 479812 95 - . seq2;seq2Range=853178,853197;cigar=20M;mutations=12C
seq1 Stellar eps-matches 478520 478539 95 - . seq2;seq2Range=100372,100390;cigar=12M1D7M;mutations=
seq1 Stellar eps-matches 472552 472571 95 - . seq2;seq2Range=303200,303218;cigar=7M1D12M;mutations=
seq1 Stellar eps-matches 471158 471177 95.238 - . seq2;seq2Range=32620,32640;cigar=13M1I7M;mutations=14G
seq1 Stellar eps-matches 455364 455383 95.238 - . seq2;seq2Range=669817,669837;cigar=5M1I15M;mutations=6C
seq1 Stellar eps-matches 442608 442627 95 - . seq2;seq2Range=641357,641375;cigar=7M1D12M;mutations=
seq1 Stellar eps-matches 428970 428989 95 - . seq2;seq2Range=791789,791807;cigar=6M1D13M;mutations=
seq1 Stellar eps-matches 408714 408733 95 - . seq2;seq2Range=574104,574123;cigar=20M;mutations=6A
seq1 Stellar eps-matches 404450 404469 95 - . seq2;seq2Range=236052,236070;cigar=4M1D15M;mutations=
seq1 Stellar eps-matches 402092 402111 95 - . seq2;seq2Range=928807,928825;cigar=6M1D13M;mutations=
seq1 Stellar eps-matches 377549 377568 95 - . seq2;seq2Range=920264,920282;cigar=16M1D3M;mutations=
seq1 Stellar eps-matches 362963 362982 95 - . seq2;seq2Range=618522,618540;cigar=12M1D7M;mutations=
seq1 Stellar eps-matches 316447 316466 95.238 - . seq2;seq2Range=962072,962092;cigar=9M1I11M;mutations=10A
seq1 Stellar eps-matches 277755 277774 95 - . seq2;seq2Range=477270,477288;cigar=13M1D6M;mutations=
seq1 Stellar eps-matches 252314 252333 95 - . seq2;seq2Range=518921,518939;cigar=9M1D10M;mutations=
seq1 Stellar eps-matches 238268 238287 95.238 - . seq2;seq2Range=83582,83602;cigar=16M1I4M;mutations=17A
seq1 Stellar eps-matches 123831 123850 95 - . seq2;seq2Range=791401,791420;cigar=20M;mutations=15A
seq1 Stellar eps-matches 90438 90457 95 - . seq2;seq2Range=877934,877953;cigar=20M;mutations=6G
seq1 Stellar eps-matches 77396 77415 95 - . seq2;seq2Range=785298,785316;cigar=7M1D12M;mutations=
seq1 Stellar eps-matches 66376 66395 95 - . seq2;seq2Range=842457,842475;cigar=9M1D10M;mutations=
seq1 Stellar eps-matches 60971 60990 95 - . seq2;seq2Range=760087,760106;cigar=20M;mutations=13T
seq1 Stellar eps-matches 53898 53917 95 - . seq2;seq2Range=949225,949244;cigar=20M;mutations=10G
seq1 Stellar eps-matches 31264 31283 95 - . seq2;seq2Range=993852,993871;cigar=20M;mutations=4C
seq1 Stellar eps-matches 26503 26522 95 - . seq2;seq2Range=842546,842565;cigar=20M;mutations=9C
seq1 Stellar eps-matches 19458 19477 95 - . seq2;seq2Range=30538,30556;cigar=7M1D12M;mutations=
seq1 Stellar eps-matches 954644 954662 95 - . seq2;seq2Range=566182,566201;cigar=3M1I16M;mutations=4A
seq1 Stellar eps-matches 905577 905595 95 - . seq2;seq2Range=528544,528563;cigar=16M1I3M;mutations=17G
seq1 Stellar eps-matches 805470 805488 95 - . seq2;seq2Range=41851,41870;cigar=12M1I7M;mutations=13G
seq1 Stellar eps-matches 795190 795208 95 - . seq2;seq2Range=361614,361633;cigar=8M1I11M;mutations=9T
seq1 Stellar eps-matches 763547 763565 95 - . seq2;seq2Range=469456,469475;cigar=4M1I15M;mutations=5C
seq1 Stellar eps-matches 732502 732520 95 - . seq2;seq2Range=446091,446110;cigar=2M1I17M;mutations=3C
seq1 Stellar eps-matches 643822 643840 95 - . seq2;seq2Range=244584,244603;cigar=16M1I3M;mutations=17T
seq1 Stellar eps-matches 603126 603144 95 - . seq2;seq2Range=192740,192759;cigar=15M1I4M;mutations=16G
seq1 Stellar eps-matches 508105 508123 95 - . seq2;seq2Range=400207,400226;cigar=8M1I11M;mutations=9T
seq1 Stellar eps-matches 447396 447414 95 - . seq2;seq2Range=828387,828406;cigar=17M1I2M;mutations=18A
seq1 Stellar eps-matches 424852 424870 95 - . seq2;seq2Range=882879,882898;cigar=13M1I6M;mutations=14T
seq1 Stellar eps-matches 418601 418619 95 - . seq2;seq2Range=159496,159515;cigar=17M1I2M;mutations=18G
seq1 Stellar eps-matches 399065 399083 95 - . seq2;seq2Range=932045,932064;cigar=14M1I5M;mutations=15C
seq1 Stellar eps-matches 346392 346410 95 - . seq2;seq2Range=246662,246681;cigar=4M1I15M;mutations=5G
seq1 Stellar eps-matches 313455 313473 95 - . seq2;seq2Range=993116,993135;cigar=6M1I13M;mutations=7G
seq1 Stellar eps-matches 303067 303085 95 - . seq2;seq2Range=935085,935104;cigar=8M1I11M;mutations=9C
seq1 Stellar eps-matches 293473 293491 95 - . seq2;seq2Range=421802,421821;cigar=18M1I1M;mutations=19C
seq1 Stellar eps-matches 285955 285973 95 - . seq2;seq2Range=517350,517369;cigar=5M1I14M;mutations=6G
seq1 Stellar eps-matches 273607 273625 95 - . seq2;seq2Range=9351,9370;cigar=6M1I13M;mutations=7G
seq1 Stellar eps-matches 216605 216623 95 - . seq2;seq2Range=669253,669272;cigar=9M1I10M;mutations=10T
seq1 Stellar eps-matches 71324 71342 95 - . seq2;seq2Range=218249,218268;cigar=6M1I13M;mutations=7C
seq1 Stellar eps-matches 3331 3349 95 - . seq2;seq2Range=631237,631256;cigar=9M1I10M;mutations=10T
Loading

0 comments on commit e886796

Please sign in to comment.