<jupyter_start><jupyter_text>Data import<jupyter_code>dtypes = dict(
    Tumor_Sample_Barcode=str,
    Chromosome="category",
    Start_Position=int,
    Reference_Allele="category",
    Tumor_Seq_Allele2="category",
    Hugo_Symbol=str,
    Consequence="category",
    Variant_Classification="category",
    DNA_VAF=float,
    Substitution="category"
)
mutations = pd.read_table("results/mutations_with_context.txt", dtype=dtypes, usecols=dtypes.keys())
mutational_catalogues = mutations.groupby(["Tumor_Sample_Barcode","Substitution"]).size().unstack(fill_value=0)
assert len(mutational_catalogues.columns) == 96
info_clinica = pd.read_table(
    "resources/pancan_pcawg_2020/data_clinical_sample.txt",
    index_col="SAMPLE_ID",
    comment="#")
histology = info_clinica.loc[mutational_catalogues.index, "HISTOLOGY_ABBREVIATION"].astype("category")<jupyter_output><empty_output><jupyter_text>Tumor types  Table<jupyter_code>(
    histology
    .str.split("-", expand=True)
    .rename(columns={0:"Site",1:"Type"})
    .groupby("Site")
    .value_counts()
    .rename("Samples")
    .to_frame()
)
(
    histology
    .str.split("-", expand=True)
    .rename(columns={0:"Site",1:"Type"})
    .groupby("Type")
    .value_counts()
    .rename("Samples")
    .to_frame()
)<jupyter_output><empty_output><jupyter_text>Plots<jupyter_code>plt.figure(figsize=(5,10))
sns.countplot(y=histology.str.split("-").str[0], order=histology.str.split("-").str[0].value_counts().index)
plt.ylabel("")
plt.xlabel("Available samples")
sns.despine()
plt.figure(figsize=(5,10))
sns.countplot(y=histology.str.split("-").str[1], order=histology.str.split("-").str[1].value_counts().index)
plt.ylabel("")
plt.xlabel("Available samples")
sns.despine()
plt.figure(figsize=(5,10))
sns.countplot(y=histology, order=histology.value_counts().index)
plt.ylabel("")
plt.xlabel("Available samples")
sns.despine()<jupyter_output><empty_output><jupyter_text>SNV counts<jupyter_code>plt.figure(figsize=(5,10))
sns.boxplot(
    x=mutational_catalogues.sum(axis=1),
    y=histology,
    order = mutational_catalogues.sum(axis=1).groupby(histology).median().sort_values(ascending=False).index)
plt.xscale("log")
plt.xlabel("Whole genome SNV counts")
plt.ylabel("")
sns.despine()
plt.figure(figsize=(5,7))
sns.boxplot(
    x=mutational_catalogues.sum(axis=1),
    y=histology.str.split("-").str[0],
    order = mutational_catalogues.sum(axis=1).groupby(histology.str.split("-").str[0]).median().sort_values(ascending=False).index)
plt.xscale("log")
plt.xlabel("Whole genome SNV counts")
plt.ylabel("")
sns.despine()<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.18080614203454895, 'fraction_numerical': 0.01381957773512476, 'mean_word_length': 6.687315634218289, 'pattern_counts': {'":': 0, '<': 17, '<?xml version=': 0, '>': 17, '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': '4', 'dir': 'jupyter-structured-clean-dedup', 'id': '89512', 'license': 'MIT', 'n_tokens_mistral': 1033, 'n_tokens_neox': 991, 'n_words': 95, 'path': 'workflow/notebooks/descriptive_stats.ipynb', 'repo_name': 'PedroSebe/signature-inference', 'size': '2605'}