diff --git a/alignment.cpp b/alignment.cpp index 294e62e..e0da274 100644 --- a/alignment.cpp +++ b/alignment.cpp @@ -700,6 +700,12 @@ void Alignment::qc () const QC_ASSERT (nident <= (refEnd - refStart) / al2ref_len); QC_ASSERT (nident <= (targetEnd - targetStart) / al2target_len); + + for (const SeqChange& seqChange : seqChanges) + { + seqChange. qc (); + QC_ASSERT (seqChange. al == this); + } } diff --git a/amr_report.cpp b/amr_report.cpp index fadc32f..ca4a32c 100644 --- a/amr_report.cpp +++ b/amr_report.cpp @@ -1180,8 +1180,7 @@ struct Batch for (const SeqChange& seqChange1 : blastAl1->seqChanges) { ASSERT (seqChange1. al == blastAl1); - if (! seqChange1. mutation) - continue; + ASSERT (seqChange1. mutation); for (const BlastAlignment* blastAl2 : goodBlastAls) if ( blastAl2->targetName == blastAl1->targetName && blastAl2->targetStrand == blastAl1->targetStrand @@ -1190,6 +1189,7 @@ struct Batch for (Iter> iter (var_cast (blastAl2) -> seqChanges); iter. next (); ) { SeqChange& seqChange2 = *iter; + ASSERT (seqChange2. mutation); ASSERT (seqChange2. al == blastAl2); if ( seqChange1. start_target == seqChange2. start_target && seqChange1. better (seqChange2) diff --git a/amrfinder.cpp b/amrfinder.cpp index f7933bb..c6f939c 100644 --- a/amrfinder.cpp +++ b/amrfinder.cpp @@ -33,6 +33,8 @@ * cat, cp, cut, grep, head, mkdir, mv, nproc, sed, sort, tail * * Release changes: +* 3.6.3 01/03/2020 PD-3230 sorting of report rows +* 12/28/2019 QC in dna_mutation * 3.6.2 12/27/2019 PD-3230 Redundant reported lines are removed for mutated reference proteins * Reports are sorted by sort * 3.6.1 12/27/2019 PD-3230 Mutated proteins are added to AMRProt @@ -90,7 +92,7 @@ using namespace Common_sp; #ifdef SVN_REV #define SOFTWARE_VER SVN_REV #else - #define SOFTWARE_VER "3.6.2" + #define SOFTWARE_VER "3.6.3" #endif #define DATA_VER_MIN "2019-12-26.1" @@ -655,8 +657,8 @@ struct ThisApplication : ShellApplication } // Sorting - // PD-2244 - const string sortS (emptyArg (dna) && emptyArg (gff) ? "-k2 -k1" : "-k2 -k3n -k4n -k5 -k1"); + // PD-2244, PD-3230 + const string sortS (emptyArg (dna) && emptyArg (gff) ? "-k1,1 -k2,2" : "-k1,1 -k2,2 -k3,3n -k4,4n -k5,5"); exec ("head -1 " + tmp + ".amr > " + tmp + ".amr-out"); exec ("LANG=C && tail -n +2 " + tmp + ".amr | sort " + sortS + " >> " + tmp + ".amr-out"); exec ("mv " + tmp + ".amr-out " + tmp + ".amr"); diff --git a/amrfinder_update.cpp b/amrfinder_update.cpp index 584a160..51e2536 100644 --- a/amrfinder_update.cpp +++ b/amrfinder_update.cpp @@ -56,7 +56,7 @@ using namespace Common_sp; #ifdef SVN_REV #define SOFTWARE_VER SVN_REV #else - #define SOFTWARE_VER "3.6.2" + #define SOFTWARE_VER "3.6.3" #endif string curMinor; diff --git a/dna_mutation.cpp b/dna_mutation.cpp index 8a25a12..40cee86 100644 --- a/dna_mutation.cpp +++ b/dna_mutation.cpp @@ -51,7 +51,7 @@ using namespace Alignment_sp; #ifdef SVN_REV #define SOFTWARE_VER SVN_REV #else - #define SOFTWARE_VER "3.6.2" + #define SOFTWARE_VER "3.6.3" #endif @@ -65,7 +65,6 @@ unique_ptr mutation_all; // ?? struct BlastnAlignment : Alignment -// BLASTN alignment { // PD-2001 static constexpr const size_t flankingLen = 200; // PAR @@ -149,7 +148,7 @@ struct BlastnAlignment : Alignment struct Batch { - vector blastAls; + VectorOwn blastAls; explicit Batch (const string &mutation_tab) @@ -214,10 +213,11 @@ struct Batch os << td. str () << endl; } - for (const auto& blastAl : blastAls) + for (const BlastnAlignment* blastAl : blastAls) { - blastAl. qc (); - blastAl. saveText (os); + ASSERT (blastAl); + blastAl->qc (); + blastAl->saveText (os); } } }; @@ -259,10 +259,12 @@ struct ThisApplication : Application if (verbose ()) cout << f. line << endl; } - BlastnAlignment al (f. line); - al. qc (); - if (al. good ()) - batch. blastAls. push_back (move (al)); + auto al = new BlastnAlignment (f. line); + al->qc (); + if (al->good ()) + batch. blastAls << al; + else + delete al; } } if (verbose ()) @@ -275,32 +277,35 @@ struct ThisApplication : Application if (verbose ()) { cout << "After process():" << endl; - for (const auto& blastAl : batch. blastAls) + for (const BlastnAlignment* blastAl : batch. blastAls) { - blastAl. saveText (cout); - cout << ' ' << blastAl. seqChanges. size () << endl; + ASSERT (blastAl); + blastAl->saveText (cout); + cout << ' ' << blastAl->seqChanges. size () << endl; } } - for (const BlastnAlignment& blastAl1 : batch. blastAls) - for (const SeqChange& seqChange1 : blastAl1. seqChanges) + for (const BlastnAlignment* blastAl1 : batch. blastAls) + for (const SeqChange& seqChange1 : blastAl1->seqChanges) { - if (! seqChange1. mutation) - continue; - for (BlastnAlignment& blastAl2 : batch. blastAls) - if ( blastAl2. targetName == blastAl1. targetName - && blastAl2. targetStrand == blastAl1. targetStrand - && & blastAl2 != & blastAl1 + ASSERT (seqChange1. al == blastAl1); + ASSERT (seqChange1. mutation); + for (const BlastnAlignment* blastAl2 : batch. blastAls) + if ( blastAl2->targetName == blastAl1->targetName + && blastAl2->targetStrand == blastAl1->targetStrand + && blastAl2 != blastAl1 ) - for (SeqChange& seqChange2 : blastAl2. seqChanges) + //for (SeqChange& seqChange2 : blastAl2. seqChanges) + for (Iter> iter (var_cast (blastAl2) -> seqChanges); iter. next (); ) { - if (! seqChange2. mutation) - continue; + SeqChange& seqChange2 = *iter; + ASSERT (seqChange2. al == blastAl2); + ASSERT (seqChange2. mutation); if ( seqChange1. start_target == seqChange2. start_target && seqChange1. neighborhoodMismatch < seqChange2. neighborhoodMismatch ) - seqChange2 = SeqChange (); + iter. erase (); } } diff --git a/version.txt b/version.txt index b727628..4a788a0 100644 --- a/version.txt +++ b/version.txt @@ -1 +1 @@ -3.6.2 +3.6.3