+//just looking at common mistakes.
+int GetSeqsCommand::runSanityCheck(){
+ try {
+ string thisOutputDir = outputDir;
+ if (outputDir == "") { thisOutputDir += m->hasPath(fastafile); }
+ string filename = outputDir + "get.seqs.debug.report";
+
+ ofstream out;
+ m->openOutputFile(filename, out);
+
+
+ //compare fasta, name, qual and taxonomy if given to make sure they contain the same seqs
+ if (fastafile != "") {
+ if (namefile != "") { //compare with fasta
+ if (sanity["fasta"] != sanity["name"]) { //create mismatch file
+ createMisMatchFile(out, fastafile, namefile, sanity["fasta"], sanity["name"]);
+ }
+ }
+ if (qualfile != "") {
+ if (sanity["fasta"] != sanity["qual"]) { //create mismatch file
+ createMisMatchFile(out, fastafile, qualfile, sanity["fasta"], sanity["qual"]);
+ }
+ }
+ if (taxfile != "") {
+ if (sanity["fasta"] != sanity["tax"]) { //create mismatch file
+ createMisMatchFile(out, fastafile, taxfile, sanity["fasta"], sanity["tax"]);
+ }
+ }
+ }
+
+ //compare dupnames, groups and list if given to make sure they match
+ if (namefile != "") {
+ if (groupfile != "") {
+ if (sanity["dupname"] != sanity["group"]) { //create mismatch file
+ createMisMatchFile(out, namefile, groupfile, sanity["dupname"], sanity["group"]);
+ }
+ }
+ if (listfile != "") {
+ if (sanity["dupname"] != sanity["list"]) { //create mismatch file
+ createMisMatchFile(out, namefile, listfile, sanity["dupname"], sanity["list"]);
+ }
+ }
+ }else{
+
+ if ((groupfile != "") && (fastafile != "")) {
+ if (sanity["fasta"] != sanity["group"]) { //create mismatch file
+ createMisMatchFile(out, fastafile, groupfile, sanity["fasta"], sanity["group"]);
+ }
+ }
+ }
+
+ out.close();
+
+ if (m->isBlank(filename)) { m->mothurRemove(filename); }
+ else { m->mothurOut("\n[DEBUG]: " + filename + " contains the file mismatches.\n");outputNames.push_back(filename); outputTypes["debug"].push_back(filename); }
+
+ return 0;
+ }
+ catch(exception& e) {
+ m->errorOut(e, "GetSeqsCommand", "runSanityCheck");
+ exit(1);
+ }
+}
+//**********************************************************************************************************************
+//just looking at common mistakes.
+int GetSeqsCommand::createMisMatchFile(ofstream& out, string filename1, string filename2, set<string> set1, set<string> set2){
+ try {
+ out << "****************************************" << endl << endl;
+ out << "Names unique to " << filename1 << ":\n";
+
+ //remove names in set1 that are also in set2
+ for (set<string>::iterator it = set1.begin(); it != set1.end();) {
+ string name = *it;
+
+ if (set2.count(name) == 0) { out << name << endl; } //name unique to set1
+ else { set2.erase(name); } //you are in both so erase
+ set1.erase(it++);
+ }
+
+ out << "\nNames unique to " << filename2 << ":\n";
+ //output results
+ for (set<string>::iterator it = set2.begin(); it != set2.end(); it++) { out << *it << endl; }
+
+ out << "****************************************" << endl << endl;
+
+ return 0;
+ }
+ catch(exception& e) {
+ m->errorOut(e, "GetSeqsCommand", "runSanityCheck");
+ exit(1);
+ }
+}
+//**********************************************************************************************************************