pinellolab / STREAM

STREAM: Single-cell Trajectories Reconstruction, Exploration And Mapping of single-cell data
http://stream.pinellolab.org
GNU Affero General Public License v3.0
173 stars 48 forks source link

Mapping feature using scATAC-seq data #61

Open carmenpetitjean opened 4 years ago

carmenpetitjean commented 4 years ago

Hello,

I have been trying to use the mapping feature on two different scATAC-seq datasets. Both are able to infer trajectories individually. However, when trying to use the mapping feature (with the lines "st.plot_visualization_2D(adata,adata_new,nb_pct=0.8,use_precomputed=False)" and "st.subwaymap_plot(adata,adata_new=adata_new,percentile_dist=100,root='S5',fig_legend_ncol=6,preference=['S2','S1','S4']) " I get the error: "NotImplementedError: Equality comparisons are not supported for AnnData objects, instead compare the desired attributes."
I tried following the tutorial for the mapping features while still making the necessary changes for it to work on scATAC-seq, and I am not sure why this error might have occured.

Thank you!

huidongchen commented 4 years ago

Hi

Thanking for trying STREAM. Were you able to finish the mapping step? Does this error only happen when visualizing the results?

carmenpetitjean commented 4 years ago

Hi,

"st.map_new_data" does not seem to produce any error. The error only seems to happen when trying to visualise the results.

mapping

huidongchen commented 4 years ago

Hi I tested it on the example dataset shown in Github using 'top_pcs' as the feature for mapping. It doesn't seem that i see any errors. Would you mind sharing a minimum script to reproduce your errors? I am happy to look into it.

carmenpetitjean commented 4 years ago

Hello,

I first use my own dataset to infer a trajectory. These lines don't produce errors, and I can visualise all plots including the subwaymap plot.

import stream as st adata = st.read(file_name='/rds/general/user/cpp17/projects/lms-spivakov-analysis/live/Carmen/STREAM/scATAC_taster/zscores_scaled.tsv.gz',experiment='atac-seq') st.add_cell_labels(adata) st.add_cell_colors(adata) st.select_top_principal_components(adata) st.dimension_reduction(adata,feature='top_pcs',n_components=4)

... and I continue closely following the scATAC-seq (using kmers) tutorial

I then try and use the tutorial data to map on the previously inferred trajectory:

Adding the tutorial data for reference

adata_new=st.read(file_name='/rds/general/user/cpp17/home/CarmenProject/Testing_Stream/scATAC_test_data/zscores_scaled.tsv.gz',experiment='atac-seq',workdir='./result_mapping/') st.add_cell_labels(adata_new,file_name='/rds/general/user/cpp17/home/CarmenProject/Testing_Stream/scATAC_test_data/cell_label.tsv.gz') st.add_cell_colors(adata_new,file_name='/rds/general/user/cpp17/home/CarmenProject/Testing_Stream/scATAC_test_data/cell_label_color.tsv.gz') st.select_top_principal_components(adata_new) st.dimension_reduction(adata_new,feature='top_pcs',n_components=4) st.map_new_data(adata,adata_new, feature='top_pcs', method='trans_umap')

And these following lines produce the same error: "NotImplementedError: Equality comparisons are not supported for AnnData objects, instead compare the desired attributes."

st.plot_visualization_2D(adata,adata_new,nb_pct=0.8,use_precomputed=False) st.subwaymap_plot(adata,adata_new=adata_new,percentile_dist=100,root='S5',fig_legend_ncol=6,preference=['S2','S1','S4'])

Thank you!

huidongchen commented 4 years ago

Once you have the reference trajectory, to map new dataset to it, you should simply run:

adata_new=st.read(file_name='/rds/general/user/cpp17/home/CarmenProject/Testing_Stream/scATAC_test_data/zscores_scaled.tsv.gz',experiment='atac-seq',workdir='./result_mapping/')
st.add_cell_labels(adata_new,file_name='/rds/general/user/cpp17/home/CarmenProject/Testing_Stream/scATAC_test_data/cell_label.tsv.gz')
st.add_cell_colors(adata_new,file_name='/rds/general/user/cpp17/home/CarmenProject/Testing_Stream/scATAC_test_data/cell_label_color.tsv.gz')
st.map_new_data(adata,adata_new, feature='top_pcs', method='umap')

The current steps you are implementing and also the parameter method in st.map_new_data don't seem correct. (We will improve exception handling on our end. trans_umap is apparently wrong)