Open the BEDGRAPH file
| 27 | |
| 28 | // Open the BEDGRAPH file |
| 29 | void BedGraphFile::Open() { |
| 30 | if (bedGraphFile == "stdin" || bedGraphFile == "-") { |
| 31 | _bedGraphStream = &cin; |
| 32 | } |
| 33 | else { |
| 34 | _bedGraphStream = new ifstream(bedGraphFile.c_str(), ios::in); |
| 35 | |
| 36 | if (isGzipFile(_bedGraphStream) == true) { |
| 37 | delete _bedGraphStream; |
| 38 | _bedGraphStream = new igzstream(bedGraphFile.c_str(), ios::in); |
| 39 | } |
| 40 | // can we open the file? |
| 41 | if ( _bedGraphStream->fail() ) { |
| 42 | cerr << "Error: The requested file (" |
| 43 | << bedGraphFile |
| 44 | << ") " |
| 45 | << "could not be opened. " |
| 46 | << "Error message: (" |
| 47 | << strerror(errno) |
| 48 | << "). Exiting!" << endl; |
| 49 | exit (1); |
| 50 | } |
| 51 | } |
| 52 | } |
| 53 | |
| 54 | |
| 55 | // Close the BEDGRAPH file |
nothing calls this directly
no test coverage detected