Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issues and Suggestions for Malignant Cell Fraction Analysis #38

Open
bhyu0217 opened this issue Nov 26, 2024 · 4 comments
Open

Issues and Suggestions for Malignant Cell Fraction Analysis #38

bhyu0217 opened this issue Nov 26, 2024 · 4 comments

Comments

@bhyu0217
Copy link

bhyu0217 commented Nov 26, 2024

Hello,

Thank you so much for developing the fascinating tool, which has been incredibly useful for my research!

I am inferring malignant cell fractions through CNV and then performing deconvolution on the non-malignant fraction using matched sc/snRNA-seq data.
However, I seem to encounter errors in downstream analyses due to the absence of a reference profile for malignant in the SpaCET object.

Here is the error I encountered during the analysis:

SpaCET_obj <- SpaCET.deconvolution.matched.scRNAseq( spatial.obj, sc_includeMalignant = FALSE, cancerType = "GBM", sc_counts = sc_counts, sc_annotation = sc_annotation, sc_lineageTree = sc_lineageTree, sc_nCellEachLineage = 100, coreNo = 8 )

SpaCET_obj <- SpaCET.deconvolution.malignant(SpaCET_obj, Malignant = "Malignant", malignantCutoff = 0.7, coreNo = 8)

[1] "Identify 2 malignant cell states" Error in Ref$refProfiles[, knownCellTypes] : subscript out of bounds In addition: Warning messages: 1: Zero sample variances detected, have been offset away from zero 2: Zero sample variances detected, have been offset away from zero

I noticed that applying SpaCET_obj@results$deconvolution$Ref <- NULL allows the function to run, but it results in an error where all spots (including non-malignant spots) are classified into cancer cell states.

Additionally, during colocalization analysis, the "reference_rho" and "reference_pv" values associated with "malignant" are displayed as "NA" values.

SpaCET_obj <- SpaCET.CCI.colocalization(SpaCET_obj)

SpaCET_obj@results$CCI
$colocalization
cell_type_1 cell_type_2 fraction_product fraction_rho
Glial_Malignant Glial Malignant 2.510831e-02 -0.103
Vascular_Malignant Vascular Malignant 1.556394e-01 -0.702
Neuronal_Malignant Neuronal Malignant 3.049182e-02 0.001
Immune_Malignant Immune Malignant 3.716447e-02 -0.319
Astro_Malignant Astro Malignant 1.483616e-02 -0.071
Oligo_Malignant Oligo Malignant 9.181587e-03 -0.151
OPC_Malignant OPC Malignant 9.329728e-04 0.057
Endo_Malignant Endo Malignant 4.534058e-02 -0.596

fraction_pv reference_rho reference_pv
Glial_Malignant 7.997172e-05 NA NA
Vascular_Malignant 7.822941e-218 NA NA
Neuronal_Malignant 9.616220e-01 NA NA
Immune_Malignant 4.353278e-36 NA NA
Astro_Malignant 6.225376e-03 NA NA
Oligo_Malignant 5.837621e-09 NA NA
OPC_Malignant 2.986717e-02 NA NA
Endo_Malignant 1.141059e-141 NA NA

I also wanted to ask if it might be possible to implement a function that allows the deconvolution of malignant spots using malignant cell states defined in the matched sc/snRNA-seq data after inferring malignant fractions using CNV.
If this is available, it would make it much easier to directly apply cancer cell states established in matched sc/snRNA-seq data to the spatial level.

Thank you for your time and support.

@beibeiru
Copy link
Collaborator

Hi, @bhyu0217 ,

We are delighted that our tool can help you with your studies!

I also wanted to ask if it might be possible to implement a function that allows the deconvolution of malignant spots using malignant cell states defined in the matched sc/snRNA-seq data after inferring malignant fractions using CNV.

Do you mean your single-cell data includes malignant cells? If yes, you can set sc_includeMalignant=TRUE to skip inferring malignant fractions using CNV, and decovolve directly with your matched reference, just like https://data2intelligence.github.io/SpaCET/articles/oldST_PDAC.html.

If I misunderstand you or the previous method does not work, please share your spatial.obj, sc_counts, sc_annotation, and sc_lineageTree with me. I will fix it soon.

Best,
Beibei

@bhyu0217
Copy link
Author

bhyu0217 commented Nov 27, 2024

Hi @beibeiru,

Thank you for your quick and thoughtful response.
I apologize if my question was unclear.

After inferring malignant cell fractions using CNV, for spots where the malignant fraction exceeds a certain threshold (e.g., > 0.7), I would like to perform deconvolution of malignant fractions using the matched single-cell data.

For example, if my single-cell data defines multiple malignant states such as "Malignant A", "Malignant B", and "Malignant C", I'd like to deconvolve these states within the malignant spots inferred by CNV.

CNV-based malignant fraction inference -> malignant state deconvolution using matched single-cell data
(similar to how normal cell fractions are deconvolved into major lineages and sub-lineages)

I have tried using sc_includeMalignant=TRUE for malignant cell deconvolution, as you suggested, but in my datasets, starting with CNV-based malignant fraction inference appears to yield more accurate results.

Does this clarify my question?
Thank you.

Best,
Bohyeon

@beibeiru
Copy link
Collaborator

Hi, Bohyeon,

It is very clear right now. Thanks.
I will let you know once I address your issue. Maybe 1 or 2 days.

Best,
Beibei

@beibeiru
Copy link
Collaborator

Hi, Bohyeon,

I have added a new function SpaCET.deconvolution.malignant.customized.scRNAseq which can meet your requirements. Just reinstall our package to use it. Please see the following example for more details.

library(SpaCET)

oldST_Path <- system.file("extdata", 'oldST_PDAC', package = 'SpaCET')

# load ST data to create a SpaCET object.
load(paste0(oldST_Path,"/st_PDAC.rda"))

SpaCET_obj <- create.SpaCET.object(
  counts=counts,
  spotCoordinates=spotCoordinates,
  imagePath=NA,
  platform = "oldST"
)

# load scRNA-Seq data 
load(paste0(oldST_Path,"/sc_PDAC.rda"))

# separate scRNA-Seq data into two groups, cancer and normal.
sc_lineageTree_cancer <- sc_lineageTree[1]
sc_lineageTree_normal <- sc_lineageTree[2:14]

sc_annotation_cancer <- sc_annotation[sc_annotation[,"bio_celltype"]%in%c("Cancer clone A","Cancer clone B"),]
sc_annotation_normal <- sc_annotation[!sc_annotation[,"bio_celltype"]%in%c("Cancer clone A","Cancer clone B"),]

sc_counts_cancer <- sc_counts[,sc_annotation_cancer[,"cellID"]]
sc_counts_normal <- sc_counts[,sc_annotation_normal[,"cellID"]]

# infer malignant fraction with CNV signature and deconvolve normal fraction with matched normal scRNAseq.
SpaCET_obj <- SpaCET.deconvolution.matched.scRNAseq(
  SpaCET_obj, 
  sc_includeMalignant=FALSE,
  cancerType="PAAD",
  sc_counts=sc_counts_normal, 
  sc_annotation=sc_annotation_normal, 
  sc_lineageTree=sc_lineageTree_normal, 
  coreNo=8
)

# deconvolve malignant fraction with customized tumor scRNAseq.
SpaCET_obj <- SpaCET.deconvolution.malignant.customized.scRNAseq(
  SpaCET_obj, 
  Malignant="Malignant", 
  sc_counts=sc_counts_cancer, 
  sc_annotation=sc_annotation_cancer, 
  sc_lineageTree=sc_lineageTree_cancer, 
  sc_nCellEachLineage=100, 
  coreNo=8
)

Please let me know whether it works for you!

Best,
Beibei

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants