MCPcopy Create free account
hub / github.com/Illumina/hap.py / runShellCommand

Function runShellCommand

src/python/Tools/bcftools.py:27–54  ·  view source on GitHub ↗

Run a shell command (e.g. bcf tools), and return output

(*args)

Source from the content-addressed store, hash-verified

25
26
27def runShellCommand(*args):
28 """ Run a shell command (e.g. bcf tools), and return output
29 """
30 qargs = []
31 for a in args:
32 if a.strip() != "|":
33 qargs.append(pipes.quote(a))
34 else:
35 qargs.append("|")
36
37 cmd_line = " ".join(qargs)
38 logging.info(cmd_line)
39
40 po = subprocess.Popen(cmd_line,
41 shell=True,
42 stdout=subprocess.PIPE,
43 stderr=subprocess.PIPE)
44
45 stdout, stderr = po.communicate()
46
47 po.wait()
48
49 return_code = po.returncode
50
51 if return_code != 0:
52 raise Exception("Command line {} got return code {}.\nSTDOUT: {}\nSTDERR: {}".format(cmd_line, return_code, stdout, stderr))
53
54 return stdout
55
56
57def runBcftools(*args):

Callers 2

runBcftoolsFunction · 0.85
preprocessVCFFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected