This is a test version of Biostars. For the public version, visit https://www.biostars.org.
trajectory-like graph for a data frame

I would like to know if there is a way to create a similar graph to the trajectory plots of single-cell RNA-seq (velocity).

I have a data set with 7 different timepoints and ~2000 genes. I have calculated the expression differences between the timepoints into a new "delta" table and would like to plot the expression changes in ggplot (geom_point) and show with arrows the movement of those genes across time.

Is there a way to do it using R?

my data frame looks like that:

            meant0 meant1  meant2  meant3  meant4 meant5  meant6 meant7
ANKH-KO-1   1797.0 2708.0   233.0   -28.0  1283.5 -548.5 -1576.5 -166.0
ANKH-KO-2   1726.0 2786.5   331.0  -384.5  -929.0 1304.0 -1107.5  326.0
ANKH-KO-3   2055.0 2792.0   438.5    74.0 -1841.5 2568.0 -2087.5  114.5
ANKH-KO-4   2059.0 3115.0  -176.0   440.0  -289.0 -857.5  1064.0  -69.5
...

thanks

trajectory rna-seq tidyverse r velocity

1 answer

There are better ways to do this than trajectory-type things. In reality, all you need is boxplots or violin plots or whatever grouped by timepoint, optionally split into additional groups if you have other conditions. For example:

enter image description here

This is split by tissue, grouped by timepoint, and colored by genotype for a set of genes.

I use dittoSeq to generate such plots with a few additional modifications. It has pretty flexible inputs (SingleCellExperiment, Seurat, SummarizedExperiment, DGEList, DESeqDataset, etc).

The code for the plot above is:

dittoPlotVarsAcrossGroups(dds, mod.1, group.by = "Broad_Group", color.by = "H3_Status", split.by = "Location", 
    assay = "lognorm", adjustment = NULL, plots = c("boxplot", "jitter"), 
    boxplot.width = 0.6, boxplot.lineweight = 0.5) + 
        geom_smooth(aes(group = color, color = color), se = FALSE, linewidth = 1.5) + 
        scale_color_manual(values = Darken(dittoColors()[1:2]))

Where dds is a DESeqDataSet object and mod.1 is a vector of genes.

It can also be done for individual genes:

dittoPlot(dds, "Cdkn2a", group.by = "Broad_Group", color.by = "H3_Status", split.by = "Location", 
    assay = "lognorm", adjustment = NULL, plots = c("boxplot", "jitter"), 
    boxplot.width = 0.6, boxplot.lineweight = 0.5, ylab = "log2(normalized counts + 1)") + 
        geom_smooth(aes(group = color, color = color), se = FALSE, linewidth = 1.5) + 
        scale_color_manual(values = Darken(dittoColors()[1:2]))

You might also be interested in the degPatterns function from the DEGreport package, which can identify groups of genes that have similar expression profiles over a time course.

Log in to answer this question.