changeset 1:91cb2603b56c draft

Added getFileSize from rgutils to remove bogus dependency
author fubar
date Mon, 03 Jun 2013 21:34:20 -0400
parents 42251cbdeeac
children 45cd27a2ad5c
files FastQC/rgFastQC.py
diffstat 1 files changed, 18 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/FastQC/rgFastQC.py	Mon Jun 03 20:30:24 2013 -0400
+++ b/FastQC/rgFastQC.py	Mon Jun 03 21:34:20 2013 -0400
@@ -24,7 +24,6 @@
 import optparse
 import shutil
 import tempfile
-from rgutils import getFileString
 import zipfile
 import gzip
 
@@ -37,7 +36,24 @@
         assert opts <> None
         self.opts = opts
         
-        
+    def getFileString(fpath, outpath):
+    	"""
+    	format a nice file size string
+    	"""
+    	size = ''
+    	fp = os.path.join(outpath, fpath)
+    	s = fpath
+    	if os.path.isfile(fp):
+            n = float(os.path.getsize(fp))
+            if n > 2**20:
+                size = ' (%1.1f MB)' % (n/2**20)
+            elif n > 2**10:
+                size = ' (%1.1f KB)' % (n/2**10)
+            elif n > 0:
+                size = ' (%d B)' % (int(n))
+        s = '%s %s' % (fpath, size)
+        return s
+
     def run_fastqc(self):
         """
         In batch mode fastqc behaves not very nicely - will write to a new folder in