def test_plot_sums(self, test_insertions, test_exon_counts): """Exercises plotting of sums.""" result = test.test_de_exon(test_insertions, test_exon_counts, gene_id='ENSMUSG00000026510') result.plot_sums()
def plot_de(insertions, exon_counts, gene_id, gene_name=None, ax=None, box_kws=None, strip_kws=None, **kwargs): """Plots groupwise DE for a given gene.""" if gene_name is None: gene_name = gene_id result = test_de_exon(insertions, exon_counts, gene_id=gene_id, **kwargs) if result.p_value <= 0.05: if result.direction == 1: color = sns.color_palette('Set1')[2] # Green else: color = sns.color_palette('Set1')[3] # Purple else: color = 'lightgrey' ax = result.plot_boxplot(ax=ax, log=True, show_points=True, strip_kws=strip_kws or {}, box_kws=toolz.merge({'color': color}, box_kws or {})) pval_label = _format_pval(result.p_value) ax.set_title('{} ({})'.format(gene_name, pval_label), fontstyle='italic') return ax
def test_neg_example_nf1(self, test_insertions, test_exon_counts): """Tests negative example of DE in Nf1 in the SB dataset.""" result = test.test_de_exon( test_insertions, test_exon_counts, gene_id='ENSMUSG00000020716') assert result.p_value > 0.05 assert result.direction == 1
def test_pos_example_trp53bp2(self, test_insertions, test_exon_counts): """Tests positive example of DE in Trp53bp2 in the SB dataset.""" result = test.test_de_exon( test_insertions, test_exon_counts, gene_id='ENSMUSG00000026510') assert result.p_value < 0.01 assert result.direction == 1
def test_neg_example_nf1(self, test_insertions, test_exon_counts): """Tests negative example of DE in Nf1 in the SB dataset.""" result = test.test_de_exon(test_insertions, test_exon_counts, gene_id='ENSMUSG00000020716') assert result.p_value > 0.05 assert result.direction == 1
def test_pos_example_trp53bp2(self, test_insertions, test_exon_counts): """Tests positive example of DE in Trp53bp2 in the SB dataset.""" result = test.test_de_exon(test_insertions, test_exon_counts, gene_id='ENSMUSG00000026510') assert result.p_value < 0.01 assert result.direction == 1
def test_pos_example_trp53bp2_df(self, test_insertions, test_exon_counts): """Tests positive example of DE in Trp53bp2 with dataframe input.""" test_insertion_df = Insertion.to_frame(test_insertions) result = test.test_de_exon( test_insertion_df, test_exon_counts, gene_id='ENSMUSG00000026510') assert result.p_value < 0.01 assert result.direction == 1
def test_pos_example_trp53bp2_df(self, test_insertions, test_exon_counts): """Tests positive example of DE in Trp53bp2 with dataframe input.""" test_insertion_df = Insertion.to_frame(test_insertions) result = test.test_de_exon(test_insertion_df, test_exon_counts, gene_id='ENSMUSG00000026510') assert result.p_value < 0.01 assert result.direction == 1
def test_plot_sums(self, test_insertions, test_exon_counts): """Exercises plotting of sums.""" result = test.test_de_exon( test_insertions, test_exon_counts, gene_id='ENSMUSG00000026510') result.plot_sums()