Skip to content

Commit

Permalink
star-fusion
Browse files Browse the repository at this point in the history
  • Loading branch information
arnald-alonso committed Dec 4, 2016
1 parent 91999a1 commit f36918c
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions lib/spider_stats.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,8 @@ def stats_trimgalore(path):
f.close()
out = open(path + "/outputs/stats_trim.txt", 'w')
print >> out, "sample_id\t" + "\t".join(fnames2)
out2 = open(path + "/outputs/stats_trim_plot.txt", 'w')
print >> out2, "sample_id\tReads with adapters\tReads passing filters\tQuality-trimmed basepairs\tBasepairs passing filters"
for sample, files in samples.iteritems():
k = 0
data = [{},{}]
Expand All @@ -91,6 +93,8 @@ def stats_trimgalore(path):
k += 1
g1 = ""
g2 = ""
plt1 = ''
plt2 = ''
for i in fields2:
r1 = "NA"
r2 = "NA"
Expand All @@ -101,13 +105,21 @@ def stats_trimgalore(path):
r2 = data[1][i]
g1 = g1 + "\t" + r1
g2 = g2 + "\t" + r2
if '%' in r2:
plt1 = plt2 + "\t" + r2.split(' ')[1].replace('(', '').replace('%)', '')
plt2 = plt2 + "\t" + r2.split(' ')[1].replace('(', '').replace('%)', '')
else:
if '%' in r1:
plt1 = plt1 + "\t" + r1.split(' ')[1].replace('(', '').replace('%)', '')
g1 = g1 + "\t" + r1
if g2 != '':
print >> out, sample + ' (1)' + g1
print >> out, sample + ' (2)' + g2
print >> out2, sample + ' (1)' + plt1
print >> out2, sample + ' (2)' + plt2
else:
print >> out, sample + g1
print >> out2, sample + plt1
out.close()


Expand Down

0 comments on commit f36918c

Please sign in to comment.