Learn R Programming

grandR

Nucleotide conversion sequencing experiments have been developed to add a temporal dimension to RNA-seq and single-cell RNA seq. Such experiments require specialized tools for primary processing such as GRAND-SLAM, and specialized tools for downstream analyses. grandR provides a comprehensive toolbox for quality control, kinetic modeling, differential gene expression analysis and visualization of such data.

Installation

grandR is available from CRAN. Install grandR using the following commands on the R console:

install.packages("grandR")
library(grandR)

You can also install the development version from github:

require("devtools")
devtools::install_github("erhard-lab/grandR")
library(grandR)

System Requirements

grandR should be compatible with Windows, Mac, and Linux operating systems, but we recommend using grandR on a Linux machine, where it has been extensively tested (Ubuntu 22.04). Due to restrictions of the parallel package, parallelization (SetParallel()) does not work under Windows. grandR runs on standard laptops (multi-core CPUs are recommended and memory requirements depend on the size of your data sets).

Installing it via install.packages or devtools::install_github will make sure that the following (standard) packages are available:

stats,Matrix,rlang,ggplot2,grDevices,patchwork,RCurl,plyr,parallel,reshape2,MASS,scales,cowplot,minpack.lm,lfc,labeling,methods,utils,numDeriv

Additional packages are optional and important for particular functions:

knitr, rmarkdown, circlize, Seurat, ComplexHeatmap, ggrepel, DESeq2, S4Vectors, data.table, clusterProfiler, biomaRt, msigdbr, fgsea, rclipboard, cubature, DT, RColorBrewer, gsl, htmltools, matrixStats, monocle, VGAM, quantreg, graphics, shiny, ggrastr, viridisLite

With all dependencies available, installation of grandR typically takes less than a minute.

Cheatsheet

How to get started

First have a look at the Getting started vignette.

Then, go through the Differential expression or the Kinetic modeling vignette, which provide a comprehensive walk-through of the two main settings of nucleotide conversion experiments.

There are also additional vignettes:

Copy Link

Version

Install

install.packages('grandR')

Monthly Downloads

298

Version

0.2.6

License

Apache License (>= 2)

Issues

Pull Requests

Stars

Forks

Maintainer

Florian Erhard

Last Published

January 22nd, 2025

Functions in grandR (0.2.6)

ComputeNonConstantParam

Compute and evaluate functions for non constant rates
ComputeNtrPosteriorQuantile

Compute NTR quantiles
CreatePseudobulkTable

Create Pseudobulk Table from a Seurat object
ComputeTotalExpression

Total expression computation
ComputeSummaryStatistics

Compute summary statistics
CreatePdfs

Convencience methods for creating QC pdfs
CreateConvolutionTable

Create Convolution Table from a Seurat object
Condition

Get or set the conditions in the column annotation table.
FilterGenes

Filter genes
Findno4sUPairs

Find equivalent no4sU samples for 4sU samples
DESeq2BIC

Compute the Bayesian information criterion (BIC)
DesignSemantics

Build the design semantics list
EstimateRegulation

Estimate regulation from snapshot experiments
FitKinetics

Fit kinetic models to all genes.
DefaultSlot

Get or set the default slot for a grandR object.
Genes

Gene and sample (or cell) names
GetAnalysisTable

Obtain a table of analysis results values
FitKineticsSnapshot

Fits RNA kinetics from snapshot experiments
FitKineticsPulseR

Fit kinetics using pulseR
Design

A list of predefined names for design vectors
FitKineticsGeneSnapshot

Compute the posterior distributions of RNA synthesis and degradation for a particular gene
Defer

Defer calling a function
FitKineticsGeneNtr

Fit a kinetic model using the degradation rate transformed NTR posterior distribution.
GetPairContrasts

Create a contrast matrix for two given conditions
GetSignificantGenes

Significant genes
GetTable

Obtain a genes x values table
GetSummarizeMatrix

Create a summarize matrix
FitKineticsGeneLeastSquares

Fit a kinetic model according to non-linear least squares.
FindReferences

Obtain reference columns (samples or cells) for all columns (samples or cells) in the data set
FitKineticsGeneLogSpaceLinear

Fit a kinetic model using a linear model.
PlotAnalyses

Convenience function to make the same type of plot for multple analyses.
IsParallel

Checks for parallel execution
PairwiseDESeq2

Perform Wald tests for differential expression
Pairwise

Log2 fold changes and Wald tests for differential expression
LFC

Estimation of log2 fold changes
PlotConversionFreq

Diagnostic plot for conversion frequencies
FormatCorrelation

Formatting function for correlations
GetContrasts

Create a contrast matrix
GetDiagnosticParameters

Describe parameters relevant to diagnostics
GeneInfo

Get the gene annotation table or add additional columns to it
PlotGeneTotalVsNtr

Gene plot comparing total RNA vs the NTR
PlotGeneSnapshotTimecourse

Gene plot for snapshot timecourse data
ListGeneSets

List available gene sets
GetData

Obtain a tidy table of values for a gene or a small set of genes
LikelihoodRatioTest

Compute a likelihood ratio test.
Normalize

Normalization
PlotModelCompareConv

Diagnostic plot for estimated models (global conversion rate)
PlotMismatchPositionForType

Diagnostic plot for mismatch position for columns (by mismatch type)
PlotGeneGroupsBars

Plot gene values as bars
PlotModelCompareNtr

Diagnostic plot for estimated models (global NTR)
PlotModelErr

Diagnostic plot for estimated models (global error rate)
PlotGeneGroupsPoints

Plot gene groups as points
PlotHeatmap

Create heatmaps from grandR objects
PlotScatter

Make a scatter plot
PlotModelCompareLL

Diagnostic plot for estimated models (log likelihoods)
PlotModelConv

Diagnostic plot for estimated models (global conversion rate)
PlotModelShape

Diagnostic plot for estimated models (global shape parameter)
PlotPCA

Make a PCA plot
NormalizeBaseline

Normalization to a baseline
PlotMismatchPositionForSample

Diagnostic plot for mismatch position for columns (by sample)
PlotTypeDistribution

Plot the distribution of gene types
PlotModelCompareErrPrior

Diagnostic plot for estimated models (global error rate)
PlotModelCompareErr

Diagnostic plot for estimated models (global error rate)
Plots

Stored plot functions
PlotProfileLikelihood

Diagnostic plot for estimated models (global error rate)
PlotSimulation

Plot simulated data
GetMatrix

Obtain a genes x values table as a large matrix
UseNtrSlot

Copy the NTR slot and save under new name
MAPlot

Make an MA plot
Scale

Scale data
SaveNtrSlot

Copy the NTR slot and save under new name
PlotGeneOldVsNew

Gene plot comparing old vs new RNA
MakeColdata

Extract an annotation table from a formatted names vector
ReadNewTotal

Read sparse new/total matrices
VulcanoPlot

Make a Vulcano plot
ReadGRAND3

Read the output of GRAND-SLAM 3.0 into a grandR object.
ReadGRAND

Read the output of GRAND-SLAM 2.0 into a grandR object.
PlotModelLabelTimeCourse

Diagnostic plot for estimated models (4sU increase)
RotatateAxisLabels

Rotate x axis labels
UpdateSymbols

Update symbols using biomaRt
PlotGeneProgressiveTimecourse

Plot progressive labeling timecourses
Slots

Slot functions
PoolColumns

Pool reads across columns
SetParallel

Set up parallel execution
f.nonconst

Function to compute the abundance of new or old RNA at time t for non-constant rates.
ServeGrandR

Serve a shiny web interface
density2d

Density estimation in 2d
TransformSnapshot

Estimate parameters for a one-shot experiment.
ReadCounts

Read a count table
SimulateTimeCourse

Simulate a complete time course of metabolic labeling - nucleotide conversion RNA-seq data.
f.old.equi

Functions to compute the abundance of new or old RNA at time t.
PlotModelNtr

Diagnostic plot for estimated models (global NTR)
ReadFeatureCounts

Read featureCounts
ToIndex

Obtain the indices of the given genes
get.mode.slot

Internal functions to parse mode.slot strings
dropout

Perform 4sU dropout tests
correctdropout

Correct for 4sU dropout
SimulateReadsForSample

Simulate metabolic labeling - nucleotide conversion RNA-seq data.
Transform.no

Transformations for PlotHeatmap
SimulateKinetics

Simulate the kinetics of old and new RNA for given parameters.
SimulateTimeCourseNonConstant

Simulate a complete time course of metabolic labeling - nucleotide conversion RNA-seq data.
data.apply

Internal function to apply functions to all slots etc.
f.nonconst.linear

Function to compute the abundance of new or old RNA at time t for non-constant rates.
as.Seurat.grandR

Create Seurat object from a grandR object
Semantics.concentration

Semantics for concentration columns
Semantics.time

Semantics for time columns
dropoutpercent

Estimate 4sU dropout percentages
check.analysis

Internal functions to check for a valid analysis or slot names.
structure2vector

Convert a structure into a vector
Summarize

Summarize a data matrix
grandR

Create a grandR object and retrieve basic information
estimate.dispersion

Estimate dispersion parameters for a count matrix using DESeq2
psapply

Parallel (s/l)apply
Coldata

Get the column annotation table or add additional columns to it
ComputeColumnStatistics

Compute statistics for all columns (i.e. samples or cells)
ClassifyGenes

Build the type column for the gene info table.
CalibrateEffectiveLabelingTimeMatchHalflives

Calibrate the effective labeling time by matching half-lives to a .reference
ApplyContrasts

Apply a function over contrasts
ComputeExpressionPercentage

Expression percentage computation
Analyses

Analysis table functions
AnalyzeGeneSets

Gene set analysis
CalibrateEffectiveLabelingTimeKineticFit

Uses the kinetic model to calibrate the effective labeling time.
ComputeAbsolute

Compute absolute expression using ERCC spike ins
ComputePseudoNtr

Compute pseudo NTRs from two count matrices
ComputeSteadyStateHalfLives

Steady state half-lives for each sample