comparison FastQC/rgFastQC.py @ 3:71899f689406 draft

Uploaded
author fubar
date Tue, 04 Jun 2013 00:12:12 -0400
parents 57f890a5fa73
children 4d6d32306a4a
comparison
equal deleted inserted replaced
2:9995fd1f8daa 3:71899f689406
35 def __init__(self,opts=None): 35 def __init__(self,opts=None):
36 assert opts <> None 36 assert opts <> None
37 self.opts = opts 37 self.opts = opts
38 38
39 def getFileString(fpath, outpath): 39 def getFileString(fpath, outpath):
40 """ 40 """
41 format a nice file size string 41 format a nice file size string
42 """ 42 """
43 size = '' 43 size = ''
44 fp = os.path.join(outpath, fpath) 44 fp = os.path.join(outpath, fpath)
45 s = fpath 45 s = fpath
46 if os.path.isfile(fp): 46 if os.path.isfile(fp):
47 n = float(os.path.getsize(fp)) 47 n = float(os.path.getsize(fp))
48 if n > 2**20: 48 if n > 2**20:
49 size = ' (%1.1f MB)' % (n/2**20) 49 size = ' (%1.1f MB)' % (n/2**20)
50 elif n > 2**10: 50 elif n > 2**10:
51 size = ' (%1.1f KB)' % (n/2**10) 51 size = ' (%1.1f KB)' % (n/2**10)
158 res = ['<div class="module"><h2>Files created by FastQC</h2><table cellspacing="2" cellpadding="2">\n'] 158 res = ['<div class="module"><h2>Files created by FastQC</h2><table cellspacing="2" cellpadding="2">\n']
159 flist.sort() 159 flist.sort()
160 for i,f in enumerate(flist): 160 for i,f in enumerate(flist):
161 if not(os.path.isdir(f)): 161 if not(os.path.isdir(f)):
162 fn = os.path.split(f)[-1] 162 fn = os.path.split(f)[-1]
163 res.append('<tr><td><a href="%s">%s</a></td></tr>\n' % (fn,getFileString(fn, self.opts.outputdir))) 163 res.append('<tr><td><a href="%s">%s</a></td></tr>\n' % (fn,self.getFileString(fn, self.opts.outputdir)))
164 res.append('</table>\n') 164 res.append('</table>\n')
165 res.append('<a href="http://www.bioinformatics.bbsrc.ac.uk/projects/fastqc/">FastQC documentation and full attribution is here</a><br/><hr/>\n') 165 res.append('<a href="http://www.bioinformatics.bbsrc.ac.uk/projects/fastqc/">FastQC documentation and full attribution is here</a><br/><hr/>\n')
166 res.append('FastQC was run by Galaxy using the rgenetics rgFastQC wrapper - see http://rgenetics.org for details and licensing\n</div>') 166 res.append('FastQC was run by Galaxy using the rgenetics rgFastQC wrapper - see http://rgenetics.org for details and licensing\n</div>')
167 res.append(footer) 167 res.append(footer)
168 fixed = rep[:bodyindex] + res + rep[bodyindex:] 168 fixed = rep[:bodyindex] + res + rep[bodyindex:]