Skip to contents

Here we will show a very basic example how to use grandR to perform differential gene expression analysis. For much more vignettes, see the grandR website.

We will use data from [1]. These are SLAM-seq data from multiple time points (1h,2h,4h,6h and 20h) after acute depletion of BANP. BANP is a transcriptional activator that binds to unmethylated CGCG motifs in CpG island promoters.

We first load the grandR package and the read the GRAND-SLAM output table directly from zenodo:

suppressPackageStartupMessages({
    library(grandR)
    library(ggplot2)
    library(patchwork)
})
data <- ReadGRAND("https://zenodo.org/record/6976391/files/BANP.tsv.gz",
                  design=c("Cell","Experimental.time","Genotype",Design$dur.4sU,Design$has.4sU,Design$Replicate))

The GRAND-SLAM output contains any gene with at least 1 read, so let’s filter this (by default: at least 100 reads in half of the samples)

data <- FilterGenes(data)

Let’s do a quick quality control and check the principal component analysis. We have to setup the Condition first to get nice colors:

Condition(data) <- c("Genotype","Experimental.time.original","has.4sU")
PlotPCA(data)

Now we perform differential gene expression analysis:

# differential expression, see differential expression vignette
contrasts <- GetContrasts(data,contrast=c("Experimental.time.original","0h"),columns = Genotype=='dTag')
data <- LFC(data,name.prefix = "total",contrasts = contrasts)
data <- PairwiseDESeq2(data,name.prefix = "total",contrasts = contrasts)
data <- LFC(data,name.prefix = "new",contrasts = contrasts,mode="new", normalization = "total")
data <- PairwiseDESeq2(data,name.prefix = "new",contrasts = contrasts,mode="new", normalization = "total")

The MA plots indicate that changes in new RNA are much more pronounced than changes in total RNA, even after 4h:

MAPlot(data,analysis = "total.4h vs 0h")|
  MAPlot(data,analysis = "new.4h vs 0h")

We can easily obtain significantly differentially regulated genes (by default: Q<0.05 & abs(LFC)>=1):

genes <- GetSignificantGenes(data,analysis = "new.4h vs 0h", criteria = Q<0.05 & LFC< -1)
GetAnalysisTable(data,analyses = "4h vs 0h",genes = genes, columns = "LFC|Q", gene.info = FALSE)
total.4h vs 0h.LFC total.4h vs 0h.Q new.4h vs 0h.LFC new.4h vs 0h.Q
Bzw1 -0.4049167 0.0000000 -1.591874 0.0000000
Cep350 -0.9428386 0.0000000 -1.310057 0.0000000
Ptpn4 -0.8717413 0.0000000 -1.290797 0.0000000
Pign -0.7468109 0.0000000 -1.740792 0.0000000
Pfkfb2 -1.2109515 0.0000000 -2.034935 0.0197814
Rpl7a -0.2087491 0.0213640 -1.433379 0.0000000
2310035C23Rik -0.7708118 0.0000000 -1.127441 0.0000000
Dars -0.1614027 0.0205584 -1.712862 0.0000000
Lrsam1 -1.1848762 0.0000000 -1.532849 0.0007304
Casc4 -0.6368342 0.0000000 -1.684313 0.0000001
Rc3h2 -1.1937913 0.0000000 -1.371584 0.0000000
March7 -1.1202654 0.0000000 -1.366951 0.0000000
Gm9833 -0.8112235 0.0000000 -2.778287 0.0000000
Zfp512b -1.2073193 0.0000000 -1.747552 0.0000000
Myef2 -0.9035457 0.0000000 -3.590065 0.0000000
Lcmt2 -1.4894524 0.0000000 -1.684084 0.0000006
Cenpb -1.2772139 0.0000000 -2.531545 0.0000000
Wdr77 -1.3261003 0.0000000 -3.020690 0.0000002
Atp5f1 -0.1750994 0.0682100 -1.588790 0.0000033
Nmd3 -0.6177977 0.0000000 -1.046226 0.0000000
Rbm39 -0.9881069 0.0000000 -1.628205 0.0000000
Snx5 -0.2761889 0.0000283 -1.045626 0.0000000
Smg5 -1.4243152 0.0000000 -2.140475 0.0000000
Ttc14 -0.8866021 0.0000000 -1.279095 0.0000000
Strip1 -1.1181880 0.0000000 -3.584319 0.0000000
Rnpc3 -1.0144526 0.0000000 -1.906450 0.0000000
Mms22l -0.6410693 0.0000000 -1.204826 0.0000000
Agl -0.6282185 0.0000000 -1.724997 0.0020372
Srsf10 -0.6756414 0.0000000 -1.041562 0.0000000
Rraga -1.1960975 0.0000000 -2.626356 0.0000043
Prdx1 -0.1498166 0.0546104 -1.248716 0.0000000
Minos1 -0.2891798 0.0682515 -1.398761 0.0015429
Asph -0.3565418 0.0000000 -1.681709 0.0000000
Pole -0.5164748 0.0000000 -1.583460 0.0000000
Atraid -1.1965615 0.0000000 -2.183169 0.0021098
Mob1b -1.9374683 0.0000000 -2.557860 0.0000000
Ncapg -0.4715520 0.0000000 -1.524758 0.0000000
Nop14 -0.7061881 0.0000000 -1.231487 0.0000000
Denr -0.7719097 0.0000000 -3.558633 0.0046419
Mdh2 -0.4494444 0.0000019 -2.842117 0.0000165
Ap4m1 -0.6352704 0.0000000 -1.005392 0.0000081
Chst12 -1.7593868 0.0000000 -1.787141 0.0029205
Rfc5 -0.4190605 0.0000000 -1.263439 0.0000000
Slc5a6 -1.0656930 0.0000000 -1.460581 0.0000029
Mob1a -1.7499198 0.0000000 -2.223078 0.0000000
Mad1l1 -0.7541517 0.0000000 -3.045967 0.0000000
Fgfr1op2 -0.8360517 0.0000000 -1.123028 0.0003901
Ergic2 -0.7849733 0.0000000 -1.593984 0.0000000
Srrt -0.5493759 0.0000000 -1.134517 0.0000000
Tmem209 -0.9769144 0.0000000 -1.131132 0.0000000
Tubgcp5 -1.7178942 0.0000000 -3.865639 0.0008877
Crebzf -1.0726153 0.0000000 -1.093507 0.0000000
Supt5 -0.5697177 0.0000000 -1.342800 0.0000000
Arnt2 -0.3207844 0.0395396 -1.426045 0.0090770
Edrf1 -1.5350037 0.0000000 -2.081083 0.0000000
Btbd10 -1.6118774 0.0000000 -2.086394 0.0027987
Zfp941 -0.9880679 0.0000000 -1.145216 0.0000000
Ikzf5 -0.9380561 0.0000000 -1.023575 0.0000132
Upf3a -0.7774655 0.0000000 -2.507884 0.0000000
Micu3 -2.0381825 0.0000000 -3.451641 0.0000000
Arl2bp -0.5145906 0.0000000 -1.308256 0.0374124
Tcf25 -0.3281309 0.0000000 -1.107098 0.0000747
Slc25a4 -0.2832186 0.0004546 -1.364629 0.0000083
Zfp317 -1.8563560 0.0000000 -2.046163 0.0000000
Ddhd2 -1.4304835 0.0000000 -3.523651 0.0216512
Ankrd49 -1.0487246 0.0000000 -1.201137 0.0000000
Ciapin1 -0.5332762 0.0000000 -1.169674 0.0000000
Ift46 -0.5200090 0.0000000 -2.004062 0.0000000
Taf1d -0.7711545 0.0000000 -1.291331 0.0000000
Tipin -0.6868983 0.0000000 -1.924255 0.0000001
Ireb2 -0.5745806 0.0000000 -1.577767 0.0000000
Dbr1 -1.2502667 0.0000000 -1.068616 0.0000000
Herc1 -0.8480354 0.0000000 -3.063395 0.0000000
Nktr -1.6595711 0.0000000 -3.278782 0.0000000
Qrich1 -0.6928870 0.0000000 -1.025579 0.0000000
Scamp5 -1.2507434 0.0000000 -2.102386 0.0000000
Glce -1.0766042 0.0000000 -1.431818 0.0000000
Wdr6 -0.5528243 0.0000000 -1.442052 0.0000000
Map2k2 -0.6466754 0.0000000 -1.869505 0.0000000
Tex9 -1.3196501 0.0000000 -2.494112 0.0000000
Rsph4a -0.6344661 0.0000207 -1.272442 0.0051859
Sec63 -0.8516400 0.0000000 -1.317850 0.0000000
Dctn2 -0.5404288 0.0000000 -1.124960 0.0001331
Ppp1r12a -0.6554683 0.0000000 -1.111509 0.0000000
Rnf167 -1.1745182 0.0000000 -1.765360 0.0000000
Nprl3 -1.5239045 0.0000000 -2.352325 0.0000057
Spdl1 -1.6981270 0.0000000 -1.974112 0.0000000
Cdk12 -1.7089477 0.0000000 -3.606867 0.0000000
Zfp867 -1.5832032 0.0000000 -1.750745 0.0000000
Gm17586 -1.0264258 0.0000000 -1.694781 0.0000126
Haspin -1.6247701 0.0000000 -1.730556 0.0000065
Cyb5d1 -1.3738235 0.0000000 -1.978572 0.0000002
Cops3 -0.1625868 0.0592244 -1.006107 0.0000000
Camk2b -0.2123757 0.0452834 -1.096598 0.0262078
Cox11 -1.0678872 0.0000000 -1.614065 0.0000003
Tmem18 -2.0734860 0.0000000 -3.274443 0.0000000
Ankfy1 -0.9841575 0.0000000 -2.020487 0.0000000
Drg1 -0.3494618 0.0000012 -1.472060 0.0000000
4930447C04Rik -0.7537949 0.0000000 -2.659638 0.0000092
Dnajc27 -2.1419602 0.0000000 -3.400425 0.0000000
Churc1 -0.6628013 0.0000000 -2.641795 0.0000000
Stxbp4 -0.6779614 0.0000000 -1.980874 0.0000698
Med1 -2.5015464 0.0000000 -3.575061 0.0000000
Taok1 -1.2255178 0.0000000 -1.961266 0.0000000
Zfp386 -1.0345934 0.0000000 -1.348782 0.0000000
Sipa1l1 -0.5652762 0.0000000 -2.355421 0.0000000
Ercc6l2 -0.6195863 0.0000000 -3.898004 0.0000000
Zfp346 -1.2157077 0.0000000 -1.600378 0.0000201
Cab39l -0.3807831 0.0000005 -2.133212 0.0000112
Micu2 -0.1761896 0.3451150 -1.123774 0.0061334
Camk2g -1.4873715 0.0000000 -2.057711 0.0000000
Usp54 -0.7536751 0.0000000 -1.320395 0.0000000
Akap11 -0.6919425 0.0000000 -1.679484 0.0000000
Dis3 -0.3998322 0.0000000 -1.003921 0.0000000
Cyc1 -0.2758691 0.0000745 -1.246631 0.0001025
Puf60 -0.5987206 0.0000000 -1.612616 0.0000000
Mkl2 -1.3637457 0.0000000 -2.273677 0.0000000
Gm28047 -1.2548423 0.0000000 -1.787430 0.0096741
Atf7 -1.5128512 0.0000000 -2.258619 0.0000000
Arf3 -0.9204991 0.0000000 -3.785531 0.0000000
Dzip3 -0.5710258 0.0000000 -2.319581 0.0000017
Nsun3 -0.9790886 0.0000000 -1.543068 0.0080199
Zfp414 -1.1357843 0.0000000 -1.852831 0.0000017
B230354K17Rik -1.1794817 0.0000000 -1.387088 0.0000000
Chaf1a -1.2071751 0.0000000 -1.388689 0.0000000
Gm6741 -0.7776053 0.0000000 -1.006212 0.0015078
Mapk14 -1.5844714 0.0000000 -3.457840 0.0000006
Rpl7a-ps5 -0.1272856 0.2705847 -1.056035 0.0239379
Cd2ap -0.5476119 0.0000000 -1.172565 0.0000000
Eif2ak2 -0.8770576 0.0000000 -2.086080 0.0000123
Polr1c -1.0626646 0.0000000 -1.666996 0.0000000
Myo5b -0.2075730 0.1107000 -1.307604 0.0132828
Rpl17 -0.2429525 0.0064102 -1.270315 0.0000147
Dmxl1 -0.7864044 0.0000000 -1.180367 0.0000000
Maoa -0.2142286 0.0262770 -1.357778 0.0033018
Uhrf2 -1.2972704 0.0000000 -2.727566 0.0000000
Wdr44 -0.9717873 0.0000000 -1.178816 0.0001895
Hmgb3 -0.3387660 0.0051868 -1.350774 0.0341549
Zmym3 -0.3710260 0.0000000 -1.242310 0.0000001
Trappc2 -0.6661864 0.0000000 -1.859098 0.0056808
Hells -0.7293904 0.0000000 -2.054234 0.0000000
Cox7b -0.2073749 0.1992399 -1.245849 0.0110895
Fundc2 -0.3890425 0.0002625 -1.422037 0.0070256
Nkrf -1.8445290 0.0000000 -2.183910 0.0000000
Ofd1 -0.6918110 0.0000000 -2.349520 0.0000000
Idh3g -0.2804031 0.0002062 -1.358422 0.0001946