Commit bcaeb5da authored by Luis Pedro Coelho's avatar Luis Pedro Coelho
Browse files

Do not crash if -i is not provided

Provide a warning to the user instead.
parent 91a116fb
......@@ -656,13 +656,28 @@ std::map<std::string, char> CodonMap(codons, codons + sizeof codons / sizeof cod
s.erase(0,1);//There's an extra comma here
//We now have information about all of the snp's. If multiple, sperate them by ,
fprintf(stdout,"%s\t%s\t%ld\t%c\t%s\t%s\n",name.c_str(),geneName.c_str(),lP+1,//again, this one gets converted to 1 based representation
base,getCoverageString(map,nrSamples,"actgACTG,.").c_str(),s.c_str());
}
fprintf(stdout,"%s\t%s\t%ld\t%c\t%s\t%s\n",
name.c_str(),
geneName.c_str(),
long(lP+1),//again, this one gets converted to 1 based representation
base,
getCoverageString(map,nrSamples,"actgACTG,.").c_str(),
s.c_str());
}
if (indiv.length() != 0) {
indiv.erase(0,1);
fprintf(individualFile,"%s\t%s\t%ld\t%c\t%s\t%s\n",name.c_str(),geneName.c_str(),lP+1,//again, this one gets converted to 1 based representation
base,getCoverageString(map,nrSamples,"actgACTG,.").c_str(),indiv.c_str());
if (individualFile == NULL) {
fprintf(stderr, "Individual SNPs detected, but no individual output file specified (-i option).\n");
individualFile = fopen("/dev/null", "w"); // This way, in the next iteration, warning above will not be printed
} else {
fprintf(individualFile,"%s\t%s\t%ld\t%c\t%s\t%s\n",
name.c_str(),
geneName.c_str(),
long(lP+1),//again, this one gets converted to 1 based representation
base,
getCoverageString(map,nrSamples,"actgACTG,.").c_str(),
indiv.c_str());
}
}
}
......
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