Commit 39c51b1b authored by Yannis Duffourd's avatar Yannis Duffourd

Adding full cs sequence capabilities

parent 1efacb84
......@@ -1740,44 +1740,20 @@ void Vihgo::writeFullConsensus() {
cerr << "Writing full consensus sequence ... " << endl;
ofstream csStream;
csStream.open((this->getConsensusFile()).c_str(), ios::out);
csStream << ">" << "full_cs_sequence" << endl;
map<string, map<int, map<string, int>>>::iterator myIterA;
map<int, map<string, int>>::iterator myIterB;
map<string, int>::iterator myIterC;
map<string, map<int, string>>::iterator myIterE;
map<int, string>::iterator myIterF;
for (myIterE = this->protCodon.begin(); myIterE != this->protCodon.end();
myIterE++) {
string prot = myIterE->first;
string chrom = getChrFromProt(prot);
if (!(this->sampleData.count(chrom) > 0)) {
continue;
}
csStream << ">" << prot << endl;
for (myIterF = (myIterE->second).begin();
myIterF != (myIterE->second).end(); myIterF++) {
int aaPosition = myIterF->first;
int gPosition;
map<int, int> tmpMap = this->refProtCorresp[prot];
map<int, int>::iterator myIterG;
for (myIterG = tmpMap.begin(); myIterG != tmpMap.end(); myIterG++) {
if (myIterG->second == aaPosition) {
gPosition = myIterG->first;
break;
}
}
// cerr << "ppos : " << aaPosition << " ; genomic position is : " <<
// gPosition << endl;
map<string, map<int, string>>::iterator myIterA;
map<int, string>::iterator myIterB;
// determine most frequent codon
for (myIterA = this->referenceCodon.begin(); myIterA != this->referenceCodon.end();
myIterA++) {
string chrom = myIterA->first;
for (myIterB = (myIterA->second).begin();
myIterB != (myIterA->second).end(); myIterB++) {
int gPosition = myIterB->first;
// determine most frequent codon at this position
string codon = "NNN";
int count = 0;
if (this->sampleData[chrom].count(gPosition) > 0) {
map<string, int> tmpMapCodon;
tmpMapCodon = this->sampleData[chrom][gPosition];
......@@ -1790,6 +1766,7 @@ void Vihgo::writeFullConsensus() {
}
}
}
// write codon : if found will be a true codon, other wise will be a NNN
csStream << codon;
}
csStream << endl;
......
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