# Remove low tag counts #refseq = refseq[refseq['transcript_score'] >= 4] sets.append(refseq) if True: genes = ['Coro1a', 'Vcl', 'Tlr2', 'Clec4e', 'Cxcl2'] vals = [] labels = [] for gene in genes: vals.append(sets[0][sets[0]['gene_names'] == gene] ['balb_nod_notx_1h_fc'].values[0]) vals.append(sets[1][sets[1]['gene_names'] == '{' + gene + '}']['balb_nod_notx_0h_fc'].values[0]) labels.append('ThioMac\n' + gene) labels.append('BMDC\n' + gene) # Convert to FC from log vals = [2**val for val in vals] yzer.bargraph_for_transcripts( vals, None, None, bar_names=labels, title='NOD vs. BALBc NOTX GRO-seq: ThioMac and BMDC', ylabel='Fold Change in NOD vs. BALBc', show_plot=True, save_dir=img_dirpath)
#'srf_targets': ['Srf','Cnn2','Lima1','Coro1a','Vcl','Acta2','Actb','Dhcr24','Actg2','Actc1','Lcp1','Jup','Tpm4','Tnni2','Zyx','Tubb3','Pfn1','Gas7','Arpc4','Pstpip1','Bsn','Flna','Actn1'], #'inflammatory_genes': ['Cxcl1','Cxcl2','Il6','Ptgs2','Tnfsf9','Vegfa','Tnf', 'Siglec1','Mmp9', 'Il10','Il1b','Cxcl10','Tlr4','Il12b',] } ''' 'clec4e_tlr2': ['Clec4e','Tlr2',], , ''' for i, genes in gene_groups.items(): for gene in genes[:]: if not gene in refseq['gene_names'].values: print gene genes.remove(gene) indices = [refseq[refseq['gene_names'] == gene].index[0] for gene in genes] for txt in ('notx','kla'): sorted_by_count = refseq.fillna(0).sort_index(axis=0, by='balb_{0}_1h_reads_per_base'.format(txt)).index.copy() sort_indexes = list(enumerate(sorted_by_count)) sort_indexes.sort(key=lambda x: x[1]) refseq['rank'] = zip(*sort_indexes)[0] yzer.bargraph_for_transcripts(refseq, indices, ['balb_nod_{0}_1h_fc'.format(txt)], bar_names=genes, title='NOD vs. BALBc {0} 1h GRO-seq'.format(txt=='kla' and txt.upper() or txt.capitalize()), ylabel='Fold Change in NOD vs. BALBc', rank_label='Rank of read per base pair value\nin BALBc {0} 1h, ascending'.format( txt=='kla' and txt.upper() or txt.capitalize()), show_plot=False) yzer.save_plot(yzer.get_filename(img_dirpath, 'balbc_nod_{0}_{1}_fold_change_bargraph.png'.format(txt,i))) #yzer.show_plot()