Trajectory-based differential expression analysis for single-cell sequencing data
tradeSeq tradeSeq workflow using input from From slingShot
Workflow using input from Monocle
Example code importing only counts pseudotime and cells weights on each trajectory
#! /usr/bin/Rscript
library(tradeSeq)
library(monocle)
library(RColorBrewer)
library(SingleCellExperiment)
library(slingshot)
palette(brewer.pal(8, "Dark2"))
packageDescription("tradeSeq")$Version
#load data
cellPSMatrix <- as.matrix(read.table("Subset.PsTime.txt", sep="\t"))
cellWeights <- as.matrix(read.table("Subset.CellsWeight.txt", sep="\t"))
counts <- as.matrix(read.table("RawCounts.txt", sep="\t"))
#this step is optional
#select the subset of cells that are present on the pseudotime and cells weight file
countsFiltered <- subset.matrix(counts, select=rownames(cellWeights))
#Evaluate the knots that we'll use when fitting the General Additive Models
icMat <- evaluateK(counts = countsFiltered, k = 3:10,
nGenes = 200, verbose = T, pseudotime = cellPSMatrix,
cellWeights = cellWeights)
library(BiocParallel)
library(magrittr)
# Register BiocParallel Serial Execution (no parallelization in that case)
BiocParallel::register(BiocParallel::SerialParam())
FitModels <- fitGAM(counts = countsFiltered,nknots = 8, pseudotime = cellPSMatrix, cellWeights = cellWeights )
patternRes <- patternTest(FitModels)
oPat <- order(patternRes$waldStat, decreasing = TRUE)
head(rownames(patternRes)[oPat])
save.image("Data_afterPatternTest.RData")
pdf( "plotSmoothers.pdf", w=11, h=8.5)
plotSmoothers(FitModels, countsFiltered , gene = rownames(patternRes)[oPat][1])
plotSmoothers(FitModels, countsFiltered , gene = rownames(patternRes)[oPat][2])
plotSmoothers(FitModels, countsFiltered , gene = rownames(patternRes)[oPat][3])
plotSmoothers(FitModels, countsFiltered , gene = rownames(patternRes)[oPat][4])
plotSmoothers(FitModels, countsFiltered , gene = rownames(patternRes)[oPat][5])
dev.off()
write.table(patternRes, file="PatternTest8knots.txt", sep="\t", quote=F, row.names=T)
Example of input files:
Note:
See TracWiki
for help on using the wiki.
