Hello, I am attempting to do pseudo time on RNA seq data but I am getting a data frame error. I am unsure how to fix this data frame. The code and error are below. Thank you!
require(gam)
t <- E.sce$slingPseudotime_1
# for time, only look at the 100 most variable genes
head(E.sce)
Y <- log1p(assays(E.sce)$logcounts)
var100 <- names(sort(apply(Y,1,var),decreasing = TRUE))[1:100]
Y <- Y[var100,]
# fit a GAM with a loess term for pseudotime
gam.pval <- apply(Y,1,function(z){
d <- data.frame(z=z, t=t)
suppressWarnings({
tmp <- suppressWarnings(gam(z ~ lo(t), data=d))
})
p <- summary(tmp)[3][[1]][2,3]
p
})
Error in data.frame(z = z, t = t) :
arguments imply differing number of rows: 759, 0