}
int chimeraPenalty = computeChimeraPenalty();
-
+
//fills outputResults
chimera = chimeraMaligner(chimeraPenalty, decalc);
if (query->getAligned() == "") { return "no"; }
vector<Sequence*> temp = refSeqs;
+
+// for(int i=0;i<refSeqs.size();i++){
+// cout << refSeqs[i]->getName() << endl;
+// }
+
temp.push_back(query);
verticalFilter(temp);
if (m->control_pressed) { return chimera; }
vector<trace_struct> trace = mapTraceRegionsToAlignment(path, refSeqs);
-
+
if (trace.size() > 1) { chimera = "yes"; }
else { chimera = "no"; return chimera; }
int traceEnd = path[path.size()-1].col;
string queryInRange = query->getAligned();
queryInRange = queryInRange.substr(traceStart, (traceEnd-traceStart+1));
-
+// cout << queryInRange << endl;
string chimeraSeq = constructChimericSeq(trace, refSeqs);
+// cout << chimeraSeq << endl;
+
// cout << queryInRange.length() << endl;
// cout << chimeraSeq.length() << endl;
percentIdenticalQueryChimera = computePercentID(queryInRange, chimeraSeq);
+// cout << percentIdenticalQueryChimera << endl;
/*
vector<trace_struct> trace = extractHighestPath(matrix);
int regionEnd = trace[i].oldCol;
int seqIndex = trace[i].row;
+// cout << regionStart << '\t' << regionEnd << '\t' << seqIndex << endl;
results temp;
temp.parent = refSeqs[seqIndex]->getName();
temp.parentAligned = db[seqIndex]->getAligned();
temp.nastRegionStart = spotMap[regionStart];
temp.nastRegionEnd = spotMap[regionEnd];
- temp.regionStart = regionStart;
- temp.regionEnd = regionEnd;
+ temp.regionStart = unalignedMap[regionStart];
+ temp.regionEnd = unalignedMap[regionEnd];
string parentInRange = refSeqs[seqIndex]->getAligned();
parentInRange = parentInRange.substr(traceStart, (traceEnd-traceStart+1));
temp.queryToParentLocal = computePercentID(queryInRegion, parentInRegion);
-// cout << query->getName() << '\t' << temp.parent << '\t' << "NAST:" << temp.nastRegionStart << '-' << temp.nastRegionEnd << " G:" << temp.queryToParent << " L:" << temp.queryToParentLocal << ", " << temp.divR << endl;
+ //cout << query->getName() << '\t' << temp.parent << '\t' << "NAST:" << temp.nastRegionStart << '-' << temp.nastRegionEnd << " G:" << temp.queryToParent << " L:" << temp.queryToParentLocal << ", " << temp.divR << endl;
outputResults.push_back(temp);
}
seqs[i]->setAligned(newAligned);
}
-
+
+ string query = seqs[seqs.size()-1]->getAligned();
+ int queryLength = query.length();
+
+ unalignedMap.resize(queryLength, 0);
+
+
+ for(int i=1;i<queryLength;i++){
+ if(query[i] != '.' && query[i] != '-'){
+ unalignedMap[i] = unalignedMap[i-1] + 1;
+ }
+ else{
+ unalignedMap[i] = unalignedMap[i-1];
+ }
+ }
+
spotMap = newMap;
}
catch(exception& e) {
int numCols = query->getAligned().length();
int numRows = seqs.size();
+// cout << numRows << endl;
+
//initialize first col
string queryAligned = query->getAligned();
for (int i = 0; i < numRows; i++) {
//fill rest of matrix
for (int j = 1; j < numCols; j++) { //iterate through matrix columns
+// for (int i = 0; i < 1; i++) { //iterate through matrix rows
for (int i = 0; i < numRows; i++) { //iterate through matrix rows
string subjectAligned = seqs[i]->getAligned();
if ((!isalpha(queryAligned[j])) && (!isalpha(subjectAligned[j]))) {
//leave the same
}else if ((toupper(queryAligned[j]) == 'N') || (toupper(subjectAligned[j]) == 'N')) {
- //matchMisMatchScore = matchScore;
//leave the same
}else if (queryAligned[j] == subjectAligned[j]) {
matchMisMatchScore = matchScore;
-// ms[i][j].mismatches = ms[i][j-1].mismatches;
}else if (queryAligned[j] != subjectAligned[j]) {
matchMisMatchScore = misMatchPenalty;
-// ms[i][j].mismatches = ms[i][j-1].mismatches + 1;
}
-
+
//compute score based on previous columns scores
for (int prevIndex = 0; prevIndex < numRows; prevIndex++) { //iterate through rows
ms[i][j].prev = prevIndex;
}
}
+// cout << i << '\t' << j << '\t' << queryAligned[j] << '\t' << subjectAligned[j] << '\t' << matchMisMatchScore << '\t' << ms[i][j].score << endl;
+
}
+
}
- /* for(int i=0;i<numRows;i++){
- cout << seqs[i]->getName();
- for(int j=0;j<numCols;j++){
- cout << '\t' << ms[i][j].mismatches;
- }
- cout << endl;
- }
- cout << endl;*/
- /*cout << numRows << '\t' << numCols << endl;
- for(int i=0;i<numRows;i++){
- cout << seqs[i]->getName() << endl << seqs[i]->getAligned() << endl << endl;
- if ((seqs[i]->getName() == "S000003470") || (seqs[i]->getName() == "S000383265") || (seqs[i]->getName() == "7000004128191054")) {
- for(int j=0;j<numCols;j++){
- cout << '\t' << ms[i][j].score;
- }
- cout << endl;
- }
- }
- cout << endl;*/
- /*for(int i=0;i<numRows;i++){
- cout << seqs[i]->getName();
- for(int j=0;j<numCols;j++){
- cout << '\t' << ms[i][j].prev;
- }
- cout << endl;
- }*/
+
+
+
+
+// cout << numRows << '\t' << numCols << endl;
+// for(int i=0;i<numRows;i++){
+// cout << seqs[i]->getName();
+// for(int j=0;j<numCols;j++){
+// cout << '\t' << ms[i][j].score;
+// }
+// cout << endl;
+// }
+// cout << endl;
+//
+// for(int i=0;i<numRows;i++){
+// cout << seqs[i]->getName();
+// for(int j=0;j<numCols;j++){
+// cout << '\t' << ms[i][j].prev;
+// }
+// cout << endl;
+// }
}
int rowIndex = highestStruct.row;
int pos = highestStruct.col;
int score = highestStruct.score;
+
+// cout << rowIndex << '\t' << pos << '\t' << score << endl;
while (pos >= 0 && score > 0) {
score_struct temp = ms[rowIndex][pos];
for (int i = 1; i < path.size(); i++) {
int next_region_index = path[i].row;
-
+ //cout << i << '\t' << next_region_index << endl;
+
if (next_region_index != region_index) {
// add trace region
if (numBases == 0) { return 0; }
+// cout << numIdentical << '\t' << numBases << endl;
+
float percentIdentical = (numIdentical/(float)numBases) * 100;
// cout << percentIdentical << endl;