Skip to content
Snippets Groups Projects
Commit d6548970 authored by Aaron's avatar Aaron
Browse files

Need to rewind to start of file after Gzip check.

parent 4a87714b
No related branches found
No related tags found
No related merge requests found
...@@ -286,7 +286,7 @@ string FastaReference::sequenceNameStartingWith(string seqnameStart) { ...@@ -286,7 +286,7 @@ string FastaReference::sequenceNameStartingWith(string seqnameStart) {
} }
} }
string FastaReference::getSubSequence(const string &seqname, int start, int length) { string FastaReference::getSubSequence(string seqname, int start, int length) {
FastaIndexEntry entry = index->entry(seqname); FastaIndexEntry entry = index->entry(seqname);
if (start < 0 || length < 1) { if (start < 0 || length < 1) {
cerr << "Error: cannot construct subsequence with negative offset or length < 1" << endl; cerr << "Error: cannot construct subsequence with negative offset or length < 1" << endl;
...@@ -318,7 +318,7 @@ string FastaReference::getSubSequence(const string &seqname, int start, int leng ...@@ -318,7 +318,7 @@ string FastaReference::getSubSequence(const string &seqname, int start, int leng
return s; return s;
} }
long unsigned int FastaReference::sequenceLength(const string &seqname) { long unsigned int FastaReference::sequenceLength(string seqname) {
FastaIndexEntry entry = index->entry(seqname); FastaIndexEntry entry = index->entry(seqname);
return entry.length; return entry.length;
} }
......
...@@ -70,9 +70,9 @@ class FastaReference { ...@@ -70,9 +70,9 @@ class FastaReference {
string getSequence(string seqname); string getSequence(string seqname);
// potentially useful for performance, investigate // potentially useful for performance, investigate
// void getSequence(string seqname, string& sequence); // void getSequence(string seqname, string& sequence);
string getSubSequence(const string &seqname, int start, int length); string getSubSequence(string seqname, int start, int length);
string sequenceNameStartingWith(string seqnameStart); string sequenceNameStartingWith(string seqnameStart);
long unsigned int sequenceLength(const string &seqname); long unsigned int sequenceLength(string seqname);
}; };
#endif #endif
...@@ -139,6 +139,9 @@ void BedFile::Open(void) { ...@@ -139,6 +139,9 @@ void BedFile::Open(void) {
delete _bedStream; delete _bedStream;
_bedStream = new igzstream(bedFile.c_str(), ios::in); _bedStream = new igzstream(bedFile.c_str(), ios::in);
} }
// bytes were consumed. rewind.
_bedStream->seekg(0);
// can we open the file? // can we open the file?
if ( !(_bedStream->good()) ) { if ( !(_bedStream->good()) ) {
cerr << "Error: The requested bed file (" << bedFile << ") could not be opened. Exiting!" << endl; cerr << "Error: The requested bed file (" << bedFile << ") could not be opened. Exiting!" << endl;
......
...@@ -35,6 +35,10 @@ void BedFilePE::Open(void) { ...@@ -35,6 +35,10 @@ void BedFilePE::Open(void) {
delete _bedStream; delete _bedStream;
_bedStream = new igzstream(bedFile.c_str(), ios::in); _bedStream = new igzstream(bedFile.c_str(), ios::in);
} }
// bytes were consumed. rewind.
_bedStream->seekg(0);
// can we open the file? // can we open the file?
if ( !(_bedStream->good()) ) { if ( !(_bedStream->good()) ) {
cerr << "Error: The requested bed file (" << bedFile << ") could not be opened. Exiting!" << endl; cerr << "Error: The requested bed file (" << bedFile << ") could not be opened. Exiting!" << endl;
......
...@@ -37,6 +37,10 @@ void BedGraphFile::Open() { ...@@ -37,6 +37,10 @@ void BedGraphFile::Open() {
delete _bedGraphStream; delete _bedGraphStream;
_bedGraphStream = new igzstream(bedGraphFile.c_str(), ios::in); _bedGraphStream = new igzstream(bedGraphFile.c_str(), ios::in);
} }
// bytes were consumed. rewind.
_bedGraphStream->seekg(0);
// can we open the file? // can we open the file?
if ( !(_bedGraphStream->good()) ) { if ( !(_bedGraphStream->good()) ) {
cerr << "Error: The requested bed file (" << bedGraphFile << ") could not be opened. Exiting!" << endl; cerr << "Error: The requested bed file (" << bedGraphFile << ") could not be opened. Exiting!" << endl;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment