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
168 stars 45 forks source link

h5Seurat format #117

Open wajm opened 3 years ago

wajm commented 3 years ago

Hi, is it possible to use h5Seurat format converted by SeuratDisk in STREAM? https://mojaveazure.github.io/seurat-disk/articles/convert-anndata.html

My data is integrated seurat object.

wajm commented 3 years ago

for using seurat object, STREAM had suggested loomR conversion in seurat. however now loomR using seurat-disk, all setting is change.

wajm commented 3 years ago

Okay, I've tried this. and working like previous #100 setting. but I'm not sure this is correct or not. Please check this.

patient object is subset of original my data and performed "FindVariableFeatures", "ScaleData" after subsetting.

library(Seurat) library(SeuratDisk) SaveH5Seurat(patient, filename = "patient.h5Seurat") Convert("patient.h5Seurat", dest = "h5ad")

in STREAM:

adata = ad.read_h5ad("patient.h5ad") st.set_workdir(adata,'result') st.add_metadata(adata,file_name='metadata.txt')

adata.obsm['top_pcs'] = adata.obsm['X_pca'] adata.obsm['X_dr'] = adata.obsm['X_umap'] adata.obsm['X_vis_umap'] = adata.obsm['X_umap']

then I can either learn graphical structure directly on UMAP from seurat:

st.plot_visualization_2D(adata,method='umap',n_neighbors=50,color=['label'],use_precomputed=True,fig_size=[11,9]) st.seed_elastic_principal_graph(adata,n_clusters=100,use_vis=True) st.elastic_principal_graph(adata,epg_alpha=0.01,epg_mu=0.2,epg_lambda=0.01,n_jobs=4)

huidongchen commented 3 years ago

Sorry about the delay. Thanks very much for the feedback and solution. This looks all right to me. I would suggest lowering n_clusters though (a reasonable range would be 5~20 for it)

We are currently working on STREAM2 and making STREAM compatible with other single-cell analysis is one big part of it. Hope that our STREAM2 will facilitate the conversion between different file formats. Stay tuned!

wajm commented 2 years ago

I'm realized an issue.

in STREAM: adata = ad.read_h5ad("patient.h5ad") st.set_workdir(adata,'result') st.add_metadata(adata,file_name='metadata.txt')

adata.obsm['top_pcs'] = adata.obsm['X_pca'] adata.obsm['X_dr'] = adata.obsm['X_umap'] adata.obsm['X_vis_umap'] = adata.obsm['X_umap']

For my integration Seurat object, upper code in STREAM was used. but I've got partial data from seurat object.

Please check whether the upper setting is correct.

huidongchen commented 2 years ago

Hi, the setting looks all right to me. It seems the same as the code you shared previously though. I am not sure what the problem here is.

wajm commented 2 years ago

Hi, the setting looks all right to me. It seems the same as the code you shared previously though. I am not sure what the problem here is.

hmmm. My integrated Seruat object lost many cells in subway plot and flat tree plot. Thanks.

wajm commented 2 years ago

AnnData object with n_obs × n_vars = 11826 × 2000 obs: 'label', 'label_color' var: 'features' uns: 'workdir', 'label_color' obsm: 'X_pca', 'X_umap', 'top_pcs', 'X_dr', 'X_vis_umap' varm: 'PCs'

in my data, n_vars is only 2000. I think that is problem.

huidongchen commented 2 years ago

I don't think the number of features should be a problem.

I am not sure why cells are missing in those plots, which is something new to me. It would be helpful if you can share with me a notebook to reproduce the issue. Give such information, unfortunately i can not help much.