Winnie09 / Lamian

39 stars 9 forks source link

Does it apply to a more complex design? #20

Open zlin-bioinfo opened 7 months ago

zlin-bioinfo commented 7 months ago

Hi, Thank you for developing this impressive work! I wanna know if would it be possible for the population-level comparison to also apply to paired samples in different groups. For example, comparing the trajectory differences of individuals with paired tumor& normal samples between different response groups. I tried to add a column with random values as additional variables to the expdata, but couldn't proceed at the getPopulationFit().

> expdata$design <- data.frame(expdata$design) %>% dplyr::mutate(gender = c(0, rep(1, 3), rep(0, 4))) %>% as.matrix()
> 
> Res <- lamian_test(
+   expr = expdata$expr,
+   cellanno = expdata$cellanno,
+   pseudotime = expdata$pseudotime,
+   design = expdata$design,
+   test.type = 'variable',
+   testvar = c(2,3),
+   permuiter = 5,
+   ## This is for permutation test only. 
+   ## We suggest that users use default permuiter = 100.
+   ## Alternatively, we can use test.method = 'chisq' to swich to the chi-square test.
+   ncores = 1
+ )
> 
> 
> ## get differential dynamic genes statistics
> stat <- Res$statistics
> stat <- stat[order(stat[, 1],-stat[, 3]),]
> ## identify XDE genes with FDR.overall < 0.05 cutoff
> diffgene <-
+   rownames(stat[stat[, grep('^fdr.*overall$', colnames(stat))] < 0.05, ])
> 
> ## population fit
> Res$populationFit <-
+   getPopulationFit(Res, gene = diffgene, type = 'variable')
Error in phi %*% i %*% beta : non-conformable arguments

Would appreciate any suggestions regarding the issue!