Mercurial > repos > fubar > fastqc_320
comparison FastQC/rgFastQC.py @ 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 |
comparison
equal
deleted
inserted
replaced
| 0:42251cbdeeac | 1:91cb2603b56c |
|---|---|
| 22 import sys | 22 import sys |
| 23 import subprocess | 23 import subprocess |
| 24 import optparse | 24 import optparse |
| 25 import shutil | 25 import shutil |
| 26 import tempfile | 26 import tempfile |
| 27 from rgutils import getFileString | |
| 28 import zipfile | 27 import zipfile |
| 29 import gzip | 28 import gzip |
| 30 | 29 |
| 31 class FastQC(): | 30 class FastQC(): |
| 32 """wrapper | 31 """wrapper |
| 35 | 34 |
| 36 def __init__(self,opts=None): | 35 def __init__(self,opts=None): |
| 37 assert opts <> None | 36 assert opts <> None |
| 38 self.opts = opts | 37 self.opts = opts |
| 39 | 38 |
| 40 | 39 def getFileString(fpath, outpath): |
| 40 """ | |
| 41 format a nice file size string | |
| 42 """ | |
| 43 size = '' | |
| 44 fp = os.path.join(outpath, fpath) | |
| 45 s = fpath | |
| 46 if os.path.isfile(fp): | |
| 47 n = float(os.path.getsize(fp)) | |
| 48 if n > 2**20: | |
| 49 size = ' (%1.1f MB)' % (n/2**20) | |
| 50 elif n > 2**10: | |
| 51 size = ' (%1.1f KB)' % (n/2**10) | |
| 52 elif n > 0: | |
| 53 size = ' (%d B)' % (int(n)) | |
| 54 s = '%s %s' % (fpath, size) | |
| 55 return s | |
| 56 | |
| 41 def run_fastqc(self): | 57 def run_fastqc(self): |
| 42 """ | 58 """ |
| 43 In batch mode fastqc behaves not very nicely - will write to a new folder in | 59 In batch mode fastqc behaves not very nicely - will write to a new folder in |
| 44 the same place as the infile called [infilebasename]_fastqc | 60 the same place as the infile called [infilebasename]_fastqc |
| 45 rlazarus@omics:/data/galaxy/test$ ls FC041_1_sequence_fastqc | 61 rlazarus@omics:/data/galaxy/test$ ls FC041_1_sequence_fastqc |
