Commit 0243b7fc authored by Yannis Duffourd's avatar Yannis Duffourd

Adding support for undetermined AA from codon containing N

parent a279d9db
...@@ -550,7 +550,7 @@ void Vihgo::writeCodonFile( string incType ) ...@@ -550,7 +550,7 @@ void Vihgo::writeCodonFile( string incType )
{ {
string ref = *myIterD; string ref = *myIterD;
string refCodon = this->referenceCodon[myIterA->first][myIterB->first]; string refCodon = this->referenceCodon[myIterA->first][myIterB->first];
string refAA = this->codonTable[refCodon]; string refAA = this->getAAfromCodon(refCodon);
int position = this->refProtCorresp[ref][myIterB->first]; int position = this->refProtCorresp[ref][myIterB->first];
double depth = 0.0; double depth = 0.0;
...@@ -563,7 +563,7 @@ void Vihgo::writeCodonFile( string incType ) ...@@ -563,7 +563,7 @@ void Vihgo::writeCodonFile( string incType )
for( myIterC = (myIterB->second).begin() ; myIterC != (myIterB->second).end() ; myIterC ++ ) for( myIterC = (myIterB->second).begin() ; myIterC != (myIterB->second).end() ; myIterC ++ )
{ {
string altCodon = myIterC->first; string altCodon = myIterC->first;
string altAA = this->codonTable[altCodon]; string altAA = this->getAAfromCodon(altCodon);
double altCount = myIterC->second; double altCount = myIterC->second;
double allelicRatio = ( altCount / depth ) * 100; double allelicRatio = ( altCount / depth ) * 100;
...@@ -610,6 +610,7 @@ void Vihgo::writeCodonFile( string incType ) ...@@ -610,6 +610,7 @@ void Vihgo::writeCodonFile( string incType )
} }
// Method to get annotation for variation // Method to get annotation for variation
// Actually has been deactivated yet // Actually has been deactivated yet
// NEED A REWAMP FOR ADAPTATION TO ALL VIRUS; VCF FORMAT // NEED A REWAMP FOR ADAPTATION TO ALL VIRUS; VCF FORMAT
...@@ -1058,14 +1059,14 @@ int Vihgo::variantCalling() ...@@ -1058,14 +1059,14 @@ int Vihgo::variantCalling()
double altNumber = 0.0; double altNumber = 0.0;
string refCodon = this->referenceCodon[myIterA->first][myIterB->first]; string refCodon = this->referenceCodon[myIterA->first][myIterB->first];
string aa = codonTable[refCodon]; string aa = this->getAAfromCodon(refCodon);
// cerr << "Analysing codon " << myIterA->first << ":" << myIterB->first << " ; Ref is : " << refCodon << " : " << aa << endl; // cerr << "Analysing codon " << myIterA->first << ":" << myIterB->first << " ; Ref is : " << refCodon << " : " << aa << endl;
for( myIterC = (myIterB->second).begin() ; myIterC != (myIterB->second).end() ; myIterC ++ ) for( myIterC = (myIterB->second).begin() ; myIterC != (myIterB->second).end() ; myIterC ++ )
{ {
string currentCodon = myIterC->first; string currentCodon = myIterC->first;
string currentAa = codonTable[currentCodon]; string currentAa = this->getAAfromCodon(currentCodon);
// cerr << "\tin control : " << currentCodon << " : " << currentAa << " : " << myIterC->second << endl; // cerr << "\tin control : " << currentCodon << " : " << currentAa << " : " << myIterC->second << endl;
...@@ -1107,14 +1108,14 @@ int Vihgo::variantCalling() ...@@ -1107,14 +1108,14 @@ int Vihgo::variantCalling()
double altNumber = 0.0; double altNumber = 0.0;
string refCodon = this->referenceCodon[myIterA->first][myIterB->first]; string refCodon = this->referenceCodon[myIterA->first][myIterB->first];
string aa = codonTable[refCodon]; string aa = this->getAAfromCodon(refCodon);
// cerr << "Analysing codon " << myIterA->first << ":" << myIterB->first << " ; Ref is : " << refCodon << " : " << aa << endl; // cerr << "Analysing codon " << myIterA->first << ":" << myIterB->first << " ; Ref is : " << refCodon << " : " << aa << endl;
for( myIterC = (myIterB->second).begin() ; myIterC != (myIterB->second).end() ; myIterC ++ ) for( myIterC = (myIterB->second).begin() ; myIterC != (myIterB->second).end() ; myIterC ++ )
{ {
string currentCodon = myIterC->first; string currentCodon = myIterC->first;
string currentAa = codonTable[currentCodon]; string currentAa = this->getAAfromCodon(currentCodon);
// cerr << "\tin sample : " << currentCodon << " : " << currentAa << " : " << myIterC->second << endl; // cerr << "\tin sample : " << currentCodon << " : " << currentAa << " : " << myIterC->second << endl;
...@@ -1240,7 +1241,7 @@ int Vihgo::variantCalling() ...@@ -1240,7 +1241,7 @@ int Vihgo::variantCalling()
// result file // result file
ofstream outresultStream; ofstream outresultStream;
outresultStream.open( (this->outputFile).c_str() , ios::out); outresultStream.open( (this->outputFile).c_str() , ios::out);
outresultStream << "#gene\tchromosome\tgPosition\tAAPosition\treferenceCodon\treferenceAA\tvariantCodon\tvariantAA\ttotalDepth\tAlternativeAlleleratio\tFETp-value\tFETbgp-value\tAnnotation" << endl; outresultStream << "#chromosome\tgPosition\tgene\tAAPosition\treferenceCodon\treferenceAA\tvariantCodon\tvariantAA\ttotalDepth\tAlternativeAlleleratio\tFETp-value\tFETbgp-value\tAnnotation" << endl;
// test each position // test each position
cerr << "Variant calling in progress ... " << endl; cerr << "Variant calling in progress ... " << endl;
...@@ -1282,11 +1283,11 @@ int Vihgo::variantCalling() ...@@ -1282,11 +1283,11 @@ int Vihgo::variantCalling()
// cerr << "\t\tgetting ref informations ..." << endl; // cerr << "\t\tgetting ref informations ..." << endl;
string refCodon = this->referenceCodon[myIterD->first][myIterE->first]; string refCodon = this->referenceCodon[myIterD->first][myIterE->first];
string aa = codonTable[refCodon]; string aa = this->getAAfromCodon(refCodon);
// cerr << "\t\tgetting sample informations ..." << endl; // cerr << "\t\tgetting sample informations ..." << endl;
string currentCodon = myIterF->first; string currentCodon = myIterF->first;
string currentAa = codonTable[currentCodon]; string currentAa = this->getAAfromCodon(currentCodon);
// disengage variant calling if ref aa = alt aa (synonymous) // disengage variant calling if ref aa = alt aa (synonymous)
if (aa == currentAa) if (aa == currentAa)
...@@ -1923,7 +1924,18 @@ char Vihgo::getReferenceBase( string incChr , int incPos ) ...@@ -1923,7 +1924,18 @@ char Vihgo::getReferenceBase( string incChr , int incPos )
} }
} }
// method to get AA from a codon
string Vihgo::getAAfromCodon( string incCodon )
{
if ( this->codonTable.count( incCodon ) > 0)
{
return this->codonTable[incCodon];
}
else
{
return "?";
}
}
vector<string> Vihgo::getAnnotationFiles() vector<string> Vihgo::getAnnotationFiles()
......
...@@ -73,6 +73,8 @@ class Vihgo ...@@ -73,6 +73,8 @@ class Vihgo
char getBase( int ); char getBase( int );
char getReferenceBase( std::string , int ); char getReferenceBase( std::string , int );
// map of codon // map of codon
std::map<std::string , std::string > codonTable; std::map<std::string , std::string > codonTable;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment