Skip to content
Permalink
Browse files

check return code from bunzip2 and give .gz files directly as input t…

…o bwa
  • Loading branch information...
AlessioMilanese committed Mar 29, 2019
1 parent bb135c7 commit 0d1522951b0c7b84b231081b500dc1027cd535ed
Showing with 35 additions and 14 deletions.
  1. +18 −7 bin/runBWA.py
  2. +17 −7 bin/runBWA_for_snv.py
@@ -62,13 +62,14 @@ def runBWA_singleEnd(strFilteredReadFile, reference, msamPercID, msamminLength,
threadsFlag = " -t 1"

zippedInput = False
if (strFilteredReadFile.endswith(".gz")):
unzipCMD = "gunzip -c " + strFilteredReadFile
zippedInput = True
if not(is_tool("gunzip")):
sys.stderr.write("[E::map_db] Error: gunzip is not installed. Cannot unzip the files\n")
sys.exit(1)
elif (strFilteredReadFile.endswith(".bz2")):
# bwa can handle .gz files
#if (strFilteredReadFile.endswith(".gz")):
# unzipCMD = "gunzip -c " + strFilteredReadFile
# zippedInput = True
# if not(is_tool("gunzip")):
# sys.stderr.write("[E::map_db] Error: gunzip is not installed. Cannot unzip the files\n")
# sys.exit(1)
if (strFilteredReadFile.endswith(".bz2")):
unzipCMD = "bunzip2 -c " + strFilteredReadFile
zippedInput = True
if not(is_tool("bunzip2")):
@@ -144,6 +145,16 @@ def runBWA_singleEnd(strFilteredReadFile, reference, msamPercID, msamminLength,
if flag1 and flag2 and flag3:
yield line

#check that bzip finished correctly
if (zippedInput):
unzip_cmd.stdout.close()
return_code = unzip_cmd.wait()
if return_code:
sys.stderr.write("[E::map_db] Error. bunzip2 failed\n")
sys.exit(1)


# chack that bwa finished correctly
bwa_cmd.stdout.close()
return_code = bwa_cmd.wait()
if return_code:
@@ -62,13 +62,14 @@ def runBWA_singleEnd(strFilteredReadFile, reference, msamPercID, msamminLength,
threadsFlag = " -t 1"

zippedInput = False
if (strFilteredReadFile.endswith(".gz")):
unzipCMD = "gunzip -c " + strFilteredReadFile
zippedInput = True
if not(is_tool("gunzip")):
sys.stderr.write("[E::map_db] Error: gunzip is not installed. Cannot unzip the files\n")
sys.exit(1)
elif (strFilteredReadFile.endswith(".bz2")):
# bwa can handle .gz files
#if (strFilteredReadFile.endswith(".gz")):
# unzipCMD = "gunzip -c " + strFilteredReadFile
# zippedInput = True
# if not(is_tool("gunzip")):
# sys.stderr.write("[E::map_db] Error: gunzip is not installed. Cannot unzip the files\n")
# sys.exit(1)
if (strFilteredReadFile.endswith(".bz2")):
unzipCMD = "bunzip2 -c " + strFilteredReadFile
zippedInput = True
if not(is_tool("bunzip2")):
@@ -164,6 +165,15 @@ def runBWA_singleEnd(strFilteredReadFile, reference, msamPercID, msamminLength,
if flag1 and flag2 and flag3:
yield line

#check that bzip finished correctly
if (zippedInput):
unzip_cmd.stdout.close()
return_code = unzip_cmd.wait()
if return_code:
sys.stderr.write("[E::map_db] Error. bunzip2 failed\n")
sys.exit(1)

# chack that bwa finished correctly
bwa_cmd.stdout.close()
return_code = bwa_cmd.wait()
if return_code:

0 comments on commit 0d15229

Please sign in to comment.
You can’t perform that action at this time.