# Developing-Heart-Local-Improved - Niche Analysis

**Pages:** 4

---

## Notebook

**URL:** http://127.0.0.1:9020/notebooks_html/Fig3_SAN_niche/snMultime_no1_FoetalSANCM_genes.html

**Contents:**
- Function¶
- Read in adata¶
- Subset anndata¶
- DEG: SANCM vs other CMs¶
- DEG: Foetal vs Adult¶
- Read in adult anndata and concatenate with foetal data¶
- Prepare anndata for pseudobulk wilcoxon test¶
- Pseudobulk wilcoxon test¶
- Obtain shared DEGs¶
- Pathway enrichment¶
- Plotting¶
- Plot axon guidance genes¶
- Glutermatergic signaling genes¶
- Axon guidance receptor expressions¶

34377 rows × 2 columns

**Examples:**

Example 1 (python):
```python
# Parameters
working_dir = "/nfs/team205/heart/Vitro/TF_selection/foetal_SANPcell_vs_workingCM"
path_to_adata_gex = "/nfs/team205/heart/anndata_objects/Foetal/Feb28ObjectRaw_Multiome.h5ad"
path_to_DAR_1 = "/nfs/team205/heart/anndata_objects/Foetal/multiome_ATAC/ArchR/project_output/MarkerPeaks/SANP-vs-aCM.csv"
path_to_DAR_2 = "/nfs/team205/heart/anndata_objects/Foetal/multiome_ATAC/ArchR/project_output/MarkerPeaks/aCM-vs-SANP.csv"
path_to_p2g_ArchR = ""
group_key = "fine_grain_aCMs_merged"
group_a = "SinoatrialNodePacemakerCells"
group_b = "AtrialCardiomyocytes"
subset_object = True
geneset_list = ["MSigDB_Hallmark_2020", "KEGG_2021_Human", "GO_Biological_Process_2023"]

path_to_eRegulon_signatures_gene = "/nfs/team205/heart/pyscenic/plus/eRegulon_signatures/Cardiomyocytes_Gene_eRegulon_signatures.pkl"
path_to_eRegulon_signatures_region = "/nfs/team205/heart/pyscenic/plus/eRegulon_signatures/Cardiomyocytes_Region_eRegulon_signatures.pkl"
```

Example 2 (python):
```python
import scanpy as sc
import pandas as pd
import numpy as np
import anndata

import matplotlib.pyplot as plt
import matplotlib as mpl
# enables correct plotting of text
mpl.rcParams['pdf.fonttype'] = 42
mpl.rcParams['ps.fonttype'] = 42
import seaborn as sns

import warnings
warnings.simplefilter("ignore", UserWarning)
```

Example 3 (python):
```python
import session_info
session_info.show()
```

Example 4 (python):
```python
-----
anndata             0.9.2
matplotlib          3.7.2
numpy               1.24.4
pandas              1.5.3
scanpy              1.9.3
seaborn             0.12.2
session_info        1.0.0
-----
```

Example 5 (python):
```python
PIL                         10.0.0
anyio                       NA
arrow                       1.2.3
asttokens                   NA
attr                        23.1.0
attrs                       23.1.0
babel                       2.12.1
backcall                    0.2.0
brotli                      1.0.9
certifi                     2023.11.17
cffi                        1.15.1
charset_normalizer          3.2.0
colorama                    0.4.6
comm                        0.1.4
cycler                      0.10.0
cython_runtime              NA
dateutil                    2.8.2
debugpy                     1.6.8
decorator                   5.1.1
defusedxml                  0.7.1
executing                   1.2.0
fastjsonschema              NA
fqdn                        NA
h5py                        3.9.0
idna                        3.4
igraph                      0.10.6
importlib_metadata          NA
importlib_resources         NA
ipykernel                   6.25.1
isoduration                 NA
jedi                        0.19.0
jinja2                      3.1.2
joblib                      1.3.2
json5                       NA
jsonpointer                 2.0
jsonschema                  4.19.0
jsonschema_specifications   NA
jupyter_events              0.7.0
jupyter_server              2.7.1
jupyterlab_server           2.24.0
kiwisolver                  1.4.5
leidenalg                   0.10.1
llvmlite                    0.40.1
markupsafe                  2.1.3
mpl_toolkits                NA
natsort                     8.4.0
nbformat                    5.9.2
numba                       0.57.1
overrides                   NA
packaging                   23.1
parso                       0.8.3
patsy                       0.5.3
pexpect                     4.8.0
pickleshare                 0.7.5
pkg_resources               NA
plotly                      5.16.1
prometheus_client           NA
prompt_toolkit              3.0.39
psutil                      5.9.5
ptyprocess                  0.7.0
pure_eval                   0.2.2
pydev_ipython               NA
pydevconsole                NA
pydevd                      2.9.5
pydevd_file_utils           NA
pydevd_plugins              NA
pydevd_tracing              NA
pygments                    2.16.1
pyparsing                   3.0.9
pythonjsonlogger            NA
pytz                        2023.3
referencing                 NA
requests                    2.31.0
rfc3339_validator           0.1.4
rfc3986_validator           0.1.1
rpds                        NA
ruamel                      NA
scipy                       1.10.1
send2trash                  NA
six                         1.16.0
sklearn                     1.3.0
sniffio                     1.3.0
socks                       1.7.1
sphinxcontrib               NA
stack_data                  0.6.2
statsmodels                 0.14.0
texttable                   1.6.7
threadpoolctl               3.2.0
tornado                     6.3.3
traitlets                   5.9.0
typing_extensions           NA
uri_template                NA
urllib3                     2.0.4
wcwidth                     0.2.6
webcolors                   1.13
websocket                   1.6.2
yaml                        6.0.1
zipp                        NA
zmq                         25.1.1
zstandard                   0.19.0
```

Example 6 (unknown):
```unknown
-----
IPython             8.12.0
jupyter_client      8.3.0
jupyter_core        4.12.0
jupyterlab          4.0.5
notebook            7.0.2
-----
Python 3.8.17 (default, Jul  5 2023, 21:04:15) [GCC 11.2.0]
Linux-4.15.0-220-generic-x86_64-with-glibc2.17
-----
Session information updated at 2024-02-08 18:20
```

Example 7 (python):
```python
import importlib.util
import sys
spec = importlib.util.spec_from_file_location("module.name", "/nfs/team205/kk18/function/python/utils.py")
utils = importlib.util.module_from_spec(spec)
sys.modules["module.name"] = utils
spec.loader.exec_module(utils)
```

Example 8 (python):
```python
sc.settings.set_figure_params(dpi=80,dpi_save=300)
```

Example 9 (unknown):
```unknown
figdir = '/nfs/team205/heart/fetal_ms_figures/raw_plots_kk'
```

Example 10 (python):
```python
import httplib2 as http
import json
import pandas as pd

def getHGNCgroup(GID, sortby='name', print_info=True):
    # http request
    target = f'https://www.genenames.org/cgi-bin/genegroup/download?id={GID}&type=branch&format=json'
    method = 'GET'
    h = http.Http()
    response, content = h.request(target,method)

    # parses the JSON
    if response['status'] == '200':
        data = json.loads(content)
    else:
        print('Error detected: ' + response['status'])
        return None
    
    # makes lists for symbol, name, group name
    symbol = []
    name = []
    group_name = []
    hgnc = []

    # extracts these from the JSON
    for i in range(len(data)):
        symbol.append((data[i]['approvedSymbol']))
        name.append((data[i]['approvedName']))
        group_name.append((data[i]['groupName']))
        hgnc.append((data[i]['hgncID']))

    # creates a data frame from the extracted information
    group_info = {
        'symbol':symbol,
        'name':name,
        'group_name':group_name,
        'hgnc':hgnc
    }
    group_info = pd.DataFrame.from_dict(group_info).sort_values(sortby,ascending=True)

    # print all unique group names if print_info is True
    if print_info:
        unique_group_names = set(group_name)
        print(f'HGNC Group {GID}, contains:')
        for grp_name in unique_group_names:
            print(grp_name)

    return group_info
```

Example 11 (python):
```python
adata = sc.read_h5ad(path_to_adata_gex)

# rename fine-grained cell types
celltype_rename = utils.read_pkl('/nfs/team205/heart/anndata_objects/Foetal/fine_grain_rename_dictionary.pkl')
adata.obs.replace({'fine_grain':celltype_rename},inplace=True)

# filter and log normalise
# filter
sc.pp.filter_genes(adata, min_cells=3)

# log normalise
sc.pp.normalize_total(adata, target_sum=1e4)
sc.pp.log1p(adata)
print(adata.X.data[:10])
```

Example 12 (unknown):
```unknown
[0.41374126 0.22811745 0.22811745 0.41374126 0.22811745 0.41374126
 0.22811745 0.41374126 0.22811745 0.22811745]
```

Example 13 (python):
```python
adata.obs['kit_10x'].value_counts()
```

Example 14 (unknown):
```unknown
Multiome-v1    211145
Name: kit_10x, dtype: int64
```

Example 15 (python):
```python
adata_sub = adata[adata.obs['coarse_grain']=='Cardiomyocytes']
adata_sub
```

Example 16 (unknown):
```unknown
View of AnnData object with n_obs × n_vars = 62104 × 34377
    obs: 'sangerID', 'combinedID', 'donor', 'region', 'age', 'facility', 'cell_or_nuclei', 'modality', 'kit_10x', 'scrublet_score', 'doublet_pval', 'doublet_bh_pval', 'n_genes', 'n_counts', 'n_genes_by_counts', 'log1p_n_genes_by_counts', 'total_counts', 'log1p_total_counts', 'total_counts_mt', 'log1p_total_counts_mt', 'pct_counts_mt', 'total_counts_ribo', 'log1p_total_counts_ribo', 'pct_counts_ribo', 'HB_score', 'donor_by_library-prep', 'multiplexed', 'SOC | status', 'SOC | log_prob_singleton', 'SOC | log_prob_doublet', 'batch_key', '_scvi_batch', 'FACSgate', 'fine_grain', 'mid_grain', 'coarse_grain', 'sex', 'week', 'trimester', 'heart_or_greatvessels', 'cycling', 'S_score', 'G2M_score', 'phase', '_scvi_labels', 'stress_score', 'hb1_score', 'fine_grain_aCMs_merged', 'fine_grain_aCMs-node_merged'
    var: 'gene_id', 'n_cells'
    uns: 'log1p'
```

Example 17 (python):
```python
adata_sub.var
```

Example 18 (python):
```python
adata_sub.obs.fine_grain.unique()
```

Example 19 (unknown):
```unknown
['VentricularCardiomyocytesLeftTrabeculated', 'AtrioventricularNodePacemakerCells', 'AtrialCardiomyocytesLeft', 'AtrialCardiomyocytesCycling', 'VentricularCardiomyocytesCycling', ..., 'AtrialCardiomyocytesRight', 'VentricularCardiomyocytesRightCompact', 'SinoatrialNodePacemakerCells', 'VentricularCardiomyocytesRightTrabeculated', 'VentricularConductionSystemDistal']
Length: 12
Categories (12, object): ['AtrialCardiomyocytesLeft', 'AtrialCardiomyocytesRight', 'AtrialCardiomyocytesCycling', 'VentricularCardiomyocytesLeftCompact', ..., 'SinoatrialNodePacemakerCells', 'AtrioventricularNodePacemakerCells', 'VentricularConductionSystemProximal', 'VentricularConductionSystemDistal']
```

Example 20 (unknown):
```unknown
logFC_threshold = 1
group_mean_threshold = 0.1
```

Example 21 (python):
```python
res = utils.rank_genes_groups_with_mean(adata_sub,
                                 groupby = 'fine_grain',
                                  groups = ['SinoatrialNodePacemakerCells'],
                                  reference = 'rest',
                                  method = 't-test',
                                  pval_cutoff = 0.05,
                                        log2fc_min=logFC_threshold
                                 )
sns.scatterplot(x=res['logfoldchanges'],y=res['group_mean'])
plt.show()
```

Example 22 (python):
```python
/nfs/team205/kk18/miniconda3/envs/vitro/lib/python3.8/site-packages/scanpy/tools/_rank_genes_groups.py:580: ImplicitModificationWarning: Trying to modify attribute `._uns` of view, initializing view as actual.
  adata.uns[key_added] = {}
```

Example 23 (unknown):
```unknown
# filter genes based on the group mean expression
res = res[res['group_mean']>group_mean_threshold]
display(res.head())
degs_sancm_vs_others = list(res['names'])
len(degs_sancm_vs_others)
```

Example 24 (python):
```python
# prepare adult anndata
adata_adult = sc.read_h5ad('/nfs/team205/heart/anndata_objects/8regions/RNA_adult-8reg_full_raw_cellstate-annotated.h5ad')

# subset SAN_P_cell
adata_adult = adata_adult[adata_adult.obs['cell_state']=='SAN_P_cell']
adata_adult = adata_adult[adata_adult.obs['kit_10x']=='Multiome-v1']

# log normalise
sc.pp.normalize_total(adata_adult, target_sum=1e4)
sc.pp.log1p(adata_adult)
print(adata_adult.X.data[:10])

# rename
adata_adult.var['gene_id'] =  adata_adult.var_names.copy()
adata_adult.var.set_index('gene_name-new',inplace=True)
adata_adult.var_names = adata_adult.var_names.astype('str')
adata_adult.var_names_make_unique()

adata_adult
```

Example 25 (unknown):
```unknown
[0.911473   0.31626672 0.31626672 0.31626672 0.74952203 0.911473
 0.31626672 0.31626672 0.31626672 0.31626672]
```

Example 26 (python):
```python
/nfs/team205/kk18/miniconda3/envs/vitro/lib/python3.8/site-packages/scanpy/preprocessing/_normalization.py:170: UserWarning: Received a view of an AnnData. Making a copy.
  view_to_actual(adata)
```

Example 27 (unknown):
```unknown
AnnData object with n_obs × n_vars = 245 × 32732
    obs: 'sangerID', 'combinedID', 'donor', 'donor_type', 'region', 'region_finest', 'age', 'gender', 'facility', 'cell_or_nuclei', 'modality', 'kit_10x', 'flushed', 'n_genes', 'n_genes_by_counts', 'total_counts', 'total_counts_mt', 'pct_counts_mt', 'total_counts_ribo', 'pct_counts_ribo', 'scrublet_score', 'scrublet_leiden', 'cluster_scrublet_score', 'doublet_pval', 'doublet_bh_pval', 'batch_key', 'leiden_scVI', 'cell_type', 'cell_state_HCAv1', 'cell_state_scNym', 'cell_state_scNym_confidence', 'cell_state', 'latent_RT_efficiency', 'latent_cell_probability', 'latent_scale', 'n_counts', '_scvi_batch', '_scvi_labels', 'clus20', 'doublet_cls', 'original_or_new', 'batch', 'scANVI_predictions', 'leiden_scArches'
    var: 'gene_name_scRNA-0-original', 'gene_name_snRNA-1-original', 'gene_name_multiome-2-original', 'gene_id'
    uns: 'age_colors', 'cell_or_nuclei_colors', 'cell_state_colors', 'cell_type_colors', 'donor_colors', 'donor_type_colors', 'facility_colors', 'flushed_colors', 'gender_colors', 'kit_10x_colors', 'leiden', 'modality_colors', 'neighbors', 'original_or_new_colors', 'region_colors', 'region_finest_colors', 'scANVI_predictions_colors', 'umap', 'log1p'
    obsm: 'X_scArches', 'X_umap'
    obsp: 'connectivities', 'distances'
```

Example 28 (python):
```python
# concatenate
## shared features
shared = list(set(adata_sub.var_names).intersection(adata_adult.var_names))

adata_sub.obs['stage'] = 'foetal'
adata_adult.obs['stage'] = 'adult'
adata_adult.obs['week'] = 'adult'
adata_adult.obs['fine_grain'] = 'adult - SAN_P_cell'

adata_conc = adata_sub[:,shared].concatenate(adata_adult[:,shared],
                                             join='inner',
                                             batch_key=None,
                                             index_unique=None
                                            )
```

Example 29 (unknown):
```unknown
/nfs/team205/kk18/miniconda3/envs/vitro/lib/python3.8/site-packages/anndata/_core/anndata.py:1763: FutureWarning: The AnnData.concatenate method is deprecated in favour of the anndata.concat function. Please use anndata.concat instead.

See the tutorial for concat at: https://anndata.readthedocs.io/en/latest/concatenation.html
  warnings.warn(
```

Example 30 (python):
```python
# combine donor and stage key
adata_conc.obs['donor_new'] = adata_conc.obs['stage'].astype('str')+'_'+adata_conc.obs['donor'].astype('str')
set(adata_conc.obs['donor_new'])
```

Example 31 (unknown):
```unknown
{'adult_A61',
 'adult_AH1',
 'adult_AH2',
 'adult_AV10',
 'adult_AV14',
 'adult_AV3',
 'foetal_C104',
 'foetal_C82',
 'foetal_C85',
 'foetal_C87',
 'foetal_C92',
 'foetal_C98',
 'foetal_Hst33',
 'foetal_Hst36',
 'foetal_Hst39',
 'foetal_Hst40',
 'foetal_Hst41'}
```

Example 32 (python):
```python
# add drimester 
donor_trimester_df = adata_conc.obs[['donor','trimester']].copy()
donor_trimester_df = donor_trimester_df.drop_duplicates()
donor_trimester_df['trimester'] = [x if x==x else 'adult' for x in donor_trimester_df['trimester']]
donor_trimester_df
```

Example 33 (python):
```python
groupby = 'donor_new'
celltypes = ['SinoatrialNodePacemakerCells','adult - SAN_P_cell']
n_cell_thresh = 10

# subset anndata
ad = adata_conc[adata_conc.obs['fine_grain'].isin(celltypes)]
# remove group which only has less than a threshold
vc = ad.obs[groupby].value_counts()
grp_to_drop = list(vc.index[vc < 10])
ad = ad[~ad.obs[groupby].isin(grp_to_drop)]
print(f'dropped groups: {grp_to_drop}')

# mean expression per group
exp_mean = utils.grouped_obs_mean(ad, group_key=groupby)

# make anndata
import anndata
adata_pb = anndata.AnnData(
    X=exp_mean.T,
    obs=pd.DataFrame(exp_mean.columns).set_index(0),
    var=pd.DataFrame(exp_mean.index).set_index(0)
)

# add stage key
adata_pb.obs['stage'] = [x.split('_')[0] for x in adata_pb.obs_names]
adata_pb.obs['stage'] = adata_pb.obs['stage'].astype('category')
adata_pb.obs['stage'].cat.reorder_categories(['foetal','adult'],inplace=True)

# add donor and trimester key
adata_pb.obs['donor'] = [x.split('_')[1] for x in adata_pb.obs_names]
obs = adata_pb.obs.reset_index().merge(donor_trimester_df,how='left',on='donor').set_index(0)
obs.index.name = 'index'
adata_pb.obs = obs
adata_pb.obs['trimester'] = adata_pb.obs['trimester'].astype('category')
adata_pb.obs['trimester'].cat.reorder_categories(['firsttrimester','secondtrimester','adult'],inplace=True)


print(adata_pb.obs['stage'].value_counts())
print(adata_pb)
```

Example 34 (unknown):
```unknown
dropped groups: ['foetal_C82', 'foetal_Hst36']
foetal    8
adult     6
Name: stage, dtype: int64
AnnData object with n_obs × n_vars = 14 × 30749
    obs: 'stage', 'donor', 'trimester'
```

Example 35 (python):
```python
/tmp/ipykernel_30942/3488307275.py:27: FutureWarning: The `inplace` parameter in pandas.Categorical.reorder_categories is deprecated and will be removed in a future version. Reordering categories will always return a new Categorical object.
  adata_pb.obs['stage'].cat.reorder_categories(['foetal','adult'],inplace=True)
/tmp/ipykernel_30942/3488307275.py:35: FutureWarning: The `inplace` parameter in pandas.Categorical.reorder_categories is deprecated and will be removed in a future version. Reordering categories will always return a new Categorical object.
  adata_pb.obs['trimester'].cat.reorder_categories(['firsttrimester','secondtrimester','adult'],inplace=True)
```

Example 36 (python):
```python
# rank test
logFC_threshold_FvsA = 1
group_mean_threshold = 0.1

res_foetal_vs_adult = utils.rank_genes_groups_with_mean(adata_pb,
                                 groupby = 'stage',
                                  groups = ['foetal'],
                                  reference = 'adult',
                                  method = 'wilcoxon',
                                  pval_cutoff = 0.1,
                                        log2fc_min=logFC_threshold_FvsA
                                 )

sns.scatterplot(x=res_foetal_vs_adult['logfoldchanges'],y=res_foetal_vs_adult['group_mean'])
plt.show()
```

Example 37 (python):
```python
res_foetal_vs_adult = res_foetal_vs_adult[res_foetal_vs_adult['group_mean']>group_mean_threshold]
degs_foetal_vs_adult = list(res_foetal_vs_adult['names'])
print(len(degs_foetal_vs_adult))
display(res_foetal_vs_adult.head())
```

Example 38 (unknown):
```unknown
res_foetal_vs_adult[res_foetal_vs_adult['names']=='CXCL12']
```

Example 39 (python):
```python
from matplotlib_venn import venn2
venn2(subsets=(set(degs_sancm_vs_others),set(degs_foetal_vs_adult)),
      set_labels=('SAN_P vs Others (foetal)', 'Foetal vs Adult')
     )
```

Example 40 (python):
```python
<matplotlib_venn._common.VennDiagram at 0x153fd0827cd0>
```

Example 41 (unknown):
```unknown
degs_common = list(set(degs_sancm_vs_others).intersection(degs_foetal_vs_adult))
len(degs_common)
```

Example 42 (python):
```python
import gseapy as gp
```

Example 43 (unknown):
```unknown
# Re-enrichmant analysis for plotting
enr_sancm_vs_othercm = gp.enrichr(gene_list=degs_sancm_vs_others,
                 gene_sets=geneset_list,
                 organism='human', # don't forget to set organism to the one you desired! e.g. Yeast
                 outdir=None, # don't write to disk
                )

enr_common = gp.enrichr(gene_list=degs_common,
                 gene_sets=geneset_list,
                 organism='human', # don't forget to set organism to the one you desired! e.g. Yeast
                 outdir=None, # don't write to disk
                )
```

Example 44 (python):
```python
# foetal, SANP vs other CM
geneset = 'GO_Biological_Process_2023'

df = enr_sancm_vs_othercm.results[enr_sancm_vs_othercm.results['Gene_set'] == geneset]
df = df[df['Adjusted P-value'] < 0.1]
df = df.sort_values('Combined Score',ascending=False)

# plot
n_rank = 10
plt.rcParams['axes.grid'] = False
plt.rcParams['figure.figsize'] = 4,2.5
plt.barh(width=df[:n_rank]['Combined Score'],
         y=[x.split(' (')[0] for x in df[:n_rank]['Term']],
         color='darkred')
plt.gca().invert_yaxis()
plt.xlabel('Combined Score')
plt.title(f'SAN pacemaker cell vs other CMs\n{geneset}')
plt.margins(y=0.03)
plt.savefig(f'{figdir}/Pathway-enr_SANP_sancm_vs_othercm_genes.pdf',bbox_inches="tight",dpi=300)
plt.show()
```

Example 45 (python):
```python
# foetal vs adult, SANP
geneset = 'GO_Biological_Process_2023'

df = enr_common.results[enr_common.results['Gene_set'] == geneset]
df = df[df['Adjusted P-value'] < 0.1]
df = df.sort_values('Combined Score',ascending=False)

# plot
n_rank = 10
plt.rcParams['axes.grid'] = False
plt.rcParams['figure.figsize'] = 4,2.5
plt.barh(width=df[:n_rank]['Combined Score'],
         y=[x.split(' (')[0] for x in df[:n_rank]['Term']],
         color='darkred')
plt.gca().invert_yaxis()
plt.xlabel('Combined Score')
plt.title(f'Foetal vs Adult SAN pacemaker cell\n{geneset}')
plt.margins(y=0.03)
plt.savefig(f'{figdir}/Pathway-enr_SANP_common_genes.pdf',bbox_inches="tight",dpi=300)
plt.show()
```

Example 46 (python):
```python
# read in manually collected axon guidance genes
axon_genes = list(pd.read_csv('./Axon_guidance.csv')['Gene'])

# genes which is DEGs for both foetal-sancm-vs-others and foetal-vs-adult
genes_sel1 = [x for x in axon_genes if x in degs_common]
genes_sel1
```

Example 47 (unknown):
```unknown
['SEMA3A', 'SLIT2', 'SLIT3', 'EFNB2', 'CXCL12', 'FGF10', 'VEGFC', 'NELL1']
```

Example 48 (python):
```python
# plotting the genes
genes = genes_sel1.copy()

group_col = 'trimester'

data = adata_pb.to_df()[genes]
data[group_col] = adata_pb.obs[group_col]

# Melt the DataFrame to get a long-form DataFrame suitable for facetting
melted_data = data.melt(id_vars=group_col, value_vars=genes, var_name='gene', value_name='mean expression')

# Create a catplot with boxplots for each gene
g = sns.catplot(x=group_col, y='mean expression', col='gene', data=melted_data, kind='box',
                col_wrap=4, sharey=False, sharex=False, height=2, aspect=0.8)

# Overlay swarmplot on each Axes
# We'll use the 'hue' parameter to match the subsets and turn off dodge to align the points with the boxes.
for gene, ax in zip(melted_data['gene'].unique(), g.axes.flat):
    subset = melted_data[melted_data['gene'] == gene]
    sns.swarmplot(x=group_col, y='mean expression', data=subset, color='k', size=5, ax=ax, dodge=False)
    
# Update titles to remove "gene ="
for ax, gene in zip(g.axes.flat, genes):
    ax.set_title(gene)

# Rotate x-tick labels and remove x-axis labels
for i,ax in enumerate(g.axes.flat):
    # ax.set_xticklabels(ax.get_xticklabels(), rotation=45, ha="right", rotation_mode="anchor")  # Rotate x-tick labels
    ax.set_xticklabels('')
    ax.set_xlabel('')  # Remove x-axis labels
    if i!=0:
        ax.set_ylabel('')

# Adjust the spacing of the plots
g.fig.subplots_adjust(wspace=0.4, hspace=0.4)

# Manually create a legend for the groups.
# Since there are no legend handles for the swarmplot, we create them manually.
from matplotlib.patches import Patch
legend_patches = [Patch(facecolor='#0343DF', edgecolor='k', label='firsttrimester'),
                  Patch(facecolor='#FFA500', edgecolor='k', label='secondtrimester'),
                  Patch(facecolor='#008000', edgecolor='k', label='adult')]

# Add a single legend for the entire figure with our custom patches
g.fig.legend(handles=legend_patches, labels=['firsttrimester', 'secondtrimester', 'adult'], title='', loc='center', bbox_to_anchor=(1.05, 0.8))

# Show the plot
plt.savefig(f'{figdir}/Boxplot_SANPC_axon-guidance-genes.pdf',bbox_inches="tight",dpi=300)
plt.show()
```

Example 49 (python):
```python
genes = ['GLS','GRID2','GRIA3','SLC1A3','SLC17A5','SLC38A1','SNAP25','STX16','STX17'] #'CHRM2',
genes.sort()
# genes = genes + ['GRIA1','GRIK3','GLUL','SLC1A2','SLC38A5','SLC38A9','NGF']

group_col = 'trimester'

data = adata_pb.to_df()[genes]
data[group_col] = adata_pb.obs[group_col]

# Melt the DataFrame to get a long-form DataFrame suitable for facetting
melted_data = data.melt(id_vars=group_col, value_vars=genes, var_name='gene', value_name='mean expression')

# Create a catplot with boxplots for each gene
g = sns.catplot(x=group_col, y='mean expression', col='gene', data=melted_data, kind='box',
                col_wrap=9, sharey=False, sharex=False, height=3, aspect=0.5)

# Overlay swarmplot on each Axes
# We'll use the 'hue' parameter to match the subsets and turn off dodge to align the points with the boxes.
for gene, ax in zip(melted_data['gene'].unique(), g.axes.flat):
    subset = melted_data[melted_data['gene'] == gene]
    sns.swarmplot(x=group_col, y='mean expression', data=subset, color='k', size=7, ax=ax, dodge=False)
    
# Update titles to remove "gene ="
for ax, gene in zip(g.axes.flat, genes):
    ax.set_title(gene)

# Rotate x-tick labels and remove x-axis labels
for i,ax in enumerate(g.axes.flat):
    # ax.set_xticklabels(ax.get_xticklabels(), rotation=45, ha="right", rotation_mode="anchor")  # Rotate x-tick labels
    ax.set_xticklabels('')
    ax.set_xlabel('')  # Remove x-axis labels
    if i!=0:
        ax.set_ylabel('')

# Adjust the spacing of the plots
g.fig.subplots_adjust(wspace=0.5, hspace=0.2)

# Manually create a legend for the groups.
# Since there are no legend handles for the swarmplot, we create them manually.
from matplotlib.patches import Patch
legend_patches = [Patch(facecolor='#0343DF', edgecolor='k', label='firsttrimester'),
                  Patch(facecolor='#FFA500', edgecolor='k', label='secondtrimester'),
                  Patch(facecolor='#008000', edgecolor='k', label='adult')]

# Add a single legend for the entire figure with our custom patches
g.fig.legend(handles=legend_patches, labels=['firsttrimester', 'secondtrimester', 'adult'], title='', loc='upper right', bbox_to_anchor=(0.15, 0.15))

# Show the plot
plt.savefig(f'{figdir}/Boxplot_SANPC_glutermatergic-genes.pdf',bbox_inches="tight",dpi=300)
plt.show()
```

Example 50 (unknown):
```unknown
LR = {
    'SEMA':['PLXNA1', 'PLXNA2', 'PLXNA3', 'PLXNA4','PLXND1'],
    'SLIT':['ROBO1','ROBO2','ROBO3','ROBO4'],
    'CXCL12':['CXCR4'],
    'NELL':['CNTNAP4'],
}
```

Example 51 (python):
```python
# at SAnode
cells = [
    'SinoatrialNodePacemakerCells',
 'ParasympatheticNeurons',
 'MacrophagesCX3CR1pos',
]

sc.pl.dotplot(adata[adata.obs['fine_grain'].isin(cells)],
              LR, 
              groupby='fine_grain',
              dendrogram=False,
              standard_scale="var",
              color_map="Reds",
              swap_axes=False,
              show=False
             )
plt.savefig(f'{figdir}/Dotplot_SAN_Axon-guidance-receptors.pdf',bbox_inches="tight",dpi=300)
```

---

## Notebook

**URL:** http://127.0.0.1:9020/notebooks_html/Fig3_SAN_niche/snMultime_no4_prepare_supp_table.html

**Contents:**
- Target: SANPC signatures¶
- Target: Ion channels¶
- Target: Axon guidances¶

**Examples:**

Example 1 (python):
```python
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
import seaborn as sns
import os
```

Example 2 (python):
```python
import importlib.util
import sys
spec = importlib.util.spec_from_file_location("module.name", "/nfs/team205/kk18/function/python/utils.py")
utils = importlib.util.module_from_spec(spec)
sys.modules["module.name"] = utils
spec.loader.exec_module(utils)
```

Example 3 (unknown):
```unknown
table_dir = '/nfs/team205/heart/fetal_ms_figures/tables'
```

Example 4 (python):
```python
scenic_meta_path = '/nfs/team205/heart/fetal_ms_figures/tables/csvs/scenicplus_eRegulon_metadata_CMs_SANPC-highlighted.csv'
```

Example 5 (python):
```python
TF_TG_network_path = '/nfs/team205/heart/Vitro/TF_selection/foetal_SANPcell_vs_workingCM/TF-TG-network_target-SANPC-signatures.pkl'
TF_TF_network_path = '/nfs/team205/heart/Vitro/TF_selection/foetal_SANPcell_vs_workingCM/TF-TF-network_target-SANPC-signatures.pkl'
TF_info_path = '/nfs/team205/heart/Vitro/TF_selection/foetal_SANPcell_vs_workingCM/TF_selection_df_target-SANPC-signatures.csv'

# TF_TG_network
network = utils.read_pkl(TF_TG_network_path)
print(len(network.keys()))

# TF info
TF_info = pd.read_csv(TF_info_path)
print(TF_info.shape)
display(TF_info.head())

# grn table
grn = pd.DataFrame({'TF':network.keys(),'Targets':network.values()})
grn = grn.merge(TF_info,how='left',on='TF')
grn = grn[['TF','Targets','centaliry_eigenvector']]
print(grn.shape)
display(grn.head())

# save the daraframe
grn.to_csv(os.path.join(table_dir,'csvs/TF_TG_network_SANPC_target-SANPC-signatures.csv'))
```

Example 6 (unknown):
```unknown
124
(124, 6)
```

Example 7 (python):
```python
TF_TG_network_path = '/nfs/team205/heart/Vitro/TF_selection/foetal_SANPcell_vs_workingCM/TF-TG-network_target-IonChannels.pkl'
TF_TF_network_path = '/nfs/team205/heart/Vitro/TF_selection/foetal_SANPcell_vs_workingCM/TF-TF-network_target-IonChannels.pkl'
TF_info_path = '/nfs/team205/heart/Vitro/TF_selection/foetal_SANPcell_vs_workingCM/TF_selection_df_target-IonChannels.csv'

# TF_TG_network
network = utils.read_pkl(TF_TG_network_path)
print(len(network.keys()))

# TF info
TF_info = pd.read_csv(TF_info_path)
print(TF_info.shape)
display(TF_info.head())

# grn table
grn = pd.DataFrame({'TF':network.keys(),'Targets':network.values()})
grn = grn.merge(TF_info,how='left',on='TF')
grn = grn[['TF','Targets','centaliry_eigenvector']]
print(grn.shape)
display(grn.head())

# save the daraframe
grn.to_csv(os.path.join(table_dir,'csvs/TF_TG_network_SANPC_target-IonChannels.csv'))
```

Example 8 (python):
```python
TF_TG_network_path = '/nfs/team205/heart/Vitro/TF_selection/foetal_SANPcell_vs_workingCM/TF-TG-network_target-AxonGuidances.pkl'
TF_TF_network_path = '/nfs/team205/heart/Vitro/TF_selection/foetal_SANPcell_vs_workingCM/TF-TF-network_target-AxonGuidances.pkl'
TF_info_path = '/nfs/team205/heart/Vitro/TF_selection/foetal_SANPcell_vs_workingCM/TF_selection_df_target-AxonGuidances.csv'

# TF_TG_network
network = utils.read_pkl(TF_TG_network_path)
print(len(network.keys()))

# TF info
TF_info = pd.read_csv(TF_info_path)
print(TF_info.shape)
display(TF_info.head())

# grn table
grn = pd.DataFrame({'TF':network.keys(),'Targets':network.values()})
grn = grn.merge(TF_info,how='left',on='TF')
grn = grn[['TF','Targets','centaliry_eigenvector']]
print(grn.shape)
display(grn.head())

# save the daraframe
grn.to_csv(os.path.join(table_dir,'csvs/TF_TG_network_SANPC_target-AxonGuidances.csv'))
```

---

## Notebook

**URL:** http://127.0.0.1:9020/notebooks_html/Fig3_SAN_niche/snMultime_no2_region-signatures.html

**Contents:**
- Function¶
- Read in DAR result¶
- Save the peaks¶

**Examples:**

Example 1 (python):
```python
# Parameters
working_dir = "/nfs/team205/heart/Vitro/TF_selection/foetal_SANPcell_vs_workingCM"
path_to_adata_gex = "/nfs/team205/heart/anndata_objects/Foetal/Feb28ObjectRaw_Multiome.h5ad"
path_to_adata_peak_tfidf = "/nfs/team205/heart/anndata_objects/Foetal/multiome_ATAC/ArchR/project_output/PeakMatrix/Foetal_Peaks_tfidf.h5ad"
path_to_DAR_1 = "/nfs/team205/heart/anndata_objects/Foetal/multiome_ATAC/ArchR/project_output/MarkerPeaks/SANP-vs-aCM.csv"
path_to_DAR_2 = "/nfs/team205/heart/anndata_objects/Foetal/multiome_ATAC/ArchR/project_output/MarkerPeaks/aCM-vs-SANP.csv"
path_to_p2g_ArchR = ""
group_key = "fine_grain_aCMs_merged"
group_a = "SinoatrialNodeCardiomyocytes"
group_b = "AtrialCardiomyocytes"
subset_object = True
geneset_list = ["MSigDB_Hallmark_2020", "KEGG_2021_Human", "GO_Biological_Process_2023"]

path_to_eRegulon_signatures_gene = "/nfs/team205/heart/pyscenic/plus/eRegulon_signatures/Cardiomyocytes_Gene_eRegulon_signatures.pkl"
path_to_eRegulon_signatures_region = "/nfs/team205/heart/pyscenic/plus/eRegulon_signatures/Cardiomyocytes_Region_eRegulon_signatures.pkl"
```

Example 2 (python):
```python
!ls /nfs/team205/heart/pyscenic/plus/eRegulon_metadata
```

Example 3 (python):
```python
aCM_full_eRegulon_metadata.csv
aCM_full_eRegulon_metadata_filtered.csv
aCM_n1140_eRegulon_metadata.csv
aCM_n1140_eRegulon_metadata_filtered.csv
aCM_n570_eRegulon_metadata.csv
aCM_n570_eRegulon_metadata_filtered.csv
Cardiomyocytes_eRegulon_metadata.csv
Cardiomyocytes_eRegulon_metadata_filtered.csv
Endothelium_eRegulon_metadata.csv
Endothelium_eRegulon_metadata_filtered.csv
Epicardium_eRegulon_metadata.csv
Epicardium_eRegulon_metadata_filtered.csv
Foetal_Adult_CMs_eRegulon_metadata.csv
Foetal_Adult_CMs_eRegulon_metadata_filtered.csv
Global_eRegulon_metadata.csv
Global_eRegulon_metadata_filtered.csv
Leukocytes_eRegulon_metadata.csv
Leukocytes_eRegulon_metadata_filtered.csv
Mesenchymal_eRegulon_metadata.csv
Mesenchymal_eRegulon_metadata_filtered.csv
MoMP_eRegulon_metadata.csv
Neural_eRegulon_metadata.csv
Neural_eRegulon_metadata_filtered.csv
vCM_onlyLeft_eRegulon_metadata.csv
vCM_onlyLeft_eRegulon_metadata_filtered.csv
```

Example 4 (python):
```python
import scanpy as sc
import pandas as pd
import numpy as np
import anndata

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

Example 5 (python):
```python
import session_info
session_info.show()
```

Example 6 (python):
```python
-----
anndata             0.9.2
matplotlib          3.5.2
numpy               1.22.3
pandas              1.5.3
scanpy              1.8.2
seaborn             0.12.2
session_info        1.0.0
-----
```

Example 7 (python):
```python
PIL                 10.0.0
asttokens           NA
backcall            0.2.0
beta_ufunc          NA
binom_ufunc         NA
cffi                1.15.1
colorama            0.4.6
comm                0.1.4
cpuinfo             NA
cycler              0.10.0
cython_runtime      NA
dateutil            2.8.2
debugpy             1.6.7.post1
decorator           5.1.1
executing           1.2.0
h5py                3.9.0
hypergeom_ufunc     NA
igraph              0.10.6
importlib_metadata  NA
ipykernel           6.25.1
jedi                0.19.0
joblib              1.3.2
kiwisolver          1.4.5
leidenalg           0.10.1
llvmlite            0.40.1
mpl_toolkits        NA
natsort             8.4.0
nbinom_ufunc        NA
ncf_ufunc           NA
numba               0.57.1
numexpr             2.8.5
packaging           23.1
parso               0.8.3
patsy               0.5.3
pexpect             4.8.0
pickleshare         0.7.5
pkg_resources       NA
platformdirs        3.10.0
plotly              5.16.1
prompt_toolkit      3.0.39
psutil              5.9.5
ptyprocess          0.7.0
pure_eval           0.2.2
pydev_ipython       NA
pydevconsole        NA
pydevd              2.9.5
pydevd_file_utils   NA
pydevd_plugins      NA
pydevd_tracing      NA
pygments            2.16.1
pyparsing           3.0.9
pytz                2023.3
scipy               1.9.1
sinfo               0.3.4
six                 1.16.0
sklearn             1.3.0
sphinxcontrib       NA
stack_data          0.6.2
statsmodels         0.14.0
tables              3.8.0
texttable           1.6.7
threadpoolctl       3.2.0
tornado             6.3.3
traitlets           5.9.0
typing_extensions   NA
wcwidth             0.2.6
zipp                NA
zmq                 25.1.1
```

Example 8 (unknown):
```unknown
-----
IPython             8.12.2
jupyter_client      8.3.0
jupyter_core        5.3.1
-----
Python 3.8.17 (default, Jul  5 2023, 21:04:15) [GCC 11.2.0]
Linux-4.15.0-212-generic-x86_64-with-glibc2.17
-----
Session information updated at 2023-11-05 12:00
```

Example 9 (python):
```python
import importlib.util
import sys
spec = importlib.util.spec_from_file_location("module.name", "/nfs/team205/kk18/function/python/utils.py")
utils = importlib.util.module_from_spec(spec)
sys.modules["module.name"] = utils
spec.loader.exec_module(utils)
```

Example 10 (python):
```python
sc.settings.set_figure_params(dpi=120)
```

Example 11 (python):
```python
logFC_threshold = 0
FDR_threshold = 0.1

# SANP
dar = pd.read_csv(path_to_DAR_1)
dar_up = dar[(dar['Log2FC']> logFC_threshold)&(dar['FDR']<FDR_threshold)]
dar_down = dar[(dar['Log2FC']< -logFC_threshold)&(dar['FDR']<FDR_threshold)]
print(f'up: {len(dar_up)} regions')
print(f'down: {len(dar_down)} regions')
```

Example 12 (unknown):
```unknown
up: 2197 regions
down: 1183 regions
```

Example 13 (python):
```python
peak_signatures = {}
# up, towards group_a
peak_signatures[f'{group_a}_up'] = list(dar_up['seqnames'].astype('str')+':'+dar_up['start'].astype('str')+'_'+dar_up['end'].astype('str'))
peak_signatures[f'{group_a}_down'] = list(dar_down['seqnames'].astype('str')+':'+dar_down['start'].astype('str')+'_'+dar_down['end'].astype('str'))

print(peak_signatures.keys())

# save
utils.save_pkl(peak_signatures,
           file = f'{working_dir}/outs/peak_signatures.pkl'
          )
```

Example 14 (unknown):
```unknown
dict_keys(['SinoatrialNodeCardiomyocytes_up', 'SinoatrialNodeCardiomyocytes_down'])
```

Example 15 (unknown):
```unknown
f'{working_dir}/outs/peak_signatures.pkl'
```

Example 16 (unknown):
```unknown
'/nfs/team205/heart/Vitro/TF_selection/foetal_SANPcell_vs_workingCM/outs/peak_signatures.pkl'
```

---

## Notebook

**URL:** http://127.0.0.1:9020/notebooks_html/Fig3_SAN_niche/CX3CL1_dotplot.html

**Contents:**
- Function¶
- Read in adata¶
- Check expression of the candidate markers¶

**Examples:**

Example 1 (python):
```python
import scanpy as sc
import pandas as pd
import numpy as np
import anndata

import matplotlib.pyplot as plt
import matplotlib as mpl
# enables correct plotting of text
mpl.rcParams['pdf.fonttype'] = 42
mpl.rcParams['ps.fonttype'] = 42
import seaborn as sns
```

Example 2 (python):
```python
import session_info
session_info.show()
```

Example 3 (python):
```python
-----
anndata             0.9.2
matplotlib          3.7.2
numpy               1.24.4
pandas              1.5.3
scanpy              1.9.3
seaborn             0.12.2
session_info        1.0.0
-----
```

Example 4 (python):
```python
PIL                         10.0.0
anyio                       NA
arrow                       1.2.3
asttokens                   NA
attr                        23.1.0
attrs                       23.1.0
babel                       2.12.1
backcall                    0.2.0
brotli                      1.0.9
certifi                     2023.11.17
cffi                        1.15.1
charset_normalizer          3.2.0
colorama                    0.4.6
comm                        0.1.4
cycler                      0.10.0
cython_runtime              NA
dateutil                    2.8.2
debugpy                     1.6.8
decorator                   5.1.1
defusedxml                  0.7.1
executing                   1.2.0
fastjsonschema              NA
fqdn                        NA
h5py                        3.9.0
idna                        3.4
igraph                      0.10.6
importlib_metadata          NA
importlib_resources         NA
ipykernel                   6.25.1
isoduration                 NA
jedi                        0.19.0
jinja2                      3.1.2
joblib                      1.3.2
json5                       NA
jsonpointer                 2.0
jsonschema                  4.19.0
jsonschema_specifications   NA
jupyter_events              0.7.0
jupyter_server              2.7.1
jupyterlab_server           2.24.0
kiwisolver                  1.4.5
leidenalg                   0.10.1
llvmlite                    0.40.1
markupsafe                  2.1.3
mpl_toolkits                NA
natsort                     8.4.0
nbformat                    5.9.2
numba                       0.57.1
overrides                   NA
packaging                   23.1
parso                       0.8.3
patsy                       0.5.3
pexpect                     4.8.0
pickleshare                 0.7.5
pkg_resources               NA
plotly                      5.16.1
prometheus_client           NA
prompt_toolkit              3.0.39
psutil                      5.9.5
ptyprocess                  0.7.0
pure_eval                   0.2.2
pydev_ipython               NA
pydevconsole                NA
pydevd                      2.9.5
pydevd_file_utils           NA
pydevd_plugins              NA
pydevd_tracing              NA
pygments                    2.16.1
pyparsing                   3.0.9
pythonjsonlogger            NA
pytz                        2023.3
referencing                 NA
requests                    2.31.0
rfc3339_validator           0.1.4
rfc3986_validator           0.1.1
rpds                        NA
ruamel                      NA
scipy                       1.10.1
send2trash                  NA
six                         1.16.0
sklearn                     1.3.0
sniffio                     1.3.0
socks                       1.7.1
sphinxcontrib               NA
stack_data                  0.6.2
statsmodels                 0.14.0
texttable                   1.6.7
threadpoolctl               3.2.0
tornado                     6.3.3
traitlets                   5.9.0
typing_extensions           NA
uri_template                NA
urllib3                     2.0.4
wcwidth                     0.2.6
webcolors                   1.13
websocket                   1.6.2
yaml                        6.0.1
zipp                        NA
zmq                         25.1.1
zstandard                   0.19.0
```

Example 5 (unknown):
```unknown
-----
IPython             8.12.0
jupyter_client      8.3.0
jupyter_core        4.12.0
jupyterlab          4.0.5
notebook            7.0.2
-----
Python 3.8.17 (default, Jul  5 2023, 21:04:15) [GCC 11.2.0]
Linux-5.4.0-169-generic-x86_64-with-glibc2.17
-----
Session information updated at 2024-02-12 09:08
```

Example 6 (python):
```python
import importlib.util
import sys
spec = importlib.util.spec_from_file_location("module.name", "/nfs/team205/kk18/function/python/utils.py")
utils = importlib.util.module_from_spec(spec)
sys.modules["module.name"] = utils
spec.loader.exec_module(utils)
```

Example 7 (python):
```python
sc.settings.set_figure_params(dpi=120)
```

Example 8 (python):
```python
# Parameters
path_to_adata_gex = "/nfs/team205/heart/anndata_objects/Foetal/Feb28ObjectRaw.h5ad"
figdir = '/nfs/team205/heart/fetal_ms_figures/raw_plots_kk'
```

Example 9 (python):
```python
adata = sc.read_h5ad(path_to_adata_gex)
# filter and log normalise
# filter
sc.pp.filter_genes(adata, min_cells=3)

# log normalise
sc.pp.normalize_total(adata, target_sum=1e4)
sc.pp.log1p(adata)
print(adata.X.data[:10])
```

Example 10 (unknown):
```unknown
[0.09802545 0.09802545 0.41538525 0.41538525 0.6009918  0.34498122
 0.8496726  0.34498122 0.2692425  0.09802545]
```

Example 11 (python):
```python
adata.obs['cell_or_nuclei'].value_counts()
```

Example 12 (unknown):
```unknown
nuclei    211145
cell       86328
Name: cell_or_nuclei, dtype: int64
```

Example 13 (python):
```python
markers = ['CX3CL1']

sc.pl.dotplot(adata, 
             markers, 
              groupby='fine_grain',
              dendrogram=False,
              standard_scale="var",
              color_map="Reds",
              swap_axes=True,
              show=False
             )
plt.savefig(f'{figdir}/CX3CL1_expression_dotplot.pdf',bbox_inches="tight",dpi=300)
plt.show()
```

Example 14 (unknown):
```unknown
/nfs/team205/kk18/miniconda3/envs/vitro/lib/python3.8/site-packages/scanpy/plotting/_dotplot.py:749: UserWarning: No data for colormapping provided via 'c'. Parameters 'cmap', 'norm' will be ignored
  dot_ax.scatter(x, y, **kwds)
```

Example 15 (python):
```python
# only multiome
# just checking whether the result is similar
markers = ['CX3CL1']

sc.pl.dotplot(adata[adata.obs['kit_10x']=='Multiome-v1'], 
             markers, 
              groupby='fine_grain',
              dendrogram=False,
              standard_scale="var",
              color_map="Reds",
              swap_axes=True,
              # return_fig=True
             )
```

Example 16 (unknown):
```unknown
/nfs/team205/kk18/miniconda3/envs/vitro/lib/python3.8/site-packages/scanpy/plotting/_dotplot.py:749: UserWarning: No data for colormapping provided via 'c'. Parameters 'cmap', 'norm' will be ignored
  dot_ax.scatter(x, y, **kwds)
```

---
