-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrun_barplot.py
More file actions
38 lines (34 loc) · 1.23 KB
/
run_barplot.py
File metadata and controls
38 lines (34 loc) · 1.23 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
import argparse
import os
import re
import subprocess
parser = argparse.ArgumentParser()
parser.add_argument( "directory", help = "Target directory with CSV files." )
args = parser.parse_args()
def render_barplot( csvfile = None,
bmark = None,
title = None,
xlabel = None ):
outpdf = "types.pdf"
cmd = [ "/data/rveroy/bin/Rscript",
"./barplot.R",
csvfile, outpdf,
bmark, title, xlabel ]
print "Running barplot.R on %s -> %s" % (csvfile, outpdf)
rproc = subprocess.Popen( cmd,
stdout = subprocess.PIPE,
stdin = subprocess.PIPE,
stderr = subprocess.PIPE )
result = rproc.communicate()
return result
csvre = re.compile( "([a-z0-9_]+)-basic_cycle_analyze-.*\.csv" )
for item in os.listdir( args.directory ):
m = csvre.match(item)
if m:
bmark = m.group(1)
title = "%s types" % bmark
print "%s: %s" % (item, bmark)
result = render_barplot( csvfile = item,
bmark = bmark,
title = title,
xlabel = "type counts" )