1 Mar 2012 02:40
[Biopython] samtools does not return correct exit code
Mic <mictadlo <at> gmail.com>
2012-03-01 01:40:02 GMT
2012-03-01 01:40:02 GMT
Hallo,
Samtools does not return correct the exit code:
import subprocess
import logging
import sys
def run_cmd(args):
if subprocess.call(args,shell=True) != 0:
print 'hello'
logging.error("Error copying sequence file args='%s'" %
str(args))
return 1
print 'e', sys.stderr
print 'o', sys.stdout
return 0
def runSamtools( cmd ):
'''run a samtools command'''
try:
retcode = subprocess.call(cmd, shell=True)
print retcode
if retcode < 0:
print >>sys.stderr, "Child was terminated by signal", -retcode
except OSError, e:
print >>sys.stderr, "Execution failed:", e
print run_cmd("samtools faidx ex1.fa")
print runSamtools("samtools faidx ex1.fa")
(Continue reading)
RSS Feed