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

Proper Gzip check

parent ec2ec9b2
No related branches found
No related tags found
No related merge requests found
......@@ -135,7 +135,7 @@ void BedFile::Open(void) {
else {
_bedStream = new ifstream(bedFile.c_str(), ios::in);
if(bedFile.substr(bedFile.find_last_of(".") + 1) == "gz") {
if( isGzipFile(_bedStream) ) {
delete _bedStream;
_bedStream = new igzstream(bedFile.c_str(), ios::in);
}
......
......@@ -35,10 +35,6 @@ void BedFilePE::Open(void) {
delete _bedStream;
_bedStream = new igzstream(bedFile.c_str(), ios::in);
}
// bytes were consumed. rewind.
_bedStream->seekg(0);
// can we open the file?
if ( !(_bedStream->good()) ) {
cerr << "Error: The requested bed file (" << bedFile << ") could not be opened. Exiting!" << endl;
......@@ -48,6 +44,7 @@ void BedFilePE::Open(void) {
}
// Close the BEDPE file
void BedFilePE::Close(void) {
if (bedFile != "stdin") delete _bedStream;
......
......@@ -37,10 +37,6 @@ void BedGraphFile::Open() {
delete _bedGraphStream;
_bedGraphStream = new igzstream(bedGraphFile.c_str(), ios::in);
}
// bytes were consumed. rewind.
_bedGraphStream->seekg(0);
// can we open the file?
if ( !(_bedGraphStream->good()) ) {
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