AntonioDeFalco / SCEVAN

R package that automatically classifies the cells in the scRNA data by segregating non-malignant cells of tumor microenviroment from the malignant cells. It also infers the copy number profile of malignant cells, identifies subclonal structures and analyses the specific and shared alterations of each subpopulation.
https://www.nature.com/articles/s41467-023-36790-9
GNU General Public License v3.0
87 stars 25 forks source link

multiSampleComparisonClonalCN Error in vegaMC_R(mtx = mtx, output_file_name = paste("./output/", sample, : NA/NaN/Inf in foreign function call (arg 1) #117

Open Prakrithi-P opened 1 week ago

Prakrithi-P commented 1 week ago

Hi, Thanks for the wonderful tool. However, I have been facing some issues. When I run the single sample pipeline, it works fine (some samples throw an error which I had raised in an already open issue). When I combine multiple samples, I get the following error:

Error in vegaMC_R(mtx = mtx, output_file_name = paste("./output/", sample, : NA/NaN/Inf in foreign function call (arg 1) Traceback:

  1. multiSampleComparisonClonalCN(listCountMtx, listNormCells, analysisName = "P5_combined")
  2. lapply(names(listCountMtx), function(x) { . pipelineCNA(listCountMtx[[x]], norm_cell = listNormCells[[x]], . sample = x, SUBCLONES = FALSE, ClonalCN = TRUE, par_cores = par_cores, . organism = organism) . })
  3. FUN(X[[i]], ...)
  4. pipelineCNA(listCountMtx[[x]], norm_cell = listNormCells[[x]], . sample = x, SUBCLONES = FALSE, ClonalCN = TRUE, par_cores = par_cores, . organism = organism)
  5. classifyTumorCells(res_proc$count_mtx_norm, res_proc$count_mtx_annot, . sample, par_cores = par_cores, ground_truth = NULL, norm_cell_names = norm_cell, . SEGMENTATION_CLASS = TRUE, SMOOTH = TRUE, beta_vega = beta_vega)
  6. getBreaksVegaMC(mtx_vega, annot_mtx[, 3], sample, beta_vega)
  7. vegaMC_R(mtx = mtx, output_file_name = paste("./output/", sample, . "vega_output"), beta = beta_vega)

Could you please help me fix this? code used:

List of matrices names

matrix_names <- c('P5_N','P5_SCC_BCC')

Create an empty list

listCountMtx <- list()

Populate the list with matrices

for (name in matrix_names) { listCountMtx[[name]] <- get(name) }

List of normal cell

N_P5SCC<-P5_SCC_BCC[,c('AAACGGGCATTGCGGC-2', 'AAAGCAAGTCTGATCA-2', 'AAAGTAGCAGGATTGG-2', 'AAAGTAGCATTTCAGG-2', 'AAATGCCAGACTCGGA-2', 'AACACGTGTGTAAGTA-2', 'AACTCAGAGTGGTAAT-2', 'AACTCTTAGGCAATTA-2', 'AAGGAGCGTAATAGCA-2', 'AATCGGTCATACAGCT-2', 'ACACCCTAGGCTAGAC-2', 'ACACCCTCAGGAACGT-2', 'ACACCGGGTCCAGTAT-2', 'ACAGCTAGTTGATTGC-2', 'ACATCAGGTCTAGTGT-2', 'ACGATACCAAATCCGT-2', 'ACGATACGTAAACCTC-2', 'ACGCAGCAGTAGATGT-2', 'ACGCAGCGTCAGAGGT-2', 'ACGGAGAAGTGTCCCG-2', 'ACGGGCTGTCCGTTAA-2', 'ACTATCTCATCCAACA-2', 'ACTGAACGTGCTAGCC-2', 'ACTGAGTGTGATGCCC-2', 'ACTGTCCAGGATGTAT-2')]

matrix_names <- c('P1_N','P1_SCC','P2_N','P2_SCC1','P2_SCC2','P3_IEC','P3_N','P4_N','P4_SCC','P5_N','P5_SCC_BCC')

matrix_names <- c('P5_N','N_P5SCC')

Create an empty list

listNormCells <- list()

Populate the list with matrices

for (name in matrix_names) { listNormCells[[name]] <- get(name) }

res5<-multiSampleComparisonClonalCN(listCountMtx, listNormCells, analysisName="P5_combined")

Fixing this would be really helpful for my project.

Thanks! Prakrithi

Prakrithi-P commented 1 week ago

Update: I realized I had to specify a list of the list of normal cells and not a list of normal cell matrices.

However, I get the error [1] " raw data - genes: 34937 cells: 2887" [1] "1) Filter: cells > 200 genes" [1] "filtered out 183 cells past filtering 2708 cells" [1] "low data quality" [1] "2) Filter: genes > 5% of cells" [1] "5959 genes past filtering" [1] "3) Annotations gene coordinates" [1] "5607 genes annotated" [1] "4) Filter: genes involved in the cell cycle" [1] "5283 genes past filtering " [1] "5) Filter: cells > 5genes per chromosome " [1] "6) Log Freeman Turkey transformation" [1] "A total of 2245 cells, 5283 genes after preprocessing" [1] "7) Measuring baselines (confident normal cells)" Error in count_mtx - basel: non-conformable arrays Traceback:

  1. multiSampleComparisonClonalCN(listCountMtx, main_list, analysisName = "P5_combined")
  2. lapply(names(listCountMtx), function(x) { . pipelineCNA(listCountMtx[[x]], norm_cell = listNormCells[[x]], . sample = x, SUBCLONES = FALSE, ClonalCN = TRUE, par_cores = par_cores, . organism = organism) . })
  3. FUN(X[[i]], ...)
  4. pipelineCNA(listCountMtx[[x]], norm_cell = listNormCells[[x]], . sample = x, SUBCLONES = FALSE, ClonalCN = TRUE, par_cores = par_cores, . organism = organism)
  5. classifyTumorCells(res_proc$count_mtx_norm, res_proc$count_mtx_annot, . sample, par_cores = par_cores, ground_truth = NULL, norm_cell_names = norm_cell, . SEGMENTATION_CLASS = TRUE, SMOOTH = TRUE, beta_vega = beta_vega)