| 268 | } |
| 269 | |
| 270 | void GenomeCopyNumber::fillMyHash(std::string const& mateFileName ,std::string const& inputFormat_str, std::string const& matesOrientation_str, int windowSize , int step, std::string targetBed) { |
| 271 | //read mateFileName and calculate copyNumber |
| 272 | long count = 0; |
| 273 | long normalCount = 0; |
| 274 | int bin = 0; |
| 275 | |
| 276 | cout << "..[genomecopynumber] Starting reading "<< mateFileName << "\n"; |
| 277 | //if (mateFileName.substr(mateFileName.size()-1,3).compare(".gz")==0) { |
| 278 | // igzstream in( mateFileName ); |
| 279 | // if ( ! in.good()) { |
| 280 | // std::cerr << "ERROR: Opening file `" << mateFileName << "' failed.\n"; |
| 281 | // return EXIT_FAILURE; |
| 282 | // } |
| 283 | // in.close(); |
| 284 | //} |
| 285 | std::ifstream fileMates (mateFileName.c_str()); |
| 286 | vector<float> insertSizeVector; |
| 287 | windowSize_ = windowSize; |
| 288 | step_=step; |
| 289 | string line; |
| 290 | if (!fileMates.is_open()) { |
| 291 | cerr << "Error: unable to open "+mateFileName+"\n" ; |
| 292 | exit(-1); |
| 293 | } |
| 294 | |
| 295 | #ifdef PROFILE_TRACE |
| 296 | time_t t0 = time(NULL); |
| 297 | #endif |
| 298 | |
| 299 | MateOrientation matesOrientation = getMateOrientation(matesOrientation_str); |
| 300 | |
| 301 | InputFormat inputFormat; |
| 302 | char* line_buffer; |
| 303 | if (inputFormat_str.compare("bam")==0 || inputFormat_str.compare("BAM")==0 || mateFileName.substr(mateFileName.size()-4,4).compare(".bam")==0 || mateFileName.substr(mateFileName.size()-3,3).compare(".gz")==0) { |
| 304 | |
| 305 | fileMates.close(); |
| 306 | |
| 307 | FILE *stream; |
| 308 | char buffer[MAX_BUFFER]; |
| 309 | string command; |
| 310 | |
| 311 | string myInputFormat=inputFormat_str; |
| 312 | if (mateFileName.substr(mateFileName.size()-3,3).compare(".gz")!=0) { |
| 313 | if (mateFileName.substr(mateFileName.size()-4,4).compare(".bam")==0) { |
| 314 | if (pathToSambamba_ != "") |
| 315 | { |
| 316 | command = pathToSambamba_ + " view -t " + SambambaThreads_ + " " + mateFileName; |
| 317 | myInputFormat="sam"; //will try to use existing sambamba |
| 318 | //cout << "..sambamba should be installed to be able to read BAM files; will use the following command for sambamba: "<<pathToSambamba_ + " view -t " + SambambaThreads_ + " " + mateFileName << "\n"; |
| 319 | cout << "..sambamba should be installed to be able to read BAM files; will use the following command for sambamba: "<< command << "\n"; |
| 320 | } |
| 321 | else |
| 322 | { |
| 323 | command = pathToSamtools_ + " view -@ " + SambambaThreads_ + " " +mateFileName; |
| 324 | myInputFormat="sam"; //will try to use existing samtools |
| 325 | //cout << "..samtools should be installed to be able to read BAM files; will use the following command for samtools: "<<pathToSamtools_ + " view "+mateFileName<<"\n"; |
| 326 | cout << "..samtools should be installed to be able to read BAM files; will use the following command for samtools: "<< command <<"\n"; |
| 327 | } |
nothing calls this directly
no test coverage detected