Skip to content

SCZ - ceRNA-axis correlation analysis for a cohort

ceRNA-axis correlation analysis for a cohort

%load_ext autoreload

# Just download the github, and load the cernaxis into python path
# do
import sys
sys.path.append('../../')

# or install cernaxis by pip
#!pip install git+https://github.com/compbioclub/cernaxis.git@v1_as

from cernaxis.cernaxis import ceRNAxis

# initialize cernaxis object
cernaxis = ceRNAxis()

Load the SCZ data

%autoreload

import scanpy as sc
import anndata as ad

lncRNA_adata = sc.read_h5ad('../../demo/SCZ_lncRNA.h5ad')
lncRNA_adata.var_names_make_unique()

miRNA_adata = sc.read_h5ad('../../demo/SCZ_miRNA.h5ad')
miRNA_adata.var_names_make_unique()

mRNA_adata = sc.read_h5ad('../../demo/SCZ_mRNA.h5ad')
mRNA_adata.var_names_make_unique()

adata = ad.concat([mRNA_adata, miRNA_adata, lncRNA_adata], axis=1)
adata.obs = mRNA_adata.obs
adata.layers['count'] = adata.X
adata
C:\Users\User\AppData\Roaming\Python\Python312\site-packages\anndata\_core\anndata.py:1758: UserWarning: Variable names are not unique. To make them unique, call `.var_names_make_unique`.
  utils.warn_names_duplicates("var")

AnnData object with n_obs × n_vars = 11 × 80573
    obs: 'type'
    layers: 'count'

Calculate the correlation of ceRNA axis

%autoreload

import anndata as ad
# merge the mRNA, miRNA, and lncRNA expression profiles
adata = ad.concat([mRNA_adata.T, miRNA_adata.T, lncRNA_adata.T], merge="same").T
# set the interested ceRNA axis 
ceRNA_axis_list = [('ARHGAP8', 'hsa-miR-485-5p'), ('ARHGAP8', 'ENST00000522525'), ('hsa-miR-485-5p', 'ENST00000522525')]
# calculate the correlation
corr_df = cernaxis.cohort_ceRNA_corr(adata, ceRNA_axis_list)
corr_df.to_csv('../../demo_out/SCZ_axis_correlation.csv')
# output correlation
corr_df
patient gene1 gene2 correlation type correlation p value
0 All ARHGAP8 hsa-miR-485-5p Pearson Correlation -0.306925 0.358586
1 All ARHGAP8 hsa-miR-485-5p Spearman Correlation -0.353139 0.286743
2 All ARHGAP8 hsa-miR-485-5p Kendall's tau -0.288960 0.266716
3 All ARHGAP8 ENST00000522525 Pearson Correlation 0.125301 0.713554
4 All ARHGAP8 ENST00000522525 Spearman Correlation 0.316645 0.342765
5 All ARHGAP8 ENST00000522525 Kendall's tau 0.255377 0.350808
6 All hsa-miR-485-5p ENST00000522525 Pearson Correlation -0.301535 0.367519
7 All hsa-miR-485-5p ENST00000522525 Spearman Correlation -0.601782 0.050138
8 All hsa-miR-485-5p ENST00000522525 Kendall's tau -0.522233 0.057589