+void SeqErrorCommand::printSubMatrix(){
+ try {
+ string fileNameRoot = outputDir + m->getRootName(m->getSimpleName(queryFileName));
+ map<string, string> variables;
+ variables["[filename]"] = fileNameRoot;
+ string subMatrixFileName = getOutputFileName("errormatrix",variables);
+ ofstream subMatrixFile;
+ m->openOutputFile(subMatrixFileName, subMatrixFile);
+ outputNames.push_back(subMatrixFileName); outputTypes["errormatrix"].push_back(subMatrixFileName);
+ vector<string> bases(6);
+ bases[0] = "A";
+ bases[1] = "T";
+ bases[2] = "G";
+ bases[3] = "C";
+ bases[4] = "Gap";
+ bases[5] = "N";
+ vector<int> refSums(5,1);
+
+ for(int i=0;i<5;i++){
+ subMatrixFile << "\tr" << bases[i];
+
+ for(int j=0;j<6;j++){
+ refSums[i] += substitutionMatrix[i][j];
+ }
+ }
+ subMatrixFile << endl;
+
+ for(int i=0;i<6;i++){
+ subMatrixFile << 'q' << bases[i];
+ for(int j=0;j<5;j++){
+ subMatrixFile << '\t' << substitutionMatrix[j][i];
+ }
+ subMatrixFile << endl;
+ }
+
+ subMatrixFile << "total";
+ for(int i=0;i<5;i++){
+ subMatrixFile << '\t' << refSums[i];
+ }
+ subMatrixFile << endl;
+ subMatrixFile.close();
+ }
+ catch(exception& e) {
+ m->errorOut(e, "SeqErrorCommand", "printSubMatrix");
+ exit(1);
+ }
+}
+
+//***************************************************************************************************************
+
+void SeqErrorCommand::printErrorFRFile(map<char, vector<int> > errorForward, map<char, vector<int> > errorReverse){
+ try{
+ string fileNameRoot = outputDir + m->getRootName(m->getSimpleName(queryFileName));
+ map<string, string> variables;
+ variables["[filename]"] = fileNameRoot;
+ string errorForwardFileName = getOutputFileName("errorforward",variables);
+ ofstream errorForwardFile;
+ m->openOutputFile(errorForwardFileName, errorForwardFile);
+ outputNames.push_back(errorForwardFileName); outputTypes["errorforward"].push_back(errorForwardFileName);
+
+ errorForwardFile << "position\ttotalseqs\tmatch\tsubstitution\tinsertion\tdeletion\tambiguous" << endl;
+ for(int i=0;i<maxLength;i++){
+ float match = (float)errorForward['m'][i];
+ float subst = (float)errorForward['s'][i];
+ float insert = (float)errorForward['i'][i];
+ float del = (float)errorForward['d'][i];
+ float amb = (float)errorForward['a'][i];
+ float total = match + subst + insert + del + amb;
+ if(total == 0){ break; }
+ errorForwardFile << i+1 << '\t' << total << '\t' << match/total << '\t' << subst/total << '\t' << insert/total << '\t' << del/total << '\t' << amb/total << endl;
+ }
+ errorForwardFile.close();
+
+ string errorReverseFileName = getOutputFileName("errorreverse",variables);
+ ofstream errorReverseFile;
+ m->openOutputFile(errorReverseFileName, errorReverseFile);
+ outputNames.push_back(errorReverseFileName); outputTypes["errorreverse"].push_back(errorReverseFileName);
+
+ errorReverseFile << "position\ttotalseqs\tmatch\tsubstitution\tinsertion\tdeletion\tambiguous" << endl;
+ for(int i=0;i<maxLength;i++){
+ float match = (float)errorReverse['m'][i];
+ float subst = (float)errorReverse['s'][i];
+ float insert = (float)errorReverse['i'][i];
+ float del = (float)errorReverse['d'][i];
+ float amb = (float)errorReverse['a'][i];
+ float total = match + subst + insert + del + amb;
+ if(total == 0){ break; }
+ errorReverseFile << i+1 << '\t' << total << '\t' << match/total << '\t' << subst/total << '\t' << insert/total << '\t' << del/total << '\t' << amb/total << endl;
+ }
+ errorReverseFile.close();
+ }
+ catch(exception& e) {
+ m->errorOut(e, "SeqErrorCommand", "printErrorFRFile");
+ exit(1);
+ }
+}
+
+//***************************************************************************************************************
+
+void SeqErrorCommand::printErrorQuality(map<char, vector<int> > qScoreErrorMap){
+ try{
+ string fileNameRoot = outputDir + m->getRootName(m->getSimpleName(queryFileName));
+ map<string, string> variables;
+ variables["[filename]"] = fileNameRoot;
+ string errorQualityFileName = getOutputFileName("errorquality",variables);
+ ofstream errorQualityFile;
+ m->openOutputFile(errorQualityFileName, errorQualityFile);
+ outputNames.push_back(errorQualityFileName); outputTypes["errorquality"].push_back(errorQualityFileName);
+
+ errorQualityFile << "qscore\tmatches\tsubstitutions\tinsertions\tambiguous" << endl;
+ for(int i=0;i<41;i++){
+ errorQualityFile << i << '\t' << qScoreErrorMap['m'][i] << '\t' << qScoreErrorMap['s'][i] << '\t' << qScoreErrorMap['i'][i] << '\t'<< qScoreErrorMap['a'][i] << endl;
+ }
+ errorQualityFile.close();
+ }
+ catch(exception& e) {
+ m->errorOut(e, "SeqErrorCommand", "printErrorQuality");
+ exit(1);
+ }
+}
+
+//***************************************************************************************************************
+
+void SeqErrorCommand::printQualityFR(vector<vector<int> > qualForwardMap, vector<vector<int> > qualReverseMap){