Skip to content

Commit

Permalink
Merge pull request #19 from Hammarn/master
Browse files Browse the repository at this point in the history
Static order of Biotype plot
  • Loading branch information
ewels authored Nov 25, 2016
2 parents 80e3ac2 + 7024a66 commit ed786ff
Showing 1 changed file with 11 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ def __init__(self):

# Assignment bar plot
# Only one section, so add to the intro
self.intro += self.featureCounts_biotypes_chart()
self.intro +=self.featureCounts_biotypes_chart()


def parse_featurecounts_report (self, f):
Expand Down Expand Up @@ -100,22 +100,27 @@ def featurecounts_biotypes_stats_table(self):

def featureCounts_biotypes_chart (self):
""" Make the featureCounts assignment rates plot """

# Order keys by count in first dataset
#Order keys the same everytime
keys = OrderedDict()
fixedorder = ['protein_coding','rRNA','miRNA', 'antisense', 'misc_RNA', 'pseudogene', 'processed_transcript',
'processed_transcript', 'processed_pseudogene', 'sense_intronic', 'sense_overlapping',
'lincRNA', 'snoRNA', 'snRNA']
for d in self.featurecounts_biotype_data.values():
for j in fixedorder:
if j in d and j not in keys.keys():
keys[j] = {'name': j.replace('_', ' ') }
# Order remaining keys by count in first dataset
for k in sorted(d, key=d.get, reverse=True):
if k == 'percent_rRNA':
continue
keys[k] = {'name': k.replace('_', ' ') }
break

# Config for the plot
pconfig = {
'id': 'featureCounts_biotype_plot',
'title': 'featureCounts Biotypes',
'ylab': '# Reads',
'cpswitch_counts_label': 'Number of Reads'
}

return plots.bargraph.plot(self.featurecounts_biotype_data, keys, pconfig)
return plots.bargraph.plot(self.featurecounts_biotype_data, keys, pconfig)

0 comments on commit ed786ff

Please sign in to comment.