<jupyter_start><jupyter_text>Accession: [link]<jupyter_code>%load block0_load.py
%load block1_init.py
adata = adata[adata.obs.n_genes_by_counts < 8000, :]  # edit
adata = adata[adata.obs.pct_counts_mt < 50]<jupyter_output><empty_output><jupyter_text>Add additional labels, normalize and add plotting variables.<jupyter_code>%load block2_process.py<jupyter_output><empty_output><jupyter_text>Save.<jupyter_code>sc.write(f'{author_year}.h5ad', adata, compression='gzip')
adata<jupyter_output><empty_output><jupyter_text>Standardized perturbation labels and save again.<jupyter_code>adata = sc.read(f'{author_year}.h5ad')
%load block3_standardize.py
sc.write(f'{author_year}.h5ad', adata, compression='gzip')
adata<jupyter_output><empty_output><jupyter_text>View.<jupyter_code>plot_cols = [c for c in adata.obs.columns if len(adata.obs[c].unique()) < 30 or not hasattr(adata.obs[c], 'cat')]
for c in plot_cols:
    if adata.obs[c].dtype == 'bool':
        adata.obs[c] = adata.obs[c].astype('category')
sc.pl.umap(adata, color=plot_cols, wspace=.4)<jupyter_output><empty_output><jupyter_text>Plot the top 30 most common perturbations. We do this separately because many datasets have too many perturbations for `scanpy`'s color palettes.<jupyter_code>sc.pl.umap(
    adata[adata.obs.perturbation_name.isin((adata.obs.perturbation_name.value_counts().index[:30]))],
    color='perturbation_name')<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.14064697609001406, 'fraction_numerical': 0.014064697609001406, 'mean_word_length': 8.121794871794872, 'pattern_counts': {'":': 0, '<': 28, '<?xml version=': 0, '>': 25, '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': '6', 'dir': 'jupyter-structured-clean-dedup', 'id': '462963', 'license': 'MIT', 'n_tokens_mistral': 552, 'n_tokens_neox': 528, 'n_words': 82, 'path': 'datasets/template.ipynb', 'repo_name': 'ethanweinberger/sc-pert', 'size': '1422'}