# ---
# jupyter:
#   jupytext:
#     text_representation:
#       extension: .py
#       format_name: light
#       format_version: '1.5'
#       jupytext_version: 1.14.4
#   kernelspec:
#     display_name: Python 3
#     language: python
#     name: python3
# ---

import pandas as pd
import matplotlib
import matplotlib.pyplot as plt
import seaborn as sns
sns.set()
# %matplotlib inline

aml_df = pd.read_csv('../data_files/aml.normal.meta.csv', index_col=0)
#allergy_df = pd.read_csv('../data_files/allergy.allergy.normal.csv', index_col=0)
#diabetes_df = pd.read_csv('../data_files/diabetes.diabetes.normal.csv', index_col=0)
#diabetes_control_df = pd.read_csv('../data_files/diabetes_control.diabetes_control.normal.csv', index_col=0)
control_df = pd.read_csv('../data_files/big_control.meta.csv', index_col=0)

aml_df['norm_alignment_count'] = aml_df['alignment_count'] / (aml_df['MBases'])
aml_df['norm_alpha_wt_count'] = aml_df['alpha_wt_count'] / (aml_df['MBases'])
aml_df['norm_alpha_dup_count'] = aml_df['alpha_dup_count'] / (aml_df['MBases'])
aml_df['norm_beta_count'] = aml_df['beta_count'] / (aml_df['MBases'])
aml_df['norm_alpha_read_covers_snps_count_exact'] = aml_df['alpha_read_covers_snps_count_exact'] / (aml_df['MBases'])
aml_df['norm_alpha_dup_read_covers_snps_count_exact'] = aml_df['alpha_dup_read_covers_snps_count_exact'] / (aml_df['MBases'])
aml_df['norm_beta_read_covers_snps_count_exact'] = aml_df['beta_read_covers_snps_count_exact'] / (aml_df['MBases'])

master_df = aml_df.append([control_df])

master_df.shape

master_df.columns

master_df.describe()

#How many of each type do we have?
fig, ax = plt.subplots(figsize=(8,8))
sns.countplot(x='source', data=master_df)

# +
#What are the expression levels of each type?
fig, ax = plt.subplots(3,1,figsize=(8,8))
sns.barplot(x='source', y='norm_alpha_read_covers_snps_count_exact', data=master_df, ax=ax[0])
sns.barplot(x='source', y='norm_alpha_dup_read_covers_snps_count_exact', data=master_df, ax=ax[1])
sns.barplot(x='source', y='norm_beta_read_covers_snps_count_exact', data=master_df, ax=ax[2])

ax[0].set_ylabel('Alpha WT (RPM)')
ax[1].set_ylabel('Alpha DUP (RPM)')
ax[2].set_ylabel('Beta (RPM)')
plt.tight_layout()

# +
plot = sns.pairplot(x_vars=["norm_alpha_read_covers_snps_count_exact"], y_vars=["norm_alpha_dup_read_covers_snps_count_exact"], data=master_df, hue="source", size=10)

axes = plot.axes

#axes[0,0].set_ylim(-2,80)
#axes[0,0].set_xlim(-2,40)

# +
#Ones with highest alpha dup expression

#master_df[master_df['norm_alpha_dup_read_covers_snps_count_exact'] > 40].sort_values('norm_alpha_dup_read_covers_snps_count_exact', ascending=False)
# -

sns.barplot(x='source', y='alpha_wt_count', data=master_df)

control_df.describe()

master_df['source'].value_counts()

sns.barplot(x='source', y='alignment_count', data=master_df)

control_df[['alignment_count']].sort_values('alignment_count', ascending=False).head(50)

grouped = master_df.groupby('source')

grouped.max()

master_df[master_df['source'] == 'big_control'][['norm_alpha_dup_read_covers_snps_count_exact']].sort_values('norm_alpha_dup_read_covers_snps_count_exact', ascending=False).head()

master_df['beta_count'].sum()

master_df['norm_alpha_dup_read_covers_snps_count_exact'].max()





StarcoderdataJupyterScriptsDedupFiltered