statOmics / tradeSeq

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

Analysis with existing slingshot object #14

Closed graddi closed 5 months ago

graddi commented 5 years ago

Hello,

Thank you very much for this package. I am trying to identify DE genes among different lineages identified with slingshot, and I was wondering if you could help me adapting the initial part of the vignette to that effect?

I get the following error when I try to follow through with the vignette

counts <- assays(sce_hem)$counts %>% as.matrix() Error in (function (classes, fdef, mtable) : unable to find an inherited method for function ‘assays’ for signature ‘"SlingshotDataSet"’

Please note sce_hem was made as here below, with integrated_umap.data_hem and cluster_labels_hem taken from a V3 integrated Seurat object:

sce_hem <- slingshot(integrated_umap.data.hem,clusterLabels=cluster_labels_hem) lin1_hem <- getLineages(sce_hem, cluster_labels_hem, start.clus= 'Prohem. Inactive') lin1_hem crv1_hem <- getCurves(lin1_hem) crv1_hem plot(integrated_umap.data.hem, col = ucols.states[cluster_labels_hem], pch=16, asp = 1, cex = 0.4) lines(lin1_hem, lwd = 3, show.constraints = TRUE, col = 'black') plot(integrated_umap.data.hem, col = ucols.states[cluster_labels_hem], pch=16, asp = 1, cex = 0.4) lines(crv1_hem, lwd = 3, col = 'black')

Thank you for your time!

koenvandenberge commented 5 years ago

Hi,

Please note that the object sce_hem is an object of class SlingshotDataSet, hence it does not contain the counts your are looking for with assays(sce_hem)$counts.

The counts object as defined in our vignette should relate to your matrix of gene expression counts, with genes in the rows and cells in the columns.

graddi commented 5 years ago

Ah thank you @koenvandenberge and yes apologies for that simple mistake. Thank you for the quick response. I did get the counts out but I'm running into another issue when assessing nodes.. When I run either of these two commands:

icMat <- evaluateK(counts = counts, knots=3:20, nGenes = 200, pseudotime = slingPseudotime(crv1_hem, na = FALSE), cellWeights = slingCurveWeights(crv1_hem)) icMat <- evaluateK(counts = counts, sds = crv1_hem, knots=3:20, nGenes = 200, verbose=FALSE)

I get this error:

Error in plot.window(xlim = xlim, ylim = ylim, log = log, yaxs = pars$yaxs) : need finite 'ylim' values In addition: Warning messages: 1: In min(x) : no non-missing arguments to min; returning Inf 2: In max(x) : no non-missing arguments to max; returning -Inf

Any ideas?

koenvandenberge commented 5 years ago

Hmm. It seems like there are non-numeric values in icMat, the matrix of AIC values. Does the error only appear when you run evaluateK the second time with the Slingshot object as input?

Could you please tell us what the output is for any(is.na(icMat)) and any(is.inf(icMat))?

graddi commented 5 years ago

Thank you for the response @koenvandenberge, it does not appear the function processes icMat to the end. When I run your two commands they give the same output:

any(is.na(icMat)) Error: object 'icMat' not found any(is.inf(icMat)) Error in is.inf(icMat) : could not find function "is.inf" any(is.infinite(icMat)) Error: object 'icMat' not found

Also, error happens both times when running evaluateK. Independently of slingshot object.

koenvandenberge commented 5 years ago

Could you provide a reproducing example such that we can look into the error? Possibly a subset of your data.

graddi commented 5 years ago

Actually I think I found the issue. The counts matrix was based on the whole dataset while the slingshot database was on a subset of it that I have been using for the analysis. After harmonising the two evaluateK seems to be working. It is still running (taking some time), which is a good sign! I'll close the issue later today if no more issues appear. Thanks for the help!

graddi commented 5 years ago

Hello @koenvandenberge so while the analysis seems to be going quite well, I am having an issue with visualisation. Namely, both selecting a manual gene or the filtered gene by the list returns the same error

startRes <- startVsEndTest(sce,lineages=TRUE) oStart <- order(startRes$lineage3, decreasing = TRUE) sigGeneStart <- names(sce)[oStart[1]] plotSmoothers(sce, counts, gene=sigGeneStart) Error in (function (classes, fdef, mtable) : unable to find an inherited method for function ‘plotSmoothers’ for signature ‘"list"’ plotSmoothers(sce, counts, gene="AGAP001274") Error in (function (classes, fdef, mtable) : unable to find an inherited method for function ‘plotSmoothers’ for signature ‘"list"’

koenvandenberge commented 5 years ago

It seems like your sce object is a list, hence you likely ran fitGAM without providing the SlingshotDataSet object with the sds argument, and instead manually provided pseudotimes and cell-level weights using pseudotime and cellWeights in fitGAM.

In that case, we advise to run plotSmoothers using the plotSmoothers(sce[[sigGeneStart]]) syntax.

graddi commented 5 years ago

Thank you very much @koenvandenberge it's working very well now!

graddi commented 5 years ago

If I may ask a couple of other questions @koenvandenberge ... thank you so much for taking all this time.

1) Have issues with pattern test, see error below (all other tests before in the vignette worked fine with the three lineages identified)

patternRes <- patternTest(sce, pairwise = TRUE) Error in paste0("t", lineageId) : argument "curves" is missing, with no default

2) Also, when doing clusterxpressionPatters it seems the function recalculates PCA, is there a way to tell function tu one previously calculated reductions and stats? It also gives an error

clusPat <- clusterExpressionPatterns(sce, nPoints = nPointsClus,

  • genes = rownames(counts)[1:40]) Note: Not all of the methods requested in 'reduceMethod' have been calculated. Will calculate all the methods requested (any pre-existing values -- filtering statistics or dimensionality reductions -- with these names will be recalculated and overwritten): PCA. Note: makeDendrogram encountered following error and therefore clusters were not merged: Error in .local(object, ...) : All samples are unassigned for clusteringmakeConsensus
koenvandenberge commented 5 years ago

No worries, we just finished a major update to the package so for us it's super useful that you're going through the vignette with your own data, since we can take out any remaining issues we didn't find with our datasets.

Concerning the patternTest, I cannot reproduce the error on a dataset with three lineages. However, I just pushed an update to the test that might fix your issue, please update tradeSeq and let me know if it works.

For the clustering, this was a bug in the vignette I had forgotten to change. The error All samples are unassigned for clusteringmakeConsensus means that no reasonable clustering was discovered, since there were only 40 genes provided (genes = rownames(counts)[1:40]). This is now changed to 200 genes in the vignette, which should result in a clustering.

koenvandenberge commented 5 years ago

patternTest should behave properly now on your dataset with the new commits.

graddi commented 5 years ago

Thank you @koenvandenberge. In that case I'll keep asking! Yes the new version worked fine with regards to patternTest.

Changing the number of genes worked for gene clustering up to a point, see below (there is an error)

library(clusterExperiment) nPointsClus <- 20 clusPat <- clusterExpressionPatterns(sce, nPoints = nPointsClus, genes = rownames(counts [1:200]) Note: Not all of the methods requested in 'reduceMethod' have been calculated. Will calculate all the methods requested (any pre-existing values -- filtering statistics or dimensionality reductions -- with these names will be recalculated and overwritten): PCA. Note: Merging will be done on ' makeConsensus ', with clustering index 1 clusterLabels <- primaryCluster(clusPat$rsec) cUniq <- unique(clusterLabels) cUniq <- cUniq[!cUniq == -1] # remove unclustered genes plots <- list() for (xx in cUniq) { cId <- which(clusterLabels == xx) p <- ggplot(data = data.frame(x = 1:nPointsClus, y = rep(range(clusPat$yhatScaled[cId, ]), nPointsClus / 2)), aes(x = x, y = y)) + geom_point(alpha = 0) + abs(title = paste0("Cluster ", xx), x = "Pseudotime", y = "Normalized expression") + theme_classic() for (ii in 1:length(cId)) { geneId <- rownames(clusPat$yhatScaled)[cId[ii]] p <- p + geom_line(data = data.frame(x = rep(1:nPointsClus, 2), y = clusPat$yhatScaled[geneId, ], lineage = rep(0:1, each = nPointsClus)), aes(col = as.character(lineage), group = lineage), lwd = 1.5) } p <- p + guides(color = FALSE) + scale_color_manual(values = c("orange", "darkseagreen3"), breaks = c("0", "1"))
plots[[xx]] <- p } Error in data.frame(x = rep(1:nPointsClus, 2), y = clusPat$yhatScaled[geneId, : arguments imply differing number of rows: 40, 60 plots$ncol <- 2 do.call(plot_grid, plots) Error in grobs[[i]] : subscript out of bounds

There is also a different error when trying to get to the genes that have different expression patterns but no different expression at the differentiated cell type level. Maybe because I am doing all the tests of above with LINEAGE = TRUE (I have three, not two, lineages)

compare <- inner_join(patternRes %>% mutate(Gene = rownames(patternRes), pattern = waldStat) %>% select(Gene, pattern), endRes %>% mutate(Gene = rownames(endRes), end = waldStat) %>% select(Gene, end), by = c("Gene" = "Gene")) %>% mutate(transientScore = (min_rank(desc(end)))^2 + (dense_rank(pattern))^2) Error: Column names df_1vs2, pvalue_1vs2, df_1vs3, pvalue_1vs3, df_2vs3, … (and 4 more) must not be duplicated. Use .name_repair to specify repair. Call rlang::last_error() to see a backtrace

HectorRDB commented 5 years ago

Hi @graddi , The first error is because you have 3 lineages instead of 2. Changing data.frame(x = rep(1:nPointsClus, 2) to data.frame(x = rep(1:nPointsClus, 3) should work.

For the second one, indeed, you should run the tests with LINEAGE=FALSE (or just modify the code of the vignette to only select appropriate columns)

lucygarner commented 4 years ago

Hi @koenvandenberge,

I'm getting the same error that @graddi was getting when running evaluateK. I have run the slingshot function on the sce object and this worked well.

counts <- as.matrix(counts(sce)) sds <- SlingshotDataSet(sce) icMat <- evaluateK(counts = counts, sds = sds, k = 3:20, nGenes = 200, verbose = FALSE)

Error in plot.window(xlim = xlim, ylim = ylim, log = log, yaxs = pars$yaxs) : need finite 'ylim' values In addition: Warning messages: 1: In min(x) : no non-missing arguments to min; returning Inf 2: In max(x) : no non-missing arguments to max; returning -Inf

No icMat object is generated.

Many thanks, Lucy

HectorRDB commented 4 years ago

Hi First, just to make sure, are you using the latest tradeSeq version? There has been a lof of updates over the last two months to fix bugs so be sure that you are up -to-date.

If the error still persists, could you please send me a fraction of your data that reproduces the error. Thanks

lucygarner commented 4 years ago

Hi @HectorRDB,

The tradeSeq version that I am using is 0.99.9904

My SlingshotDataSet was created directly from my Seurat UMAP embeddings and clusters as follows ("sample" is my Seurat object): sample_sds <- slingshot(Embeddings(sample, "umap"), clusterLabels = seurat_clusters, start.clus = 0, end.clus = c(2, 1))

The SingleCellExperiment object and counts matrix was generated as follows: sce <- SingleCellExperiment(assays = list(counts = sample@assays$RNA@counts), colData = sample@meta.data[, 1:5], rowData = sample@assays$RNA@meta.features) counts <- as.matrix(counts(sce))

There are 8055 cells in total.

Then I tried to run evaluateK: icMat <- evaluateK(counts = counts, sds = sample_sds, k = 3:20, nGenes = 200, verbose = FALSE)

It starts running, but then I get the error as above.

Error in plot.window(xlim = xlim, ylim = ylim, log = log, yaxs = pars$yaxs) : need finite 'ylim' values In addition: Warning messages: 1: In min(x) : no non-missing arguments to min; returning Inf 2: In max(x) : no non-missing arguments to max; returning -Inf

Is there something obvious that I am doing wrong?

Best wishes, Lucy

HectorRDB commented 4 years ago

Hi @lc822, There is nothing obvious I can see.

Can you run the fitGam function picking any value of k or does that also fail?

As a side note, Seurat provides a function to convert its output to a singleCellExperiment, you might want to use that (as.SingleCellExperiment, see here).

lucygarner commented 4 years ago

Hi @HectorRDB ,

fitGAM doesn't seem to work either. fit_gam <- fitGAM(counts = counts, sds = sample_sds, nknots = 5)

Error in .fitGAM(counts = counts, U = U, pseudotime = pseudotime, cellWeights = cellWeights, : object 'X' not found

What does this error mean?

Best wishes, Lucy

lucygarner commented 4 years ago

I have tried running the example code and I get both of the same errors.

set.seed(8)
data(sds, package="tradeSeq")
loadings <- matrix(runif(2000*2,-2,2), nrow=2, ncol=2000)
counts <- round(abs(t(slingshot::reducedDim(sds) %*% loadings)))+100
aicK <- evaluateK(counts = counts, sds=sds,
                  nGenes=100, k=3:5, verbose=FALSE)

Error in plot.window(xlim = xlim, ylim = ylim, log = log, yaxs = pars$yaxs) : need finite 'ylim' values In addition: Warning messages: 1: In min(x) : no non-missing arguments to min; returning Inf 2: In max(x) : no non-missing arguments to max; returning -Inf


set.seed(8)
data(crv, package="tradeSeq")
data(countMatrix, package="tradeSeq")
gamList <- fitGAM(counts = as.matrix(countMatrix),
                  sds = crv,
                  nknots = 5)

Error in .fitGAM(counts = counts, U = U, pseudotime = pseudotime, cellWeights = cellWeights, : object 'X' not found

HectorRDB commented 4 years ago

Can you send the output from traceback() after the error? Thanks. Also, what operating system are you using?

@koenvandenberge, do you think it might be related to the new way of assigning, replacing <<-, that might not work everywhere?

lucygarner commented 4 years ago

I have tested a few things with the example code. It seems to run ok when I first open my R project, but if I run my code first, then run the example code again, evaluateK gives the same error.
Not sure why this should make a difference.

The traceback() for evaluateK is:

12: plot.window(xlim = xlim, ylim = ylim, log = log, yaxs = pars$yaxs) 11: bxp(list(stats = c(NAreal, NAreal, NAreal, NAreal, NAreal, NAreal, NAreal, NAreal, NAreal, NAreal, NAreal, NAreal, NAreal, NAreal, NAreal, NAreal, NAreal, NAreal, NAreal, NAreal, NAreal, NAreal, NAreal, NAreal, NAreal, NAreal, NAreal, NAreal, NAreal, NAreal, NAreal, NAreal, NAreal, NAreal, NAreal, NAreal, NAreal, NAreal, NAreal, NAreal, NAreal, NAreal, NAreal, NAreal, NAreal, NAreal, NAreal, NAreal, NAreal, NAreal, NAreal, NAreal, NAreal, NAreal, NAreal, NAreal, NAreal, NAreal, NAreal, NAreal, NAreal, NAreal, NAreal, NAreal, NAreal, NAreal, NAreal, NAreal, NAreal, NAreal, NAreal, NAreal, NAreal, NAreal, NAreal, NAreal, NAreal, NAreal, NAreal, NAreal, NAreal, NAreal, NAreal, NAreal, NAreal, NAreal, NAreal, NAreal, NAreal, NAreal), n = c(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0), conf = c(NAreal, NAreal, NAreal, NAreal, NAreal, NAreal, NAreal, NAreal, NAreal, NAreal, NAreal, NAreal, NAreal, NAreal, NAreal, NAreal, NAreal, NAreal, NAreal, NAreal, NAreal, NAreal, NAreal, NAreal, NAreal, NAreal, NAreal, NAreal, NAreal, NAreal, NAreal, NAreal, NAreal, NAreal, NAreal, NAreal), out = numeric(0), group = numeric(0), names = c("1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12", "13", "14", "15", "16", "17", "18")), notch = FALSE, width = NULL, varwidth = FALSE, log = "", border = "black", pars = list(boxwex = 0.8, staplewex = 0.5, outwex = 0.5), outline = TRUE, horizontal = FALSE, add = FALSE, ann = TRUE, at = NULL, ylab = "Deviation from genewise average AIC", xlab = "Number of knots", xaxt = "n") 10: do.call("bxp", c(list(z, notch = notch, width = width, varwidth = varwidth, log = log, border = border, pars = pars, outline = outline, horizontal = horizontal, add = add, ann = ann, at = at), args[namedargs])) 9: boxplot.default(groups, ...) 8: boxplot(groups, ...) 7: boxplot.matrix(devs, ylab = "Deviation from genewise average AIC", xlab = "Number of knots", xaxt = "n") 6: boxplot(devs, ylab = "Deviation from genewise average AIC", xlab = "Number of knots", xaxt = "n") 5: boxplot(devs, ylab = "Deviation from genewise average AIC", xlab = "Number of knots", xaxt = "n") 4: .evaluateK(counts = counts, k = k, U = U, pseudotime = pseudotime, cellWeights = cellWeights, nGenes = nGenes, weights = weights, offset = offset, verbose = verbose, control = control, sce = sce, ...) 3: .local(counts, ...) 2: evaluateK(counts = counts, sds = sds, k = 3:20, nGenes = 200, verbose = FALSE) 1: evaluateK(counts = counts, sds = sds, k = 3:20, nGenes = 200, verbose = FALSE)

The traceback for fitGAM is:

4: .fitGAM(counts = counts, U = U, pseudotime = pseudotime, cellWeights = cellWeights, weights = weights, offset = offset, nknots = nknots, verbose = verbose, parallel = parallel, BPPARAM = BPPARAM, control = control, sce = sce, family = family) 3: .local(counts, ...) 2: fitGAM(counts = counts, sds = sds, nknots = 5) 1: fitGAM(counts = counts, sds = sds, nknots = 5)

I also just received a different error with fitGAM:

Error in [[<-(*tmp*, name, value = list(X = c(1, 1, 1, 1, 1, 1, 1, : 2660 elements in value to replace 8105 elements

My operating system is macOS 10.14.6 and I am using R 3.6.1.

HectorRDB commented 4 years ago

Ok I'm not exactly sure what is happening there. Would you mind sharing a subset of your data that reproduces the error? It might be easier to diagnostic what it happening

koenvandenberge commented 4 years ago

I agree, hard to see what's wrong here. It would be great if you could share a subset of your count matrix that reproduces the error and your Slingshot object, @lc822 .

lucygarner commented 4 years ago

Unfortunately I am unable to attach the files here. I have sent Hector an email so hopefully we will be able to share the data another way.

Strangely, I have found that tradeSeq seems to run ok after moving the code out of a larger script. I don’t know whether one of the other loaded packages was interfering with tradeSeq somehow?

However, I am getting warning messages after both evaluateK and fitGAM.

1: In newton(lsp = lsp, X = G$X, y = G$y, Eb = G$Eb, UrS = G$UrS, ... : Fitting terminated with step failure - check results carefully

I had 38 warnings after evaluateK and 50 after fitGAM. What do these warnings mean and should I be concerned?

koenvandenberge commented 4 years ago

Thank you @lc822.

We try to code tradeSeq in a way that it should not conflict with other loaded packages. Of course it's still possible that it happens, but hard to diagnose without trying ourselves or seeing the larger script.

The warning messages are from mgcv, which we use to fit the GAMs. It means that the model fitting procedure stopped because of an unexpected update in the parameter estimates, i.e. the fitting is unstable. This can happen when, for example, (i) you are using weights to account for zero inflation and many zeros are significantly downweighted, leaving little data to fit the model; (ii) when the dataset is not (or leniently) filtered; (iii) or there's a low number of samples.

lucygarner commented 4 years ago

Thanks @koenvandenberge.

(i) I did not include any weights to account for zero inflation. My data was generated using 10x Genomics technology. Would you recommend using weights in this case?

(ii) Are you referring to gene filtering? I did not significantly filter my data. What gene filtering do you recommend? If I filter the genes present in the count matrix, would I need to run Slingshot again on the filtered matrix?

(iii) My dataset contains ~8000 cells. I assume this should be sufficient?

Best wishes, Lucy

koenvandenberge commented 4 years ago

I personally do not use zero inflation weights for 10X data, and 8k cells should indeed be sufficient.

Yes, I was referring to gene filtering. We generally recommend filtering, but the way to do the filtering can vary wildly, and there is no known 'best' way to filter. In general, I try to filter in a way that does not remove important genes for small clusters/lineages; for example, if you have a branch (or cluster) in the trajectory that consists of only ~200 cells, then make sure you're not removing genes that can be markers for the smaller population of 200 cells, and you could try something like

keep <- rowSums(counts > 1) >= 120
counts <- counts[keep,]

where we make sure that a gene should have a count of at least 2 in at least 120 cells.

Since Slingshot works on reduced dimensions, the genes you filter would likely not contribute to these reduced dimensions, assuming we're indeed removing uninformative genes. You could re-estimate the reduced dimensional representation of the filtered count matrix to see if it has an effect, but in general I'd think that it should not matter a whole lot. For consistency, however, I would recommend re-running Slingshot on the filtered count matrix.

koenvandenberge commented 4 years ago

Hi @lc822 I've just had the same error happen to me, because the dimensions of my count matrix did not agree with the dimensions of the SlingshotDataSet object. Maybe this is also the case in your situation?

lucygarner commented 4 years ago

Hi @koenvandenberge,

I am running Slingshot using UMAP embeddings from Seurat: sample_sds <- slingshot(Embeddings(sample, "umap"), clusterLabels = clusters, start.clus = 0, end.clus = c(1, 2))

If I filtered the genes in the manner you suggested (i.e. keep <- rowSums(counts > 1) >= 120), I would need to re-run the PCA analysis and clustering in Seurat and then Slingshot wouldn't I?

Instead, I tried subsetting the expression matrix for tradeSeq to keep just the 3000 variable genes that were used for PCA analysis in Seurat, but I still got the following warnings (x 50):

Warning messages: 1: In newton(lsp = lsp, X = G$X, y = G$y, Eb = G$Eb, UrS = G$UrS, ... : Fitting terminated with step failure - check results carefully

Any suggestions?

The graphs looked as follows: image

koenvandenberge commented 4 years ago

Hi @lc822

Optimally, I would indeed suggest to re-run PCA, clustering and Slingshot; although, as mentioned above, it should not have a huge impact.

If the warnings still persist after filtering, it means the optimization procedures had a difficult time fitting the model. As the warning suggests, it is recommended to (e.g., visually) check your results, e.g. using plotSmoothers. Note that this can happen in any dataset, so it does not mean that there is something wrong with your data.

lucygarner commented 4 years ago

Hi @koenvandenberge,

Just to check something - should the counts matrix be raw counts or normalised counts?

Thanks, Lucy

koenvandenberge commented 4 years ago

Although we haven't extensively benchmarked normalization procedures, the default is to input raw counts.

lucygarner commented 4 years ago

Thank you - that's what I thought.

julicudini commented 4 years ago

Hello,

I am running into the same issues as above - namely, I can run evaluateK but when I run fitGAM on raw counts and a slingshot object, I get the error

Error in .fitGAM(counts = counts, U = U, pseudotime = pseudotime, cellWeights = cellWeights, : object 'X' not found

The warning

package:stats' may not be available when loading'

also occurs when running but the fitGAM function will run all the way to 100% before it fails.

The traceback is:

4: .fitGAM(counts = counts, U = U, pseudotime = pseudotime, cellWeights = cellWeights, weights = weights, offset = offset, nknots = nknots, verbose = verbose, parallel = parallel, BPPARAM = BPPARAM, control = control, sce = sce, family = family) 3: .local(counts, ...) 2: fitGAM(counts = counts, sds = SlingshotDataSet(D10.sce), nknots = 8, verbose = T, parallel = TRUE) 1: fitGAM(counts = counts, sds = SlingshotDataSet(D10.sce), nknots = 8, verbose = T, parallel = TRUE)

The dimensions of my slingshot dataset are the exact same as the counts, as I extracted the counts using counts(sce) on the sce I ran through slingshot. I have ~ 6500 cells and 5300 genes in my dataset, and they are 10X data. I get the same error when I subsetted to the top 500 variably expressed genes, and there are no genes that are not expressed in any cell.

HectorRDB commented 4 years ago

Hi @julicudini

Regarding the waring, this stackoverflow looks related. Based on that, I don't think the warning is an issue.

The X object is used to construct a singleCellexperiment output. Can you check if the code runs smoothly is you run fitGAM with the argument sce=FALSE, just to make sure everything else is ok.

Also, if you could provide your sessionInfo(), it would help.

Thanks.

HectorRDB commented 4 years ago

Hi @julicudini I also just pushed a small update to tradeSeq that might fix this issue. Please install the latest version of tradeSeq and let me know if it works

julicudini commented 4 years ago

Thanks for the reply! The same issue occurs when running fitGAM with sce=FALSE, even after I just re-installed from bioconductor. Here is the session info:

R version 3.6.0 (2019-04-26) Platform: x86_64-apple-darwin15.6.0 (64-bit) Running under: macOS High Sierra 10.13.6 Matrix products: default BLAS: /System/Library/Frameworks/Accelerate.framework/Versions/A/Frameworks/vecLib.framework/Versions/A/libBLAS.dylib LAPACK: /Library/Frameworks/R.framework/Versions/3.6/Resources/lib/libRlapack.dylib Random number generation: RNG: Mersenne-Twister Normal: Inversion Sample: Rounding locale: [1] en_CA.UTF-8/en_CA.UTF-8/en_CA.UTF-8/C/en_CA.UTF-8/en_CA.UTF-8 attached base packages: [1] parallel stats4 stats graphics grDevices utils datasets methods base
other attached packages: [1] tradeSeq_1.0.1 slingshot_1.4.0 princurve_2.1.4 SingleCellExperiment_1.8.0 SummarizedExperiment_1.16.1 [6] DelayedArray_0.12.3 BiocParallel_1.20.1 matrixStats_0.56.0 Biobase_2.46.0 GenomicRanges_1.38.0
[11] GenomeInfoDb_1.22.1 IRanges_2.20.2 S4Vectors_0.24.4 BiocGenerics_0.32.0
loaded via a namespace (and not attached): [1] nlme_3.1-139 bitops_1.0-6 bit64_0.9-7 doParallel_1.0.15 RColorBrewer_1.1-2 progress_1.2.2
[7] httr_1.4.1 zinbwave_1.8.0 tools_3.6.0 R6_2.4.1 HDF5Array_1.14.4 DBI_1.1.0
[13] lazyeval_0.2.2 mgcv_1.8-28 colorspace_1.4-1 ade4_1.7-15 withr_2.2.0 tidyselect_1.0.0
[19] prettyunits_1.1.1 bit_1.1-15.2 compiler_3.6.0 xml2_1.3.2 pkgmaker_0.31.1 scales_1.1.0
[25] genefilter_1.68.0 pbapply_1.4-2 NMF_0.22.0 stringr_1.4.0 digest_0.6.25 XVector_0.26.0
[31] pkgconfig_2.0.3 bibtex_0.4.2.2 limma_3.42.2 rlang_0.4.5 RSQLite_2.2.0 rstudioapi_0.11
[37] howmany_0.3-1 dplyr_0.8.5 RCurl_1.98-1.2 magrittr_1.5 GenomeInfoDbData_1.2.2 Matrix_1.2-17
[43] Rhdf5lib_1.8.0 Rcpp_1.0.4.6 munsell_0.5.0 ape_5.3 lifecycle_0.2.0 stringi_1.4.6
[49] yaml_2.2.1 edgeR_3.28.1 MASS_7.3-51.4 zlibbioc_1.32.0 rhdf5_2.30.1 plyr_1.8.6
[55] blob_1.2.1 clusterExperiment_2.6.1 grid_3.6.0 crayon_1.3.4 rncl_0.8.4 lattice_0.20-38
[61] splines_3.6.0 annotate_1.64.0 hms_0.5.3 locfit_1.5-9.4 knitr_1.28 pillar_1.4.3
[67] igraph_1.2.5 uuid_0.1-4 softImpute_1.4 rngtools_1.5 reshape2_1.4.4 codetools_0.2-16
[73] XML_3.99-0.3 glue_1.4.0 RNeXML_2.4.3 vctrs_0.2.4 foreach_1.5.0 locfdr_1.1-8
[79] gtable_0.3.0 purrr_0.3.4 tidyr_1.0.2 kernlab_0.9-29 assertthat_0.2.1 ggplot2_3.3.0
[85] xfun_0.13 gridBase_0.4-7 phylobase_0.8.10 xtable_1.8-4 RSpectra_0.16-0 survival_3.1-12
[91] tibble_3.0.1 iterators_1.0.12 memoise_1.1.0 AnnotationDbi_1.48.0 registry_0.5-1 cluster_2.0.8
[97] ellipsis_0.3.0

koenvandenberge commented 4 years ago

@julicudini You re-installed the release version from Bioconductor which does not include the updates @HectorRDB just made. Could you try re-installing from our GitHub page? You can do that using

install.packages("devtools") #if you haven't yet
devtools::install_github("statOmics/tradeSeq")
julicudini commented 4 years ago

Oh, my apologies, I forgot the changes wouldn't be pushed to bioconductor. I tried running again and fitGAM seems to have completed successfully, thank you!! Just a note, I did have to add +1 to my counts in order to successfully fit.

HectorRDB commented 4 years ago

No problem, I should have been clearer. Your last comment is very weird though. Just to be clear, you started from your initial count matrix which contained only positive (>= 0) integers and that did not work. However, adding 1 to every count value fixed that?

I can see two possible reasons:

Could you check that you have no strictly negative values in the original count matrix for some reason, and that neither of the points above are true? Thanks

ishrat98 commented 3 years ago

unable to find an inherited method for function ‘getLineages’ for signature ‘"NULL", "NULL"’ I got this error. Can anyone help me?

koenvandenberge commented 3 years ago

getLineages is a slingshot function developed by @kstreet13 so he'll be the best person for questions related to that package. However, based on the error you report, it seems like the two objects you are providing as arguments to getLineages are NULL, i.e., empty. So you may want to check whether you are providing the right objects to the function.

Biglinboy commented 3 years ago

Hi, @koenvandenberge @kstreet13 I am trying to identify genes that change their expression over the course of development with slingshot,but have a problem after running the following fitGAM code, sce has been an object of slingshot after running slingshot method. Can you help me? Thanks

library(tradeSeq)

sce
class: SingleCellExperiment 
dim: 31082 27390 
metadata(0):
assays(2): counts norm
rownames(31082): WASH7P AL627309.1 ... RSL24D1P8 IGLV3-6
rowData names(0):
colnames(27390): Wu_Blood_AAACCTGAGTGTACGG-1 Wu_Blood_AAACCTGCAAGCCCAC-1 ... GF20_TTGCGTCTCTTCCTTC-1
  GF20_TTGGAACCAGATTGCT-1
colData names(20): GMM slingshot ... slingPseudotime_3 slingPseudotime_4
reducedDimNames(2): PCA UMAP
altExpNames(0):
sce <- fitGAM(sce)
Error in .local(counts, ...) : 
  For now tradeSeq only works downstream of slingshotin this format.
 Consider using the method with a matrix as input instead.
Leoarie-lab commented 5 months ago

Dear everyone,

I run this commands

DefaultAssay(today) <- "RNA" sce <- as.SingleCellExperiment(today, assay = "RNA")

sce <- slingshot(sce, reducedDim = "WNN.UMAP", clusterLabels = colData(sce)$ident,start.clus = "Classical", approx_points = 150,useNames = TRUE)

But it showed the error that Error: useNames = NA is defunct. Instead, specify either useNames = TRUE or useNames = FALSE.

Even I put useNames in FALSE or TRUE.

I am sorry, I am new for R or running pseudo time. Could anyone help me to resolve this error?

Thank you very much.

kstreet13 commented 5 months ago

This is also a slingshot issue and has been addressed here.