Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/dev' into dev
Browse files Browse the repository at this point in the history
  • Loading branch information
evolarjun committed Apr 5, 2024
2 parents 76e8905 + ed5d066 commit bfe6c47
Show file tree
Hide file tree
Showing 7 changed files with 507 additions and 24 deletions.
40 changes: 22 additions & 18 deletions stxtyper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@
* Dependencies: NCBI BLAST, gunzip (optional)
*
* Release changes:
* 1.0.19 03/26/2024 BlastAlignment::targetAlign is removed
* 1.0.18 03/19/2024 PD-4910 Element symbol is <stx type>_operon, Element name contains operon quality attribute"
Sequence name -> Element name in header
Sequence name, now Element name, should be type/subtype and include info when not complete e.g.,:
Expand Down Expand Up @@ -110,22 +112,22 @@ const string na ("na");



string stxType_reported_operon2elementSymbol (const string &stxType_reported,
const string &operon)
string stxType_reported_operon2elementName (const string &stxType_reported,
const string &operon)
{
string elementSymbol (stxType_reported + " operon");
string elementName (stxType_reported + " operon");
if (operon == "FRAMESHIFT")
elementSymbol += " with frameshift";
elementName += " with frameshift";
else if (operon == "INTERNAL_STOP")
elementSymbol += " with internal stop";
elementName += " with internal stop";
else if (contains (operon, "PARTIAL"))
elementSymbol = "Partial " + elementSymbol;
elementName = "Partial " + elementName;
else if (operon == "EXTENDED")
elementSymbol = "Extended " + elementSymbol;
elementName = "Extended " + elementName;
else if (contains (operon, "NOVEL"))
elementSymbol = "Novel " + elementSymbol;
elementName = "Novel " + elementName;

return elementSymbol;
return elementName;
}


Expand All @@ -145,7 +147,7 @@ struct BlastAlignment
string targetSeq;
bool targetStrand {true};
// false <=> negative
size_t targetAlign {0};
//size_t targetAlign {0};
// bp

// Reference
Expand Down Expand Up @@ -221,7 +223,7 @@ struct BlastAlignment
refStart--;
targetStart--;

targetAlign = targetEnd - targetStart;
//targetAlign = targetEnd - targetStart;
//QC_ASSERT (targetAlign_aa % 3 == 0);
//targetAlign_aa /= 3;

Expand Down Expand Up @@ -289,15 +291,15 @@ struct BlastAlignment
<< targetStart + 1 // 3 "Start"
<< targetEnd // 4 "Stop"
<< strand // 5 "Strand"
<< stxType_reported_operon2elementSymbol (stxType_reported, operon) // 6 "Element symbol"
<< "Shiga toxin" // 7 "Sequence name"
<< stxType_reported + "_operon" // 6 "Element symbol"
<< stxType_reported_operon2elementName (stxType_reported, operon) // 7 "Element name"
<< "plus" // 8 "Scope"
<< "VIRULENCE" // 9 "Element type"
<< "STX_TYPE" //10 "Element subtype"
<< subclass. substr (0, 4) //11 "Class"
<< subclass //12 "Subclass"
<< operon //13 "Method"
<< targetAlign //14 "Target length"
<< targetEnd - targetStart /*targetAlign*/ //14 "Target length"
<< noString /*refLen*/ //15 "Reference sequence length"
<< noString /*refCoverage*/ //16 "% Coverage of reference sequence"
<< refIdentity //17 "% Identity to reference sequence"
Expand Down Expand Up @@ -351,7 +353,7 @@ struct BlastAlignment
refEnd = prev. refEnd;
length += prev. length; // Approximately
nident += prev. nident; // Approximately
targetAlign += prev. targetAlign;
//targetAlign += prev. targetAlign;
if (prev. stopCodon)
stopCodon = true;
frameshift = true;
Expand All @@ -376,7 +378,9 @@ struct BlastAlignment
|| (targetStrand == (subunit == 'A') && targetLen - targetEnd <= missed_max);
}
bool getExtended () const
{ return ! refStart && refEnd + 1 == refLen; }
{ ASSERT (! truncated ());
return ! refStart && refEnd + 1 == refLen;
}
bool insideEq (const BlastAlignment &other) const
{ return targetStart >= other. targetStart
&& targetEnd <= other. targetEnd;
Expand Down Expand Up @@ -543,8 +547,8 @@ struct Operon
<< start // 3 "Start"
<< stop // 4 "Stop"
<< strand // 5 "Strand"
<< stxType_reported_operon2elementSymbol (stxType_reported, operonType) // 6 "Element symbol"
<< "Shiga toxin" // 7 "Sequence name"
<< stxType_reported + "_operon" // 6 "Element symbol"
<< stxType_reported_operon2elementName (stxType_reported, operonType) // 7 "Element name"
<< "plus" // 8 "Scope"
<< "VIRULENCE" // 9 "Element type"
<< "STX_TYPE" //10 "Element subtype"
Expand Down
8 changes: 8 additions & 0 deletions test/amrfinder_integration.expected
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#Protein identifier Contig id Start Stop Strand Element symbol Element name Scope Element type Element subtype Class Subclass Method Target length Reference sequence length % Coverage of reference sequence % Identity to reference sequence Alignment length Accession of closest sequence Name of closest sequence HMM id HMM description
na partial 27 1048 + stx2_operon Partial stx2 operon plus VIRULENCE STX_TYPE STX2 STX2 PARTIAL 1022 99.41 337 AAA16362.1, AAS07607.1 Shiga toxin stx2 na na
na partial_contig_end 3 661 - stx2_operon Partial stx2 operon plus VIRULENCE STX_TYPE STX2 STX2 PARTIAL_CONTIG_END 659 100.00 216 AAM70046.1, AAA16362.1 Shiga toxin stx2 na na
na stx1a 218 1444 + stx1a_operon stx1a operon plus VIRULENCE STX_TYPE STX1 STX1A COMPLETE 1227 100.00 406 AAA98347.1, AAA71894.1 Shiga toxin stx1a na na
na stx2_fs 2165 3232 + stx2_operon stx2 operon with frameshift plus VIRULENCE STX_TYPE STX2 STX2 FRAMESHIFT 1068 99.15 355 AAG01033.1, AAA16363.1 Shiga toxin stx2c na na
na stx2_novel 216 1456 + stx2_operon Novel stx2 operon plus VIRULENCE STX_TYPE STX2 STX2 COMPLETE_NOVEL 1241 99.76 410 AAA19623.1, AAA16363.1 Shiga toxin stx2c na na
na stx2_stop 694 1653 + stx2_operon stx2 operon with internal stop plus VIRULENCE STX_TYPE STX2 STX2 INTERNAL_STOP 960 91.25 320 AUM09788.1 Shiga toxin stx2h subunit A na na
na stx2c 1298 2538 - stx2c_operon stx2c operon plus VIRULENCE STX_TYPE STX2 STX2C COMPLETE 1241 100.00 410 AAA16363.1, AAS07596.1 Shiga toxin stx2c na na
Loading

0 comments on commit bfe6c47

Please sign in to comment.