Error in data.frame(z = z, t = t) : arguments imply differing number of rows: 759, 0

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!

t <- E.sce$slingPseudotime_1
# for time, only look at the 100 most variable genes
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)
    tmp <- suppressWarnings(gam(z ~ lo(t), data=d))
  p <- summary(tmp)[3][[1]][2,3]

 Error in data.frame(z = z, t = t) : 
  arguments imply differing number of rows: 759, 0

Is t empty? That would explain the problem (if that column doesn't exist, t may contain NULL). Can you share the output of



it looks like you're taking the log of an already log-transformed count. Are you sure about that?

Hi AlexisW!
T is not empty.
Here is the output for head(E.sce):

class: SingleCellExperiment 
dim: 6 759 
assays(2): counts logcounts
rownames(6): Xkr4 Rp1 ... Lypla1 Gm37988
rowData names(5): vst.mean vst.variance vst.variance.expected vst.variance.standardized vst.variable
colData names(9): orig.ident nCount_RNA ... RNA_snn_res.1.2 ident
reducedDimNames(2): PCA UMAP

Something to consider, Do you have a reasoned argument for why z and t should be the same length?

If you need more specific help, please provide a proper REPRoducible EXample (reprex) illustrating your issue.

1 Like

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.