Comments (5)
Hi @daixinap,
Thank you for your interest in Tangram! We're glad you like it! You should be able to map snATAC-seq with spatial data as follows:
- Compute mapping anndata using RNA-seq data and spatial data, once you pre-process both data like in the tutorial:
ad_map = tg.map_cells_to_space(
adata_sc=ad_sc, #scRNA-seq
adata_sp=ad_sp, #spatial data
device='cuda:0',
)
- To visualize spatial patterns of chromatin accessibility with respect to cell types, you can do:
#use cell type label name in your data as annotation to project annotations
tg.project_cell_annotations(ad_map, ad_sp, annotation='cell-type_label')
annotation_list = list(pd.unique(ad_atac.obs['cell-type_label']))
tg.plot_cell_annotation_sc(ad_sp, annotation_list,x='x', y='y',spot_size= 60, perc=0.001)
Let me know if this solution helped solve your issue! I'd be happy to help otherwise.
Edit: Added changes per suggestions below i.e., align with RNA-Seq data and project ATAC-seq data over space.
from tangram.
Hi @gaddamshreya,
Thanks very much for your prompt reply! I downloaded the multimodal scATAC-seq data to map and the result is very great. Since there is no annotated information, I have drawn some specific transcription factors (chromatin accessibility and motif scores). I would like to know why you only emphasize the use of multimodal data (SHARE-seq) in your published paper. I think scATAC-seq data can be used to map even if there is no corresponding scRNA-seq data.
Your kind help and swift reply is highly appreciated.
from tangram.
Mh - I am a bit confused about what is happening.
When you map, you don't want to align the single cell ATAC-seq data with the spatial RNA data, because the signals are different. What Tangram does, is to align data from the same modality, for example, RNA from single cells with RNA on the spatial data.
If your single cell data are multi-modal (like SHARE-seq, where you measure RNA and ATAC), once you map RNA using map_cell_to_space
you can then transfer the other mode (eg ATAC) to space using project_cell_annotations
.
I am not exactly sure what your figures are showing (even though the look pretty :)): it is possible that you are visualizing gene expression. If you walk me through your example by pasting code, I'll help.
from tangram.
Thank you for your prompt reply. According to gaddamshreya‘s suggestion before editing, I mapped motif score matrix with spatial data directly (so as gene scores). According to the new suggestions I tried to map RNA and then transfer ATAC, but It looks like the results were wrong.
In addition to the spatial pattern of ATAC cell types, I also need to plot spatial patterns of transcription factor motif scores (calculated by R package chromVAR).
Here is code that I mapped motif score matrix with spatial data directly:
path = os.path.join('sp.h5ad')
ad_sp = sc.read_h5ad(path)
path = os.path.join('chromvar.h5ad')
ad_sc = sc.read_h5ad(path)
markers = list(ad_sc.var_names) # use all 746 TF motifs
tg.pp_adatas(ad_sc, ad_sp, genes=markers)
assert ad_sc.uns['training_genes'] == ad_sp.uns['training_genes']
ad_map = tg.map_cells_to_space(
adata_sc=ad_sc,
adata_sp=ad_sp,
device='cpu',
#device='cuda:0',
)
ad_ge = tg.project_genes(adata_map=ad_map, adata_sc=ad_sc)
genes = ['sox2', 'dlx1', 'lhx2', 'emx1']
ad_map.uns['train_genes_df'].loc[genes]
tg.plot_genes_sc(genes, adata_measured=ad_sp, adata_predicted=ad_ge, spot_size=1.5, perc = 0.001, return_figure=False)
plt.savefig('marTF_chromvar.png')
Here is code that I mapped RNA and then transfer ATAC:
path = os.path.join('sp.h5ad')
ad_sp = sc.read_h5ad(path)
path = os.path.join('multiModal_rna.h5ad')
ad_sc = sc.read_h5ad(path)
path = os.path.join('chromvar.h5ad')
ad_atac = sc.read_h5ad(path)
df_genes = pd.read_csv('markers.csv', index_col=0)
markers = np.reshape(df_genes.values, (-1, )) # 553 marker genes
tg.pp_adatas(ad_sc, ad_sp, genes=markers)
assert ad_sc.uns['training_genes'] == ad_sp.uns['training_genes']
ad_map = tg.map_cells_to_space(
adata_sc=ad_sc,
adata_sp=ad_sp,
device='cpu',
#device='cuda:0',
)
ad_ge = tg.project_genes(adata_map=ad_map, adata_sc=ad_atac) # ATAC and RNA data have the same obs_names
genes = ['sox2', 'dlx1', 'lhx2', 'emx1']
ad_map.uns['train_genes_df'].loc[genes]
tg.plot_genes_sc(genes, adata_measured=ad_sp, adata_predicted=ad_ge, spot_size=1.5, perc = 0.001, return_figure=False)
plt.savefig('multiModal_marTF_chromvar.png')
Your kind help and swift reply is highly appreciated.
from tangram.
Here is result that I mapped RNA and then transfer ATAC (motif scores):
from tangram.
Related Issues (20)
- Possible to use multiple single cell datasets in Tangram? HOT 3
- Cannot find correspondence of the input data HOT 1
- question about training genes HOT 1
- Some questions about best practices HOT 1
- Attribute error : module 'tangram' has no attribute 'map_cells_to_space' HOT 2
- scRNAseq cells < spatial cells, curious about how mapping works HOT 3
- Unexpected behaviour HOT 1
- Question about acceptable AUC, improving AUC HOT 1
- potential overfitting HOT 5
- Interpretation of tangram_ct_pred HOT 2
- Option "enforce gene lowercase" HOT 1
- error when sq.im.segment
- Tangram Deconvolution HOT 1
- Using Integrated single cell data for alignment
- AttributeError: module 'tangram' has no attribute 'pp_adatas'
- Sparsity_sc and sparsity_sp = 0
- Please explain `project_cell_annotations`
- Running time for Tangram
- plot_auc does not work HOT 2
- Possible mistakes in the "Tangram under the hood" page in documentation website
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from tangram.