X-Git-Url: https://git.donarmstrong.com/?p=mothur.git;a=blobdiff_plain;f=sffinfocommand.cpp;h=c80ac2e51859331f17f02bcdf5abdd3f89bec6f3;hp=3961802804f02c5d60c2a017803b666f43e74047;hb=615301e57c25e241356a9c2380648d117709458d;hpb=1a20e24ee786195ab0e1cccd4f5aede7a88f3f4e diff --git a/sffinfocommand.cpp b/sffinfocommand.cpp index 3961802..c80ac2e 100644 --- a/sffinfocommand.cpp +++ b/sffinfocommand.cpp @@ -646,7 +646,7 @@ int SffInfoCommand::readCommonHeader(ifstream& in, CommonHeader& header){ char buffer3 [4]; in.read(buffer3, 4); header.indexLength = be_int4(*(unsigned int *)(&buffer3)); - + //read num reads char buffer4 [4]; in.read(buffer4, 4); @@ -741,9 +741,19 @@ int SffInfoCommand::adjustCommonHeader(CommonHeader header){ in.read(mybuffer,8); for (int i = 0; i < filehandlesHeaders.size(); i++) { for (int j = 0; j < filehandlesHeaders[i].size(); j++) { + unsigned long long offset = 0; + char* thisbuffer = new char[8]; + thisbuffer[0] = (offset >> 56) & 0xFF; + thisbuffer[1] = (offset >> 48) & 0xFF; + thisbuffer[2] = (offset >> 40) & 0xFF; + thisbuffer[3] = (offset >> 32) & 0xFF; + thisbuffer[4] = (offset >> 24) & 0xFF; + thisbuffer[5] = (offset >> 16) & 0xFF; + thisbuffer[6] = (offset >> 8) & 0xFF; + thisbuffer[7] = offset & 0xFF; ofstream out; m->openOutputFileAppend(filehandlesHeaders[i][j], out); - out.write(mybuffer, in.gcount()); + out.write(thisbuffer, 8); out.close(); } } @@ -757,7 +767,13 @@ int SffInfoCommand::adjustCommonHeader(CommonHeader header){ for (int j = 0; j < filehandlesHeaders[i].size(); j++) { ofstream out; m->openOutputFileAppend(filehandlesHeaders[i][j], out); - out.write(mybuffer, in.gcount()); + int offset = 0; + char* thisbuffer = new char[4]; + thisbuffer[0] = (offset >> 24) & 0xFF; + thisbuffer[1] = (offset >> 16) & 0xFF; + thisbuffer[2] = (offset >> 8) & 0xFF; + thisbuffer[3] = offset & 0xFF; + out.write(thisbuffer, 4); out.close(); } } @@ -871,7 +887,7 @@ int SffInfoCommand::adjustCommonHeader(CommonHeader header){ for (int i = 0; i < filehandlesHeaders.size(); i++) { for (int j = 0; j < filehandlesHeaders[i].size(); j++) { ofstream out; - m->openOutputFileAppend(filehandlesHeaders[i][j], out); + m->openOutputFileBinaryAppend(filehandlesHeaders[i][j], out); out.write(mybuffer, spot-spotInFile); out.close(); } @@ -920,7 +936,7 @@ int SffInfoCommand::readSeqData(ifstream& in, seqRead& read, int numFlowReads, H char buffer5 [2]; in.read(buffer5, 2); header.clipQualRight = be_int2(*(unsigned short *)(&buffer5)); - + //read clipAdapterLeft char buffer6 [2]; in.read(buffer6, 2); @@ -989,7 +1005,7 @@ int SffInfoCommand::readSeqData(ifstream& in, seqRead& read, int numFlowReads, H char * mybuffer; mybuffer = new char [spot-startSpotInFile]; ifstream in2; - m->openInputFile(currentFileName, in2); + in2.open(currentFileName.c_str(), ios::binary); in2.seekg(startSpotInFile); in2.read(mybuffer,spot-startSpotInFile); in2.close(); @@ -999,7 +1015,7 @@ int SffInfoCommand::readSeqData(ifstream& in, seqRead& read, int numFlowReads, H if(trashCodeLength == 0){ ofstream out; - m->openOutputFileAppend(filehandles[barcodeIndex][primerIndex], out); + m->openOutputFileBinaryAppend(filehandles[barcodeIndex][primerIndex], out); out.write(mybuffer, in2.gcount()); out.close(); delete[] mybuffer; @@ -1007,7 +1023,7 @@ int SffInfoCommand::readSeqData(ifstream& in, seqRead& read, int numFlowReads, H } else{ ofstream out; - m->openOutputFileAppend(noMatchFile, out); + m->openOutputFileBinaryAppend(noMatchFile, out); out.write(mybuffer, in2.gcount()); out.close(); delete[] mybuffer; @@ -1343,7 +1359,10 @@ int SffInfoCommand::printFlowSeqData(ofstream& out, seqRead& read, Header& heade try { int endValue = header.clipQualRight; - if (header.clipQualRight == 0) { endValue = read.flowIndex.size(); } + if (header.clipQualRight == 0) { + endValue = read.flowIndex.size(); + if (m->debug) { m->mothurOut("[DEBUG]: " + header.name + " has clipQualRight=0.\n"); } + } if(endValue > header.clipQualLeft){ int rightIndex = 0;