TencentAILabHealthcare / scTranslator

31 stars 6 forks source link

basic workflow with own data #1

Closed shobhitagrawal1 closed 4 months ago

shobhitagrawal1 commented 1 year ago

Hi, Thanks for developing this really interesting methodology. Would it possible to give us a short tutorial on how to use one's own single cell RNA seq data for protein prediction? Current demos are only on the demo data which already has the protein output or requires files which are not available. Thanks once again

ElaineLIU-920 commented 10 months ago

Thank you for your interest in our work and for raising this important question. I realize that our scTranslator is not user-friendly enough, as we only demonstrate how to save evaluation model prediction accuracy results in demo 6, but do not return the predicted proteins. I will address this issue in the next version iteration, but if you want to try it now, please follow these steps:

  1. Prepare the RNA h5ad file and a protein h5ad file with the same number of cells as the RNA. Please note that the abundance matrix in the protein.h5ad file can be arbitrary values, as it will not be involved in subsequent calculations. Instead, what is needed are its obs and var.my_ID. The protein var.my_ID here is the gene ID of the protein you want to predict, but we have matched it from the Hugo_ID to my_ID. For the specific matching file, please refer to the query_protein_ID.csv in https://drive.google.com/drive/folders/1NjgCHDRGka5zLmSfuHQwvIVJ6ErU07sx.
  2. Modify the def test(model, device, test_loader) function in scTranslator/code/model/utils.py. The y_hat[pro_mask] here is actually the predicted protein. You need to combine the proteins of each batch and return the entire predicted protein.
  3. Modify the test_loss, test_ccc = test(model, device, test_loader) in scTranslator code/stage3_inference_without_finetune.py to test_loss, test_ccc, y_hat = test(model, device, test_loader), depending on what you changed in step 2. Save y_hat to obtain the prediction results.
shobhitagrawal1 commented 9 months ago

thanks for the reply! appreciate it. Will try with your recommendations and get back to you.