wanglab-broad / CAST

CAST package
MIT License
23 stars 3 forks source link

Alignment of spatially resolved multi-omics with non-overlaping variables #10

Closed OMIC-coding closed 1 week ago

OMIC-coding commented 1 week ago

Excellent work, there's no doubt that CAST would be applied in various spatially resolved multi-omics data analysis tasks. However, I wanted to know if conducting an alignment between MALDI-MSI and Visium data using CAST is possible, as these two modalities don't share any common variables. Thanks a lot!

luosc commented 1 week ago

Thank you for the note. My short answer is that I do not know. You are welcome to test CAST on your data. We are excited to see if it eventually works. I am happy to assist if you encounter any technical issues in this process. Our self-supervised learning scheme and models have succeeded with integrating translatome and transcriptome, we really wanted to test proteomics with transcriptomics and optimize based on that, but we did not have such data by the date of paper acceptance. In my recent review paper, I also mentioned that a common challenge in the field is dealing with weakly linked modalities. It is almost non-quantitative how robust the batch correction effects could be for a self supervised learning model. Alternatively, you can supply it with human input and expertise, e.g. a curated low-dimensional embedding that you see better correspondence between these modalities. We encourage users to test CAST using integrated embeddings (output from single-cell integration methods) instead of raw counts to see how it goes.

OMIC-coding commented 6 days ago

Thank you for your reply. We performed MALDI-MSI-based spatial metabolomic (not proteomic) sequencing on serial sections from the same FFPE block used for Visium-based spatial transcriptomic sequencing. Is the algorithm compatible with this type of task? Could I simply apply the steps that were conducted when doing the alignment between STARmap and MERFISH demonstrated on one section of your uploaded tutorial?

OMIC-coding commented 5 days ago

RuntimeError Traceback (most recent call last) Cell In[74], line 7 3 from CAST import CAST_MARK 4 from CAST.visualize import kmeans_plot_multiple ----> 7 embed_dict = CAST_MARK(coords_sub, exp_sub, output_path, graph_strategy='delaunay') 8 kmeans_plot_multiple(embed_dict, ['MALDI-MSI', 'Visium'], coords_sub, 'MASH-1494', output_path, k= 8, dot_size = 2, minibatch=True)

File ~/miniconda3/envs/cast_demo/lib/python3.9/site-packages/CAST/main.py:46, in CAST_MARK(coords_raw_t, exp_dict_t, output_path_t, task_name_t, gpu_t, args, epoch_t, if_plot, graph_strategy) 44 ### Training 45 print(f'Training on {args.device}...') ---> 46 embed_dict, loss_log, model = train_seq(graphs=inputs, args=args, dump_epoch_list=[], out_prefix=f'{output_path_t}/{task_name_t}_seq_train', model=model) 48 ### Saving the results 49 torch.save(embed_dict, f'{output_path_t}/demo_embed_dict.pt')

File ~/miniconda3/envs/cast_demo/lib/python3.9/site-packages/CAST/CAST_Mark.py:54, in train_seq(graphs, args, dump_epoch_list, out_prefix, model) 52 with torch.no_grad(): 53 N = graph_.number_of_nodes() ---> 54 graph1, feat1 = randomaug(graph, feat_, args.dfr, args.der) 55 graph2, feat2 = randomaug(graph, feat_, args.dfr, args.der) 57 graph1 = graph1.add_self_loop()

File ~/miniconda3/envs/cast_demo/lib/python3.9/site-packages/CAST/models/aug.py:48, in random_aug(graph, x, feat_drop_rate, edge_mask_rate) 45 feat = drop_feature(feat, feat_drop_rate) 47 ng = dgl.graph([], device=graph.device) ... File ~/miniconda3/envs/cast_demo/lib/python3.9/site-packages/dgl/backend/pytorch/tensor.py:338, in zerocopy_from_numpy(np_array) 337 def zerocopy_from_numpy(np_array): --> 338 return th.as_tensor(np_array)

RuntimeError: Could not infer dtype of numpy.int64 97826d6a39dc2dd0b9f71fd08bf0721e 6316c161497c6b378a3e58ebabece012