| 292 | } |
| 293 | |
| 294 | std::string BAFpileup::createPileUpFile(std::string outputDir, std::string samtools_path, std::string pathToSambamba,std::string SambambaThreads , std::string control_MateFile, std::string intersected, std::string fastaFile, int minQualPerPos) |
| 295 | { |
| 296 | string minipileup = outputDir + "_minipileup" +".pileup"; |
| 297 | FILE *stream; |
| 298 | |
| 299 | string command; |
| 300 | if (pathToSambamba != "") { |
| 301 | string samtools_arg = "--samtools -f " +fastaFile+ " -d 8000 -Q "+int2string(minQualPerPos)+ " -q 1 -l " + intersected; |
| 302 | command = pathToSambamba + " mpileup -t " + SambambaThreads + " -o " + minipileup + " " + control_MateFile + " " + samtools_arg ; |
| 303 | } else { |
| 304 | command = samtools_path + " mpileup -f "+fastaFile+" -d 8000 -Q "+int2string(minQualPerPos)+" -q 1 -l " + intersected + " " + control_MateFile + " > " + minipileup; //discard reads wit 0 mapping quality |
| 305 | } |
| 306 | |
| 307 | stream = |
| 308 | #if defined(_WIN32) |
| 309 | _popen(command.c_str(), "w"); |
| 310 | #else |
| 311 | popen(command.c_str(), "w"); |
| 312 | #endif |
| 313 | |
| 314 | #if defined(_WIN32) |
| 315 | _pclose(stream); |
| 316 | #else |
| 317 | pclose(stream); |
| 318 | #endif |
| 319 | cout << "..If you have got an error at this step and a mini-pileup file is empty, check that you are using samtools v1.1 or later and provide a corresponding path in your config file"<<endl; |
| 320 | return minipileup; |
| 321 | } |
| 322 | |
| 323 | /* |
| 324 | std::vector < std::vector<float> >BAFpileup::computeBAF(GenomeCopyNumber & sampleorcontrol, std::string minipileup, std::string outputDir, std::string filename) |
nothing calls this directly
no test coverage detected