def inspect_bulk(df, df_bulk, de_genes, de_genes_bulk):
"""
"""
quant_types = [("bitseq", df_bulk)]
for quant_type, exp_matrix in quant_types:
print(quant_type)
# Boxplots of expression
fig, axis = plt.subplots(1)
sns.boxplot(data=pd.melt(exp_matrix), x="grna", y="value", hue="condition", ax=axis)
fig.savefig(os.path.join("results", "bulk", "bulk_samples.qc.{}.expression_boxplots.png".format(quant_type)), dpi=300, bbox_inches="tight")
# Heatmap and correlation on signature genes
# derived from bulk
# derived from scRNA
for geneset in ["de_genes", "de_genes_bulk"]:
g = sns.clustermap(
exp_matrix.ix[eval(geneset)].dropna(),
z_score=0,
row_cluster=True, col_cluster=True,
xticklabels=True, yticklabels=True,
figsize=(15, 15))
for item in g.ax_heatmap.get_yticklabels():
item.set_rotation(0)
for item in g.ax_heatmap.get_xticklabels():
item.set_rotation(90)
g.fig.savefig(os.path.join("results", "bulk", "bulk_samples.qc.{}.{}.png".format(quant_type, geneset)), dpi=300, bbox_inches="tight")
g = sns.clustermap(
exp_matrix.ix[eval(geneset)].dropna().corr(),
row_cluster=True, col_cluster=True,
xticklabels=True, yticklabels=True,
figsize=(15, 15))
for item in g.ax_heatmap.get_yticklabels():
item.set_rotation(0)
for item in g.ax_heatmap.get_xticklabels():
item.set_rotation(90)
g.fig.savefig(os.path.join("results", "bulk", "bulk_samples.qc.{}.{}.correlation.png".format(quant_type, geneset)), dpi=300, bbox_inches="tight")
评论列表
文章目录