GRnnData works similarly to anndata. The goal was to use the .varm/.varp of anndata to store the GRN data associated with a dataset and have a formal way to work with GRNs.
GRnnData is a subclass of anndata.AnnData, it enforces only that a .varp exists for the anndata
GRnnData also contains multiple helper functions to work with GRNs in scRNAseq like compute_connectivities, get_centrality, compute_cluster, enrichment, metrics, etc. but also accessing the grn with .grn, .targets, .regulators,...
The package has been designed together with the scPRINT paper and model, and the GRN benchmarking tool BenGRN
pip install grnndata
git clone https://github.com/cantinilab/GRnnData.git
pip install -e GRnnData
from grnndata import GRNAnnData, read_h5ad
from grnndata import utils
grn = np.random.rand(10,10)
adata = anndata.AnnData(X=np.random.rand(10,10))
grn = GRNAnnData(adata, grn=grn)
print(grn) #shows the number of elements
grn.varp['GRN'] or grn.grn #shows the GRN
subgrn = grn.get(['gene1', 'gene2']) #only gets some elements from the GRN
subgrn.targets #shows the target connections
subgrn.plot() # displays the network
subgrn.write_h5ad('grn.h5ad') #writes it
read_h5ad('grn.h5ad') #reads it
# or use some utils functions like:
# compute_connectivities
# get_centrality
# compute_cluster
# enrichment
# metrics
# see more in the documentation
utils.some_function(grn)
GRnnData works similarly to anndata. Learn more about usages in the documentation and its notebooks in the docs.
usage examples can be seen in the example notebooks of:
In this context, we recommend creating a grnndata per cell type. This will allow you to store the GRN data in the .varm of the grnndata and have a formal way to work with GRNs.
In this context, we recommend trying to merge them across a similar group of cells in some way and storing uncertainty or variance in the GRN and then creating a grnndata across this group of cells
Read the CONTRIBUTING.md file.
Awesome gene regulatory network enhanced anndata created by @jkobject and @r-trimbour