zhengrongbin / MEBOCOST

A python-based package and software to predict metabolite mediated cell-cell communications by single-cell RNA-seq data
BSD 3-Clause "New" or "Revised" License
59 stars 10 forks source link

Different results by the same codes and data #1

Closed DrZGQ37 closed 2 years ago

DrZGQ37 commented 2 years ago

Dear Dr Zheng, Thank you for your sharing the MEBOCOST. I downloaded the demo data: demo_HNSC_200cell.h5ad and run the codes from your github in my Jupyter lab, however, I am confused that the different results were seen by the demo data and the same codes as your uploaded. see as follows: 图片. Futhermore, mebo_obj.commu_network_plot was showed only one network: malignant-malignant. 图片

Thank you. Looking forward to your reply.

zhengrongbin commented 2 years ago

Hi, thanks for your interest in MEBOCOST, and thank you for pointing out this problem. We are sorry that we forgot to update the tutorial notebook. The previous notebook was an old one of our testing. We have updated, and the new notebook has been uploaded, you can try it again. Basically, there is a parameter "min_cell_number" that should be set to 1. This is to exclude cell groups if the cell number is not enough for that cell group, by default is 50. As the demo data is faked and only 200 cells in total, so 50 for min_cell_number is too high. That's why you only see Malignant cells retained. Since this demo data is from a head and neck tumor sample, malignant cells are the most abundant cell group. For your own scRNA-seq data, you can decide the value of min_cell_number by yourself. Please let new know if you have any more questions. Thank you!

DrZGQ37 commented 2 years ago

Thank you for your reply. I have tried the updated codes again and all results were were well showed. However, I only skipped the codes: commu_res = mebo_obj.infer_commu( n_shuffle=1000, seed=12345, Return=True, thread=None, save_permuation=False, min_cell_number = 1 )

the results can be seen, while I run this codes as you mentioned that there is a parameter "min_cell_number" that should be set to 1. The errors happens, see as follows: 图片 Secondly, I run the MEBOCOST for my own scRNA-data, I changed my seurat object (.rds) into .h5ad by using the code: library(Seurat) library(SeuratDisk) file <- readRDS('scRNAsub.rds') colnames(file@meta.data) main.loom <- as.loom(x = file, filename = "main.loom", verbose = FALSE) write.csv(file@meta.data,'mian.csv') python import scanpy as sc import pandas as pd import loompy adata = sc.read_loom("main.loom", sparse=True, cleanup=False, X_name='spliced', obs_names='CellID', var_names='Gene', dtype='float32') obs= pd.read_csv('mian.csv',delimiter=',', index_col=0) adata.obs = obs adata.write('main.h5ad')

and run sc.read_h5ad in jupyter lab, however, the errors happens: 图片 so I am wondering what the data structure that MEBOCOST required and whehter this is right when I changed my seurat object (.rds) into .h5ad ? Thank you for your reply again and look forward to your response.

zhengrongbin commented 2 years ago

Hi - Thank you for the question!

For your first question. As I updated the script to adapt ”min_cell_number” parameter, otherwise, by default it was set to 50. So, could you please re-install MEBOCOST by: git clone https://github.com/zhengrongbin/MEBOCOST.git https://github.com/zhengrongbin/MEBOCOST.git && cd MEBOCOST && python setup.py install For your second question, I think it is the h5ad data structure problem, because you even cannot load data by read_h5ad in scanpy. In this case, in order to run MEBOCOST, you can save expression matrix and meta data out from seurat, then read into python by pandas, lastly you can pass the two to MEBOCOST by exp_mat and cell_ann parameters.

Best, Rongbin

On Jun 1, 2022, at 11:16 PM, Guiqi Zhu @.***> wrote:

Thank you for your reply. I have tried the updated codes again and all results were were well showed. However, I only skipped the codes: commu_res = mebo_obj.infer_commu( n_shuffle=1000, seed=12345, Return=True, thread=None, save_permuation=False, min_cell_number = 1 )

the results can be seen, while I run this codes as you mentioned that there is a parameter "min_cell_number" that should be set to 1. The errors happens, see as follows: https://user-images.githubusercontent.com/92598168/171538017-a4b0a781-abc4-48cf-b85f-a83ed79d9a75.png Secondly, I run the MEBOCOST for my own scRNA-data, I changed my seurat object (.rds) into .h5ad by using the code: library(Seurat) library(SeuratDisk) file <- readRDS('scRNAsub.rds') @. @.>) main.loom <- as.loom(x = file, filename = "main.loom", verbose = FALSE) @. @.>,'mian.csv') python import scanpy as sc import pandas as pd import loompy adata = sc.read_loom("main.loom", sparse=True, cleanup=False, X_name='spliced', obs_names='CellID', var_names='Gene', dtype='float32') obs= pd.read_csv('mian.csv',delimiter=',', index_col=0) adata.obs = obs adata.write('main.h5ad')

and run sc.read_h5ad in jupyter lab, however, the errors happens: https://user-images.githubusercontent.com/92598168/171544811-554f523d-5469-4b69-ba1a-1d792650bbbe.png so I am wondering what the data structure that MEBOCOST required and whehter this is right when I changed my seurat object (.rds) into .h5ad ? Thank you for your reply again and look forward to your response.

— Reply to this email directly, view it on GitHub https://github.com/zhengrongbin/MEBOCOST/issues/1#issuecomment-1144389541, or unsubscribe https://github.com/notifications/unsubscribe-auth/AD76SHJIP2WZC4UNYWEZ5FTVNARP5ANCNFSM5XRR7ADA. You are receiving this because you commented.

DrZGQ37 commented 2 years ago

Dear Rongbin, Thank you for your reply. All problems have been addressed and MEBOCOST also runs well for my own scRNA data. Thank you again for the MEBOCOST that you have developed.

Best, Guiqi

zhengrongbin commented 2 years ago

Great! Hope you can find something interesting by applying MEBOCOST to your scRNA-seq data.