X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=sffinfocommand.cpp;h=4965cfd75e06c9f8ba8157056922514581e3e10e;hb=8dd3c225255d7084e3aff8740aa4f1f1cabb367a;hp=765dc78e68a2ac12034853c008055b87d58abc03;hpb=e150b0b0664caec517485ee6d69dcdade6dcae77;p=mothur.git diff --git a/sffinfocommand.cpp b/sffinfocommand.cpp index 765dc78..4965cfd 100644 --- a/sffinfocommand.cpp +++ b/sffinfocommand.cpp @@ -170,7 +170,7 @@ SffInfoCommand::SffInfoCommand(string option) { //erase from file list filenames.erase(filenames.begin()+i); i--; - } + }else { m->setSFFFile(filenames[i]); } } } @@ -283,7 +283,7 @@ SffInfoCommand::SffInfoCommand(string option) { } if ((sfftxtFilename == "") && (filenames.size() == 0)) { - //if there is a current fasta file, use it + //if there is a current sff file, use it string filename = m->getSFFFile(); if (filename != "") { filenames.push_back(filename); m->mothurOut("Using " + filename + " as input file for the sff parameter."); m->mothurOutEndLine(); } else { m->mothurOut("[ERROR]: you must provide a valid sff or sfftxt file."); m->mothurOutEndLine(); abort=true; } @@ -303,7 +303,7 @@ int SffInfoCommand::execute(){ for (int s = 0; s < filenames.size(); s++) { - if (m->control_pressed) { for (int i = 0; i < outputNames.size(); i++) { remove(outputNames[i].c_str()); } return 0; } + if (m->control_pressed) { for (int i = 0; i < outputNames.size(); i++) { m->mothurRemove(outputNames[i]); } return 0; } int start = time(NULL); @@ -319,7 +319,7 @@ int SffInfoCommand::execute(){ if (sfftxtFilename != "") { parseSffTxt(); } - if (m->control_pressed) { for (int i = 0; i < outputNames.size(); i++) { remove(outputNames[i].c_str()); } return 0; } + if (m->control_pressed) { for (int i = 0; i < outputNames.size(); i++) { m->mothurRemove(outputNames[i]); } return 0; } //set fasta file as new current fastafile string current = ""; @@ -466,7 +466,7 @@ int SffInfoCommand::readCommonHeader(ifstream& in, CommonHeader& header){ //read offset char buffer2 [8]; in.read(buffer2, 8); - header.indexOffset = be_int8(*(unsigned long int *)(&buffer2)); + header.indexOffset = be_int8(*(unsigned long long *)(&buffer2)); //read index length char buffer3 [4]; @@ -513,8 +513,8 @@ int SffInfoCommand::readCommonHeader(ifstream& in, CommonHeader& header){ delete[] tempBuffer2; /* Pad to 8 chars */ - unsigned long int spotInFile = in.tellg(); - unsigned long int spot = (spotInFile + 7)& ~7; // ~ inverts + unsigned long long spotInFile = in.tellg(); + unsigned long long spot = (spotInFile + 7)& ~7; // ~ inverts in.seekg(spot); }else{ @@ -581,8 +581,8 @@ int SffInfoCommand::readHeader(ifstream& in, Header& header){ decodeName(header.timestamp, header.region, header.xy, header.name); /* Pad to 8 chars */ - unsigned long int spotInFile = in.tellg(); - unsigned long int spot = (spotInFile + 7)& ~7; + unsigned long long spotInFile = in.tellg(); + unsigned long long spot = (spotInFile + 7)& ~7; in.seekg(spot); }else{ @@ -634,8 +634,8 @@ int SffInfoCommand::readSeqData(ifstream& in, seqRead& read, int numFlowReads, i } /* Pad to 8 chars */ - unsigned long int spotInFile = in.tellg(); - unsigned long int spot = (spotInFile + 7)& ~7; + unsigned long long spotInFile = in.tellg(); + unsigned long long spot = (spotInFile + 7)& ~7; in.seekg(spot); }else{ @@ -901,13 +901,20 @@ int SffInfoCommand::parseSffTxt() { //output file names ofstream outFasta, outQual, outFlow; string outFastaFileName, outQualFileName; - string outFlowFileName = outputDir + m->getRootName(m->getSimpleName(sfftxtFilename)) + "flow"; + string fileRoot = m->getRootName(m->getSimpleName(sfftxtFilename)); + if (fileRoot.length() > 0) { + //rip off last . + fileRoot = fileRoot.substr(0, fileRoot.length()-1); + fileRoot = m->getRootName(fileRoot); + } + + string outFlowFileName = outputDir + fileRoot + "flow"; if (trim) { - outFastaFileName = outputDir + m->getRootName(m->getSimpleName(sfftxtFilename)) + "fasta"; - outQualFileName = outputDir + m->getRootName(m->getSimpleName(sfftxtFilename)) + "qual"; + outFastaFileName = outputDir + fileRoot + "fasta"; + outQualFileName = outputDir + fileRoot + "qual"; }else{ - outFastaFileName = outputDir + m->getRootName(m->getSimpleName(sfftxtFilename)) + "raw.fasta"; - outQualFileName = outputDir + m->getRootName(m->getSimpleName(sfftxtFilename)) + "raw.qual"; + outFastaFileName = outputDir + fileRoot + "raw.fasta"; + outQualFileName = outputDir + fileRoot + "raw.qual"; } if (fasta) { m->openOutputFile(outFastaFileName, outFasta); outputNames.push_back(outFastaFileName); outputTypes["fasta"].push_back(outFastaFileName); }