Open fluentin44 opened 1 year ago
Hi Matt,
This is a good question and we should probably allow for a better visualization that does this for you.
For now, what I can suggest is just working with the ggplot2
object and tweaking how you plot the knot points.
For example, below I use the example from plotGeneCount
to just make the points larger so you can easily count them. Alternative ways are of course possible.
Hope this helps.
set.seed(97)
library(slingshot)
library(tradeSeq)
data(crv, package="tradeSeq")
data(countMatrix, package="tradeSeq")
rd <- slingReducedDim(crv)
cl <- kmeans(rd, centers = 7)$cluster
lin <- getLineages(rd, clusterLabels = cl, start.clus = 4)
crv <- getCurves(lin)
counts <- as.matrix(countMatrix)
gamList <- fitGAM(counts = counts,
pseudotime = slingPseudotime(crv, na = FALSE),
cellWeights = slingCurveWeights(crv))
p=plotGeneCount(crv, counts, clusters=cl, models=gamList)
dat3 <- p$layers[[3]]$data #knots data
p + geom_point(data=dat3, size=10, col="black")
Hi,
Brilliant, ill have a play.
Thanks very much!
Hi Matt,
This is a good question and we should probably allow for a better visualization that does this for you. For now, what I can suggest is just working with the
ggplot2
object and tweaking how you plot the knot points. For example, below I use the example fromplotGeneCount
to just make the points larger so you can easily count them. Alternative ways are of course possible.Hope this helps.
set.seed(97) library(slingshot) data(crv, package="tradeSeq") data(countMatrix, package="tradeSeq") rd <- slingReducedDim(crv) cl <- kmeans(rd, centers = 7)$cluster lin <- getLineages(rd, clusterLabels = cl, start.clus = 4) crv <- getCurves(lin) counts <- as.matrix(countMatrix) gamList <- fitGAM(counts = counts, pseudotime = slingPseudotime(crv, na = FALSE), cellWeights = slingCurveWeights(crv)) p=plotGeneCount(crv, counts, clusters=cl, models=gamList) dat3 <- hlp$layers[[3]]$data #knots data p + geom_point(data=dat3, size=10, col="black")
Where the object "hlp" from? Thank you for replying. I have the same question of identifing knots.
Hi @greengarden0925
That should have been object p
, my mistake. I have now updated the above comment.
Hi @greengarden0925
That should have been object
p
, my mistake. I have now updated the above comment.
Thank you for the clarification.
Hi,
Im trying to look at differential expression between two knots, ideally at the point where the five lineages diverge using
earlyDERes <- earlyDETest(gam, knots = c(2, 3))
but cant reliably distinguish the knot number for each curve - is there anyway of overlaying each curve on the graph one by one?Alternatively, when using
yhatSmooth <- predictSmooth(gam, gene = var_genes[1:50], nPoints = 50, tidy = FALSE)
would there be any way to indicate / identify where each point may lay on each curve?Thanks, Matt