changeset 4:dfa2e75da6aa draft

fixed script typo
author nick
date Thu, 30 May 2013 15:41:27 -0400
parents e9c34ef993d6
children d38113d9c4d6
files hetbox.py
diffstat 1 files changed, 7 insertions(+), 11 deletions(-) [+]
line wrap: on
line diff
--- a/hetbox.py	Wed May 29 11:25:22 2013 -0400
+++ b/hetbox.py	Thu May 30 15:41:27 2013 -0400
@@ -1,7 +1,7 @@
 #!/usr/bin/env python
 # New in this version:
-# - handle commented-out header lines
-# - did everything through the Rpy2 interface instead of inline R code
+# - option to generate report is triggered simply by including report filename
+#   as third argument
 
 import os,sys,numpy
 from rpy2.robjects import Formula
@@ -13,10 +13,6 @@
   sys.exit(1)
 
 args = sys.argv[1:]
-if '-r' in args:
-  make_report = True
-else:
-  make_report = False
 if len(args) >= 1:
   infile = args[0]
 else:
@@ -27,8 +23,8 @@
   fail('Error: No output filename provided (as argument 2).')
 if len(args) >= 3:
   report = args[2]
-elif make_report:
-  fail('Error: No output report filename provided (as argument 3).')
+else:
+  report = ''
 
 # Check input file
 if not os.path.exists(infile):
@@ -89,7 +85,7 @@
 graphics.axis(1, at=range(1, len(graphlabels)+1, 1), labels=graphlabels, **kwargs3)
 grdevices.dev_off()
 
-if not make_report:
+if not report:
   sys.exit(0)
 
 
@@ -106,8 +102,8 @@
 ###################################
 
 SAMPLES=[]
-for i in range(len(tab)):
-    SAMPLES.append(base.names(tab)[i])
+for i in range(len(table)):
+    SAMPLES.append(base.names(table)[i])
 
 def boxstats(data,sample):
     VALUES = [100*float(x.strip().split('\t')[11]) for x in list(open(data)) if x.strip().split('\t')[0]==sample]