Skip to content

Commit

Permalink
Better support for MAC
Browse files Browse the repository at this point in the history
  • Loading branch information
valeu committed Dec 21, 2016
1 parent 4d3e3f5 commit b39300f
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 19 deletions.
12 changes: 6 additions & 6 deletions src/BAFpileup.cpp
Expand Up @@ -98,7 +98,7 @@ float BAFpileup::calculateFlankLength(std::string const& mateFileName, std::stri
command = "gzip -c -d "+mateFileName;
}
stream =
#if defined(_WIN32) || (defined(__APPLE__) && defined(__MACH__))
#if defined(_WIN32)
_popen(command.c_str(), "r");
#else
popen(command.c_str(), "r");
Expand Down Expand Up @@ -143,7 +143,7 @@ float BAFpileup::calculateFlankLength(std::string const& mateFileName, std::stri
fragmentLength = fragmentLength/j;
float flanks = fragmentLength/2;
if (zgOrbam) {
#if defined(_WIN32) || (defined(__APPLE__) && defined(__MACH__))
#if defined(_WIN32)
_pclose(stream);
#else
pclose(stream);
Expand Down Expand Up @@ -254,13 +254,13 @@ std::string BAFpileup::intersectWithBedtools(std::string makeminipileup, std::st
string command = pathToBedtools_ +" intersect -a " + makeminipileup + " -b " + bedFileWithRegionsOfInterest + " > " + intersected;

stream =
#if defined(_WIN32) || (defined(__APPLE__) && defined(__MACH__))
#if defined(_WIN32)
_popen(command.c_str(), "w");
#else
popen(command.c_str(), "w");
#endif

#if defined(_WIN32) || (defined(__APPLE__) && defined(__MACH__))
#if defined(_WIN32)
_pclose(stream);
#else
pclose(stream);
Expand Down Expand Up @@ -305,13 +305,13 @@ std::string BAFpileup::createPileUpFile(std::string outputDir, std::string samto
}

stream =
#if defined(_WIN32) || (defined(__APPLE__) && defined(__MACH__))
#if defined(_WIN32)
_popen(command.c_str(), "w");
#else
popen(command.c_str(), "w");
#endif

#if defined(_WIN32) || (defined(__APPLE__) && defined(__MACH__))
#if defined(_WIN32)
_pclose(stream);
#else
pclose(stream);
Expand Down
4 changes: 2 additions & 2 deletions src/GenomeCopyNumber.cpp
Expand Up @@ -329,7 +329,7 @@ void GenomeCopyNumber::fillMyHash(std::string const& mateFileName ,std::string c

inputFormat = getInputFormat(myInputFormat);
stream =
#if defined(_WIN32) || (defined(__APPLE__) && defined(__MACH__))
#if defined(_WIN32)
_popen(command.c_str(), "r");
#else
popen(command.c_str(), "r");
Expand All @@ -339,7 +339,7 @@ void GenomeCopyNumber::fillMyHash(std::string const& mateFileName ,std::string c
count++;
normalCount+=processRead(inputFormat,matesOrientation,line_buffer, bin,targetBed, mateFileName);
}
#if defined(_WIN32) || (defined(__APPLE__) && defined(__MACH__))
#if defined(_WIN32)
_pclose(stream);
#else
pclose(stream);
Expand Down
8 changes: 4 additions & 4 deletions src/SNPinGenome.cpp
Expand Up @@ -118,7 +118,7 @@ void SNPinGenome::readSNPs(std::string const& inFile)
char buffer[MAX_BUFFER];
string command = "gzip -cd "+inFile;
stream =
#if defined(_WIN32) || (defined(__APPLE__) && defined(__MACH__))
#if defined(_WIN32)
_popen(command.c_str(), "r");
#else
popen(command.c_str(), "r");
Expand All @@ -128,7 +128,7 @@ void SNPinGenome::readSNPs(std::string const& inFile)
if (line_buffer[0] == '#') continue;
count+=processSNPLine(ifVCF,line_buffer,myChr,index,previousPos);
}
#if defined(_WIN32) || (defined(__APPLE__) && defined(__MACH__))
#if defined(_WIN32)
_pclose(stream);
#else
pclose(stream);
Expand Down Expand Up @@ -389,14 +389,14 @@ void SNPinGenome::assignValues(std::string const& inFile, string inputFormat, in
if (inFile.substr(inFile.size()-3,3).compare(".gz")==0) {
string command = "gzip -cd "+inFile;
FILE* stream =
#if defined(_WIN32) || (defined(__APPLE__) && defined(__MACH__))
#if defined(_WIN32)
_popen(command.c_str(), "r");
#else
popen(command.c_str(), "r");
#endif
readPileUP(stream, minimalTotalLetterCountPerPosition, minimalQualityPerPosition, p_genomeCopyNumber);

#if defined(_WIN32) || (defined(__APPLE__) && defined(__MACH__))
#if defined(_WIN32)
_pclose(stream);
#else
pclose(stream);
Expand Down
Binary file modified src/freec
Binary file not shown.
14 changes: 7 additions & 7 deletions src/myFunc.cpp
Expand Up @@ -277,15 +277,15 @@ long getLineNumber(std::string const& fileName, const std::string& pathToSamtool
if (fileName.substr(fileName.size()-3,3).compare(".gz")==0) {
string command = "gzip -cd "+fileName;
stream =
#if defined(_WIN32) || (defined(__APPLE__) && defined(__MACH__))
#if defined(_WIN32)
_popen(command.c_str(), "r");
#else
popen(command.c_str(), "r");
#endif
while ( fgets(buffer, MAX_BUFFER, stream) != NULL ) {
count++;
}
#if defined(_WIN32) || (defined(__APPLE__) && defined(__MACH__))
#if defined(_WIN32)
_pclose(stream);
#else
pclose(stream);
Expand All @@ -305,7 +305,7 @@ long getLineNumber(std::string const& fileName, const std::string& pathToSamtool
cout << "..samtools should be installed to be able to read BAM files\n";
}
stream =
#if defined(_WIN32) || (defined(__APPLE__) && defined(__MACH__))
#if defined(_WIN32)
_popen(command.c_str(), "r");
#else
popen(command.c_str(), "r");
Expand All @@ -314,7 +314,7 @@ long getLineNumber(std::string const& fileName, const std::string& pathToSamtool
while ( fgets(buffer, MAX_BUFFER, stream) != NULL ) {
count++;
}
#if defined(_WIN32) || (defined(__APPLE__) && defined(__MACH__))
#if defined(_WIN32)
_pclose(stream);
#else
pclose(stream);
Expand Down Expand Up @@ -353,7 +353,7 @@ long getReadNumberFromPileup(std::string const& fileName) {
char buffer[MAX_BUFFER];
string command = "gzip -cd "+fileName;
stream =
#if defined(_WIN32) || (defined(__APPLE__) && defined(__MACH__))
#if defined(_WIN32)
_popen(command.c_str(), "r");
#else
popen(command.c_str(), "r");
Expand All @@ -373,7 +373,7 @@ long getReadNumberFromPileup(std::string const& fileName) {
}
strs.clear();
}
#if defined(_WIN32) || (defined(__APPLE__) && defined(__MACH__))
#if defined(_WIN32)
_pclose(stream);
#else
pclose(stream);
Expand Down Expand Up @@ -1224,7 +1224,7 @@ string pathAppend(const string& p1, const string& p2) {
char sep = '/';
string tmp = p1;
char sep2=sep;
#if defined(_WIN32) || (defined(__APPLE__) && defined(__MACH__))
#if defined(_WIN32)
sep2 = '\\';
#endif
char lastSymb= p1[p1.length( )-1];
Expand Down

0 comments on commit b39300f

Please sign in to comment.