<jupyter_start><jupyter_text>Explore Testis BM5 First look at BM5 sample. Just trying to see what cluster is what.<jupyter_code>import os
import sys
import re
from pathlib import Path

from IPython.display import display, HTML, Markdown
import numpy as np
import pandas as pd

import matplotlib as mpl
import matplotlib.pyplot as plt
import seaborn as sns

# Project level imports
from larval_gonad.config import read_config
from larval_gonad.notebook import Nb
from larval_gonad.normalization import tpm, zscore
from larval_gonad.scRNAseq import TSNEPlot
nb = Nb.setup_notebook(seurat_dir='../output/translocations-wf/translocation_BM5_force')
metadata = nb.seurat.get_metadata()
clusters = metadata['res.0.6']
tsne = nb.seurat.get_tsne()
df = tsne.join(clusters)
sns.lmplot('tSNE_1', 'tSNE_2', data=df, hue='res.0.6', fit_reg=False, scatter_kws=dict(s=5), palette=sns.color_palette(n_colors=11))
plt.title('Testis BM5 tSNE');
lit_genes = read_config('../paper_submission/config.yaml', 'lit_genes_long')
lit_fbgns = [nb.symbol2fbgn[g] for g in lit_genes]
raw_cnts = nb.seurat.get_raw()
raw_by_cluster = raw_cnts.T.join(clusters).groupby('res.0.6').sum().T
raw_by_cluster.index.name = 'Fbgn'
raw_by_cluster.columns.name = 'cluster'
raw_by_cluster.columns = raw_by_cluster.columns.astype(int)
ax = sns.heatmap(zscore(raw_by_cluster.reindex(lit_fbgns)), vmin=-3, vmax=3, cmap='viridis')
yticks = [
    nb.fbgn2symbol[y.get_text()]
    for y in ax.get_yticklabels()
]

ax.set_yticklabels(yticks)
plt.title('Testis BM5 Literature Genes');<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.11892583120204604, 'fraction_numerical': 0.01278772378516624, 'mean_word_length': 6.382075471698113, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '1', 'dir': 'jupyter-structured-clean-dedup', 'id': '54113', 'license': 'MIT', 'n_tokens_mistral': 627, 'n_tokens_neox': 600, 'n_words': 126, 'path': 'notebook/2019-01-22_explore_testis_BM5.ipynb', 'repo_name': 'jfear/larval_gonad', 'size': '1564'}