Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use standard process and exponential functions on OS X #10

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions src/BAFpileup.cpp
Original file line number Diff line number Diff line change
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 @@ -251,13 +251,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 @@ -301,13 +301,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
Original file line number Diff line number Diff line change
Expand Up @@ -320,7 +320,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 @@ -330,7 +330,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
Original file line number Diff line number Diff line change
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
16 changes: 8 additions & 8 deletions src/myFunc.cpp
Original file line number Diff line number Diff line change
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 Expand Up @@ -2496,7 +2496,7 @@ void myReplace(std::string& str, const std::string& oldStr, const std::string& n
}


#if defined(_WIN32) || (defined(__APPLE__) && defined(__MACH__))
#if defined(_WIN32)
double expm1(double x) {
if (fabs(x) < 1e-5)
return x + 0.5*x*x;
Expand Down