Skip to content

plotTDEHm error after TDE test #34

Description

@CanacR

Hello,

Thank you very much for developing this tool. I am reaching out regarding an error message with plotTDEHm after TDE test.

I followed the tutorial to run TDE lamian_test on a 6212 genes x 2830 cells matrix. Everything ran without error messages before plotTDEHm. Here is the code I used:

Res <- lamian_test(
  expr = expr,
  ncores= 30,
  cellanno = cellanno,
  pseudotime = Pseudo,
  design = design,
  test.type = 'time',
  permuiter = 100,
  verbose.output = TRUE
)

diffgene <- rownames(Res$statistics)[Res$statistics[, 1] < 0.05]
Res$populationFit <- getPopulationFit(Res, gene = diffgene, type = 'time')
Res$cluster <- clusterGene(Res, gene = diffgene, type = 'time', k = 3)

plotTDEHm(
  Res,
  subsampleCell  = FALSE,
  showCluster = TRUE,
  type = 'time',
  cellWidthTotal = 200,
  cellHeightTotal = 200
)

After running plotTDEHm, I have this error:

Error in data.frame(pseudotime = testobj$pseudotime[colnames(fit.scale)],  :
  arguments imply differing number of rows: 0, 1

Looking at the source code, I understand that the error comes from plotTDEHm here:

colann.fit <-
        data.frame(
          pseudotime = testobj$pseudotime[colnames(fit.scale)],
          expression = 'Model Fitted',
          stringsAsFactors = FALSE
        )

Where the function tries to select 'pseudotime' values only for cells with names == colnames(fit.scale). The problem in my case is that fit.scale contains 7 columns with "[,1]" to "[,7]" as colnames. So it doesn't match my cell names.

At the end of getPopulationFit, no colnames are attributed to the returned 'fitres' object, as I have 2830 cells vs. 7 fitres columns:

if (ncol(testobj$expr) == ncol(fitres)) colnames(fitres) <- colnames(testobj$expr)

1. Am I missing something here and the output I got should not have only 7 columns?
2. How can I solve this colname issue to be able to plot both original and model fitted data?

Thank you.

Metadata

Metadata

Assignees

No one assigned

    Labels

    answeredanswer providedbugSomething isn't workinggood first issueGood for newcomers

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions