statOmics / tradeSeq

TRAjectory-based Differential Expression analysis for SEQuencing data
Other
236 stars 27 forks source link

BPPARAM with fitGAM #258

Open AndreaYCT opened 4 months ago

AndreaYCT commented 4 months ago

Hi,

I've trying to work on this for days and hope ppl here can provide me some solution. Currently, I set 6 knots and I have 7 lineages.

My codes are: `Slingshot <- slingshot(SingleCellExperiment, clusterLabels = colData(SingleCellExperiment)$ident, reducedDim="UMAP", start.clus=StartCluster, approx_point = 150)

library(BiocParallel) BPPARAM <- BiocParallel::bpparam() BPPARAM$workers <- 2 counts <- Slingshot@assays@data@listData$counts slingPseudotime <- slingPseudotime(SlingshotDataSet(Slingshot), na= F) slingCurveWeights <- slingCurveWeights(SlingshotDataSet(Slingshot)) fitGAM_BPPARAM <-fitGAM(counts=counts, pseudotime = slingPseudotime, cellWeights=slingCurveWeights, conditions = factor(colData(Slingshot)$Exp), nknots=6, verbose = T, parallel=T, BPPARAM = BPPARAM) `

Here are error msgs: Error in reducer$value.cache[[as.character(idx)]] <- values : wrong args for environment subassignment Calls: fitGAM ... .bploop_impl -> .collect_result -> .reducer_add -> .reducer_add In addition: Warning messages: 1: In asMethod(object) : sparse->dense coercion: allocating vector of size 28.6 GiB 2: In .findKnots(nknots, pseudotime, wSamp) : Impossible to place a knot at all endpoints.Increase the number of knots to avoid this issue. 3: In parallel::mccollect(wait = FALSE, timeout = 1) : 1 parallel job did not deliver a result Execution halted

Many thanks!

Alexis-Varin commented 2 months ago

Not from dev team, but here are a few points :

  1. Never use the exact same name for a variable as the name of a function, this can lead to weird behavior. So no slingPseudotime and slingCurveWeights or even Slingshot isn't ideal.
  2. Related to 1. , you don't even need to provide pseudotime and weights parameters, simply use sds = SlingshotDataSet(Slingshot) and it will automatically find those values
  3. counts can simply be counts = assays(Slingshot)$counts

This would simply give something like this :

fitGAM_BPPARAM <-fitGAM(counts=assays(Slingshot)$counts, sds = SlingshotDataSet(Slingshot), conditions = factor(colData(Slingshot)$Exp), nknots=6, verbose = T, parallel=T, BPPARAM = BPPARAM)

Let's see first if you have same error by simplifying the code

AndreaYCT commented 1 month ago

Hi,

Thank you for those tips. Unfortunately, I got the same error msg. I came across another post of your (https://github.com/statOmics/tradeSeq/issues/259) and wonder if you can show me how to use "SnowParam()"

Many thanks

Andrea

Not from dev team, but here are a few points :

  1. Never use the exact same name for a variable as the name of a function, this can lead to weird behavior. So no slingPseudotime and slingCurveWeights or even Slingshot isn't ideal.
  2. Related to 1. , you don't even need to provide pseudotime and weights parameters, simply use sds = SlingshotDataSet(Slingshot) and it will automatically find those values
  3. counts can simply be counts = assays(Slingshot)$counts

This would simply give something like this :

fitGAM_BPPARAM <-fitGAM(counts=assays(Slingshot)$counts, sds = SlingshotDataSet(Slingshot), conditions = factor(colData(Slingshot)$Exp), nknots=6, verbose = T, parallel=T, BPPARAM = BPPARAM)

Let's see first if you have same error by simplifying the code