Here we can type long passages or descriptives of our data without
the need of “hashing” out our comments with the # symbol. In our first
example, we will be using the ToothGrowth dataset. In this experiment,
Guinea Pigs (literal) were given different amounts of vitamin C to see
the effects on the animal’s tooth growth.
To run R code in a markdown file, we need to denote the section that
is considered R code. We call thsese “code chunks.”
As you can see, from running the “play” button on the code chunk, the
results are printed in line of the r markdown file
The slope of the regression line is 9.7635714.
Limma Microarray Analysis
library(ath1121501cdf)
## Warning: replacing previous import 'AnnotationDbi::tail' by 'utils::tail' when
## loading 'ath1121501cdf'
## Warning: replacing previous import 'AnnotationDbi::head' by 'utils::head' when
## loading 'ath1121501cdf'
##
library(annotate)
## Loading required package: AnnotationDbi
## Loading required package: stats4
## Loading required package: BiocGenerics
##
## Attaching package: 'BiocGenerics'
## The following objects are masked from 'package:lubridate':
##
## intersect, setdiff, union
## The following objects are masked from 'package:dplyr':
##
## combine, intersect, setdiff, union
## The following objects are masked from 'package:stats':
##
## IQR, mad, sd, var, xtabs
## The following objects are masked from 'package:base':
##
## anyDuplicated, aperm, append, as.data.frame, basename, cbind,
## colnames, dirname, do.call, duplicated, eval, evalq, Filter, Find,
## get, grep, grepl, intersect, is.unsorted, lapply, Map, mapply,
## match, mget, order, paste, pmax, pmax.int, pmin, pmin.int,
## Position, rank, rbind, Reduce, rownames, sapply, setdiff, sort,
## table, tapply, union, unique, unsplit, which.max, which.min
## Loading required package: Biobase
## Welcome to Bioconductor
##
## Vignettes contain introductory material; view with
## 'browseVignettes()'. To cite Bioconductor, see
## 'citation("Biobase")', and for packages 'citation("pkgname")'.
## Loading required package: IRanges
## Loading required package: S4Vectors
##
## Attaching package: 'S4Vectors'
## The following objects are masked from 'package:lubridate':
##
## second, second<-
## The following objects are masked from 'package:dplyr':
##
## first, rename
## The following object is masked from 'package:tidyr':
##
## expand
## The following object is masked from 'package:utils':
##
## findMatches
## The following objects are masked from 'package:base':
##
## expand.grid, I, unname
##
## Attaching package: 'IRanges'
## The following object is masked from 'package:lubridate':
##
## %within%
## The following objects are masked from 'package:dplyr':
##
## collapse, desc, slice
## The following object is masked from 'package:purrr':
##
## reduce
##
## Attaching package: 'AnnotationDbi'
## The following object is masked from 'package:dplyr':
##
## select
## Loading required package: XML
library(affy)
##
## Attaching package: 'affy'
## The following object is masked from 'package:lubridate':
##
## pm
library(limma)
##
## Attaching package: 'limma'
## The following object is masked from 'package:BiocGenerics':
##
## plotMA
library(oligo)
## Loading required package: oligoClasses
## Welcome to oligoClasses version 1.64.0
##
## Attaching package: 'oligoClasses'
## The following object is masked from 'package:affy':
##
## list.celfiles
## Loading required package: Biostrings
## Loading required package: XVector
##
## Attaching package: 'XVector'
## The following object is masked from 'package:purrr':
##
## compact
## Loading required package: GenomeInfoDb
##
## Attaching package: 'Biostrings'
## The following object is masked from 'package:base':
##
## strsplit
## ================================================================================
## Welcome to oligo version 1.66.0
## ================================================================================
##
## Attaching package: 'oligo'
## The following object is masked from 'package:limma':
##
## backgroundCorrect
## The following objects are masked from 'package:affy':
##
## intensity, MAplot, mm, mm<-, mmindex, pm, pm<-, pmindex,
## probeNames, rma
## The following object is masked from 'package:lubridate':
##
## pm
## The following object is masked from 'package:dplyr':
##
## summarize
library(ath1121501.db)
## Loading required package: org.At.tair.db
##
##
library(dplyr)
library(stats)
library(reshape)
##
## Attaching package: 'reshape'
## The following objects are masked from 'package:S4Vectors':
##
## expand, rename
## The following object is masked from 'package:lubridate':
##
## stamp
## The following object is masked from 'package:dplyr':
##
## rename
## The following objects are masked from 'package:tidyr':
##
## expand, smiths
library(systemPipeR)
## Loading required package: Rsamtools
## Loading required package: GenomicRanges
## Loading required package: ShortRead
## Loading required package: BiocParallel
## Loading required package: GenomicAlignments
## Loading required package: SummarizedExperiment
## Loading required package: MatrixGenerics
## Loading required package: matrixStats
##
## Attaching package: 'matrixStats'
## The following objects are masked from 'package:Biobase':
##
## anyMissing, rowMedians
## The following object is masked from 'package:dplyr':
##
## count
##
## Attaching package: 'MatrixGenerics'
## The following objects are masked from 'package:matrixStats':
##
## colAlls, colAnyNAs, colAnys, colAvgsPerRowSet, colCollapse,
## colCounts, colCummaxs, colCummins, colCumprods, colCumsums,
## colDiffs, colIQRDiffs, colIQRs, colLogSumExps, colMadDiffs,
## colMads, colMaxs, colMeans2, colMedians, colMins, colOrderStats,
## colProds, colQuantiles, colRanges, colRanks, colSdDiffs, colSds,
## colSums2, colTabulates, colVarDiffs, colVars, colWeightedMads,
## colWeightedMeans, colWeightedMedians, colWeightedSds,
## colWeightedVars, rowAlls, rowAnyNAs, rowAnys, rowAvgsPerColSet,
## rowCollapse, rowCounts, rowCummaxs, rowCummins, rowCumprods,
## rowCumsums, rowDiffs, rowIQRDiffs, rowIQRs, rowLogSumExps,
## rowMadDiffs, rowMads, rowMaxs, rowMeans2, rowMedians, rowMins,
## rowOrderStats, rowProds, rowQuantiles, rowRanges, rowRanks,
## rowSdDiffs, rowSds, rowSums2, rowTabulates, rowVarDiffs, rowVars,
## rowWeightedMads, rowWeightedMeans, rowWeightedMedians,
## rowWeightedSds, rowWeightedVars
## The following object is masked from 'package:Biobase':
##
## rowMedians
##
## Attaching package: 'GenomicAlignments'
## The following object is masked from 'package:dplyr':
##
## last
##
## Attaching package: 'ShortRead'
## The following object is masked from 'package:oligo':
##
## intensity
## The following objects are masked from 'package:oligoClasses':
##
## chromosome, position
## The following object is masked from 'package:affy':
##
## intensity
## The following object is masked from 'package:dplyr':
##
## id
## The following object is masked from 'package:purrr':
##
## compose
## The following object is masked from 'package:tibble':
##
## view
Read the cell files into the directory
################################
lets characterize the data a bit
#DESq1
First lets load in the libraries needed.
```r
library("edgeR")
library("dplyr")
library("AnnotationDbi")
library("org.Mm.eg.db")
##
rawdata = read.csv("GLDS-102_rna_seq_Normalized_Counts.csv", row.names = "gene_ID")
group <- factor(c('1', '1', '1', '1', '1', '1', '2', '2', '2', '2', '2', '2'))
dgeGlm <- DGEList(counts = rawdata, group = group)
str(dgeGlm)
## Formal class 'DGEList' [package "edgeR"] with 1 slot
## ..@ .Data:List of 2
## .. ..$ : num [1:24035, 1:12] 2976.8 59.8 21.2 40.1 0 ...
## .. .. ..- attr(*, "dimnames")=List of 2
## .. .. .. ..$ : chr [1:24035] "ENSMUSG00000000001" "ENSMUSG00000000028" "ENSMUSG00000000031" "ENSMUSG00000000037" ...
## .. .. .. ..$ : chr [1:12] "Mmus_C57.6J_KDN_FLT_Rep1_M23" "Mmus_C57.6J_KDN_FLT_Rep2_M24" "Mmus_C57.6J_KDN_FLT_Rep3_M25" "Mmus_C57.6J_KDN_FLT_Rep4_M26" ...
## .. ..$ :'data.frame': 12 obs. of 3 variables:
## .. .. ..$ group : Factor w/ 2 levels "1","2": 1 1 1 1 1 1 2 2 2 2 ...
## .. .. ..$ lib.size : num [1:12] 40266365 40740336 37739541 39196969 36820645 ...
## .. .. ..$ norm.factors: num [1:12] 1 1 1 1 1 1 1 1 1 1 ...
## ..$ names: chr [1:2] "counts" "samples"
keep <- rowSums(cpm(dgeGlm)>2) >=4
dgeGlm <- dgeGlm[keep,]
names(dgeGlm)
## [1] "counts" "samples"
dgeGlm[["samples"]]
## group lib.size norm.factors
## Mmus_C57.6J_KDN_FLT_Rep1_M23 1 40266365 1
## Mmus_C57.6J_KDN_FLT_Rep2_M24 1 40740336 1
## Mmus_C57.6J_KDN_FLT_Rep3_M25 1 37739541 1
## Mmus_C57.6J_KDN_FLT_Rep4_M26 1 39196969 1
## Mmus_C57.6J_KDN_FLT_Rep5_M27 1 36820645 1
## Mmus_C57.6J_KDN_FLT_Rep6_M28 1 36475638 1
## Mmus_C57.6J_KDN_GC_Rep1_M33 2 36585661 1
## Mmus_C57.6J_KDN_GC_Rep2_M34 2 36550490 1
## Mmus_C57.6J_KDN_GC_Rep3_M35 2 39573830 1
## Mmus_C57.6J_KDN_GC_Rep4_M36 2 36346170 1
## Mmus_C57.6J_KDN_GC_Rep5_M37 2 37663039 1
## Mmus_C57.6J_KDN_GC_Rep6_M38 2 34662629 1
design <- model.matrix(~group)
design
## (Intercept) group2
## 1 1 0
## 2 1 0
## 3 1 0
## 4 1 0
## 5 1 0
## 6 1 0
## 7 1 1
## 8 1 1
## 9 1 1
## 10 1 1
## 11 1 1
## 12 1 1
## attr(,"assign")
## [1] 0 1
## attr(,"contrasts")
## attr(,"contrasts")$group
## [1] "contr.treatment"
dgeGlmComDisp <- estimateGLMCommonDisp(dgeGlm, design, verbose = TRUE)
## Disp = 0.02648 , BCV = 0.1627
dgeGlmTrendDisp <- estimateGLMTrendedDisp(dgeGlmComDisp, design)
dgeGlmTagDisp <- estimateGLMTagwiseDisp(dgeGlmTrendDisp, design)
plotBCV(dgeGlmTagDisp)

fit <- glmFit(dgeGlmTagDisp, design)
colnames(coef(fit))
## [1] "(Intercept)" "group2"
lrt <- glmLRT(fit, coef =2)
ttGlm <- topTags(lrt, n = Inf)
class(ttGlm)
## [1] "TopTags"
## attr(,"package")
## [1] "edgeR"
summary(deGlm <- decideTestsDGE(lrt, p = 0.1, adjust = "fdr"))
## group2
## Down 64
## NotSig 13390
## Up 159
tagsGlm <- rownames(dgeGlmTagDisp)[as.logical(deGlm)]
plotSmear(lrt, de.tags = tagsGlm)

hits2 <- ttGlm$table[ttGlm$table$FDR < 0.1, ]
write.csv(hits2, "Mouse_EdgeR_Results_Zero_vs_1.csv")
columns(org.Mm.eg.db)
## [1] "ACCNUM" "ALIAS" "ENSEMBL" "ENSEMBLPROT" "ENSEMBLTRANS"
## [6] "ENTREZID" "ENZYME" "EVIDENCE" "EVIDENCEALL" "GENENAME"
## [11] "GENETYPE" "GO" "GOALL" "IPI" "MGI"
## [16] "ONTOLOGY" "ONTOLOGYALL" "PATH" "PFAM" "PMID"
## [21] "PROSITE" "REFSEQ" "SYMBOL" "UNIPROT"
ttGlm2 <- as.data.frame(ttGlm$table)
ttGlm2$symbol = mapIds(org.Mm.eg.db,
keys=row.names(ttGlm2),
column = "SYMBOL",
keytype = "ENSEMBL",
multiVals = "first")
## 'select()' returned 1:many mapping between keys and columns
ttGlm2$entrez = mapIds(org.Mm.eg.db,
keys = row.names(ttGlm2),
column = "ENTREZID",
keytype = "ENSEMBL",
multiVals = "first")
## 'select()' returned 1:many mapping between keys and columns
ttGlm$name = mapIds(org.Mm.eg.db,
keys=row.names(ttGlm2),
column = "ENTREZID",
keytype = "ENSEMBL",
multiVals = "first")
## 'select()' returned 1:many mapping between keys and columns
head(ttGlm2)
## logFC logCPM LR PValue FDR
## ENSMUSG00000026077 -1.3621448 3.576328 79.72497 4.303282e-19 5.858058e-15
## ENSMUSG00000007872 0.8863833 5.525394 76.76969 1.921033e-18 1.307551e-14
## ENSMUSG00000021775 0.9537055 6.241961 63.05270 2.012492e-15 9.132019e-12
## ENSMUSG00000002250 -0.8282806 5.266124 62.46754 2.708732e-15 9.218491e-12
## ENSMUSG00000059824 2.2593713 4.561763 57.98741 2.638001e-14 7.182221e-11
## ENSMUSG00000074715 -1.9895168 3.805293 47.03450 6.974820e-12 1.582470e-08
## symbol entrez
## ENSMUSG00000026077 Npas2 18143
## ENSMUSG00000007872 Id3 15903
## ENSMUSG00000021775 Nr1d2 353187
## ENSMUSG00000002250 Ppard 19015
## ENSMUSG00000059824 Dbp 13170
## ENSMUSG00000074715 Ccl28 56838
library(pathview)
##
## ##############################################################################
## Pathview is an open source software package distributed under GNU General
## Public License version 3 (GPLv3). Details of GPLv3 is available at
## http://www.gnu.org/licenses/gpl-3.0.html. Particullary, users are required to
## formally cite the original Pathview paper (not just mention it) in publications
## or products. For details, do citation("pathview") within R.
##
## The pathview downloads and uses KEGG data. Non-academic uses may require a KEGG
## license agreement (details at http://www.kegg.jp/kegg/legal.html).
## ##############################################################################
library(gage)
##
library(gageData)
data(kegg.sets.mm)
data(go.subs.mm)
foldchanges <- ttGlm2$logFC
names(foldchanges) <- ttGlm2$entrez
kegg.mm = kegg.gsets("mmu", id.type = "entrez")
kegg.mm.sigmet = kegg.mm$kg.sets[kegg.mm$sigmet.idx]
# Lets get the results
keggres = gage(foldchanges, gsets=kegg.mm.sigmet, same.dir = TRUE)
lapply(keggres, head)
## $greater
## p.geomean
## mmu04550 Signaling pathways regulating pluripotency of stem cells 0.001958409
## mmu03010 Ribosome 0.002752188
## mmu04330 Notch signaling pathway 0.006100574
## mmu04350 TGF-beta signaling pathway 0.016255434
## mmu04390 Hippo signaling pathway 0.020031157
## mmu00830 Retinol metabolism 0.020658786
## stat.mean
## mmu04550 Signaling pathways regulating pluripotency of stem cells 2.920014
## mmu03010 Ribosome 2.799230
## mmu04330 Notch signaling pathway 2.553317
## mmu04350 TGF-beta signaling pathway 2.155832
## mmu04390 Hippo signaling pathway 2.064024
## mmu00830 Retinol metabolism 2.078086
## p.val
## mmu04550 Signaling pathways regulating pluripotency of stem cells 0.001958409
## mmu03010 Ribosome 0.002752188
## mmu04330 Notch signaling pathway 0.006100574
## mmu04350 TGF-beta signaling pathway 0.016255434
## mmu04390 Hippo signaling pathway 0.020031157
## mmu00830 Retinol metabolism 0.020658786
## q.val
## mmu04550 Signaling pathways regulating pluripotency of stem cells 0.3316387
## mmu03010 Ribosome 0.3316387
## mmu04330 Notch signaling pathway 0.4900794
## mmu04350 TGF-beta signaling pathway 0.8297946
## mmu04390 Hippo signaling pathway 0.8297946
## mmu00830 Retinol metabolism 0.8297946
## set.size
## mmu04550 Signaling pathways regulating pluripotency of stem cells 100
## mmu03010 Ribosome 162
## mmu04330 Notch signaling pathway 54
## mmu04350 TGF-beta signaling pathway 86
## mmu04390 Hippo signaling pathway 125
## mmu00830 Retinol metabolism 37
## exp1
## mmu04550 Signaling pathways regulating pluripotency of stem cells 0.001958409
## mmu03010 Ribosome 0.002752188
## mmu04330 Notch signaling pathway 0.006100574
## mmu04350 TGF-beta signaling pathway 0.016255434
## mmu04390 Hippo signaling pathway 0.020031157
## mmu00830 Retinol metabolism 0.020658786
##
## $less
## p.geomean stat.mean
## mmu04613 Neutrophil extracellular trap formation 0.0001207186 -3.723203
## mmu04145 Phagosome 0.0019167230 -2.920212
## mmu04110 Cell cycle 0.0027590415 -2.798006
## mmu04714 Thermogenesis 0.0047171043 -2.609417
## mmu04217 Necroptosis 0.0061432099 -2.524746
## mmu00910 Nitrogen metabolism 0.0086742673 -2.567933
## p.val q.val
## mmu04613 Neutrophil extracellular trap formation 0.0001207186 0.02909319
## mmu04145 Phagosome 0.0019167230 0.22164300
## mmu04110 Cell cycle 0.0027590415 0.22164300
## mmu04714 Thermogenesis 0.0047171043 0.28420553
## mmu04217 Necroptosis 0.0061432099 0.29610272
## mmu00910 Nitrogen metabolism 0.0086742673 0.34841640
## set.size exp1
## mmu04613 Neutrophil extracellular trap formation 137 0.0001207186
## mmu04145 Phagosome 121 0.0019167230
## mmu04110 Cell cycle 134 0.0027590415
## mmu04714 Thermogenesis 208 0.0047171043
## mmu04217 Necroptosis 113 0.0061432099
## mmu00910 Nitrogen metabolism 13 0.0086742673
##
## $stats
## stat.mean
## mmu04550 Signaling pathways regulating pluripotency of stem cells 2.920014
## mmu03010 Ribosome 2.799230
## mmu04330 Notch signaling pathway 2.553317
## mmu04350 TGF-beta signaling pathway 2.155832
## mmu04390 Hippo signaling pathway 2.064024
## mmu00830 Retinol metabolism 2.078086
## exp1
## mmu04550 Signaling pathways regulating pluripotency of stem cells 2.920014
## mmu03010 Ribosome 2.799230
## mmu04330 Notch signaling pathway 2.553317
## mmu04350 TGF-beta signaling pathway 2.155832
## mmu04390 Hippo signaling pathway 2.064024
## mmu00830 Retinol metabolism 2.078086
greaters <- keggres$greater
lessers <- keggres$less
keggrespathways = data.frame(id = rownames(keggres$greater), keggres$greater) %>%
tibble::as_tibble() %>%
filter(row_number()<=5) %>%
.$id %>%
as.character()
keggrespathways
## [1] "mmu04550 Signaling pathways regulating pluripotency of stem cells"
## [2] "mmu03010 Ribosome"
## [3] "mmu04330 Notch signaling pathway"
## [4] "mmu04350 TGF-beta signaling pathway"
## [5] "mmu04390 Hippo signaling pathway"
keggresids = substr(keggrespathways, start = 1, stop = 8)
keggresids
## [1] "mmu04550" "mmu03010" "mmu04330" "mmu04350" "mmu04390"
plot_pathway = function(pid) pathview(gene.data=foldchanges, pathway.id =pid, species = "mouse", new.signature = FALSE)
# plot multiple pathways
tmp = sapply(keggresids, function(pid) pathview(gene.data = foldchanges, pathway.id =pid, species = "mmu"))
## 'select()' returned 1:1 mapping between keys and columns
## Info: Working in directory /home/student/Desktop/classroom/myfiles/mab151
## Info: Writing image file mmu04550.pathview.png
## 'select()' returned 1:1 mapping between keys and columns
## Info: Working in directory /home/student/Desktop/classroom/myfiles/mab151
## Info: Writing image file mmu03010.pathview.png
## 'select()' returned 1:1 mapping between keys and columns
## Info: Working in directory /home/student/Desktop/classroom/myfiles/mab151
## Info: Writing image file mmu04330.pathview.png
## 'select()' returned 1:1 mapping between keys and columns
## Info: Working in directory /home/student/Desktop/classroom/myfiles/mab151
## Info: Writing image file mmu04350.pathview.png
## 'select()' returned 1:1 mapping between keys and columns
## Info: Working in directory /home/student/Desktop/classroom/myfiles/mab151
## Info: Writing image file mmu04390.pathview.png
keggrespathways = data.frame(id = rownames(keggres$less), keggres$less) %>%
tibble::as_tibble() %>%
filter(row_number()<=5) %>%
.$id %>%
as.character()
keggrespathways
## [1] "mmu04613 Neutrophil extracellular trap formation"
## [2] "mmu04145 Phagosome"
## [3] "mmu04110 Cell cycle"
## [4] "mmu04714 Thermogenesis"
## [5] "mmu04217 Necroptosis"
keggresids = substr(keggrespathways, start = 1, stop = 8)
keggresids
## [1] "mmu04613" "mmu04145" "mmu04110" "mmu04714" "mmu04217"
plot_pathway = function(pid) pathview(gene.data=foldchanges, pathway.id =pid, species = "mouse", new.signature = FALSE)
# plot multiple pathways
tmp = sapply(keggresids, function(pid) pathview(gene.data = foldchanges, pathway.id =pid, species = "mmu"))
## 'select()' returned 1:1 mapping between keys and columns
## Info: Working in directory /home/student/Desktop/classroom/myfiles/mab151
## Info: Writing image file mmu04613.pathview.png
## 'select()' returned 1:1 mapping between keys and columns
## Info: Working in directory /home/student/Desktop/classroom/myfiles/mab151
## Info: Writing image file mmu04145.pathview.png
## 'select()' returned 1:1 mapping between keys and columns
## Info: Working in directory /home/student/Desktop/classroom/myfiles/mab151
## Info: Writing image file mmu04110.pathview.png
## 'select()' returned 1:1 mapping between keys and columns
## Info: Working in directory /home/student/Desktop/classroom/myfiles/mab151
## Info: Writing image file mmu04714.pathview.png
## 'select()' returned 1:1 mapping between keys and columns
## Info: Working in directory /home/student/Desktop/classroom/myfiles/mab151
## Info: Writing image file mmu04217.pathview.png
library(imager)
## Loading required package: magrittr
##
## Attaching package: 'magrittr'
## The following object is masked from 'package:ShortRead':
##
## functions
## The following object is masked from 'package:GenomicRanges':
##
## subtract
## The following object is masked from 'package:purrr':
##
## set_names
## The following object is masked from 'package:tidyr':
##
## extract
##
## Attaching package: 'imager'
## The following object is masked from 'package:magrittr':
##
## add
## The following objects are masked from 'package:ShortRead':
##
## clean, width
## The following object is masked from 'package:GenomicAlignments':
##
## width
## The following objects are masked from 'package:SummarizedExperiment':
##
## resize, width
## The following objects are masked from 'package:GenomicRanges':
##
## resize, width
## The following object is masked from 'package:Biostrings':
##
## width
## The following object is masked from 'package:XVector':
##
## width
## The following objects are masked from 'package:oligoClasses':
##
## B, B<-
## The following objects are masked from 'package:IRanges':
##
## resize, width
## The following object is masked from 'package:S4Vectors':
##
## width
## The following object is masked from 'package:Biobase':
##
## channel
## The following object is masked from 'package:BiocGenerics':
##
## width
## The following object is masked from 'package:stringr':
##
## boundary
## The following object is masked from 'package:dplyr':
##
## where
## The following object is masked from 'package:tidyr':
##
## fill
## The following objects are masked from 'package:stats':
##
## convolve, spectrum
## The following object is masked from 'package:graphics':
##
## frame
## The following object is masked from 'package:base':
##
## save.image
filenames <- list.files(path = "/home/student/Desktop/classroom/myfiles/mab151", pattern =".*pathview.png")
all_images <- lapply(filenames, load.image)
knitr::include_graphics(filenames)













#DESq2 Lets load the required libraries for this anaylsis
library("DESeq2")
##
## Attaching package: 'DESeq2'
## The following object is masked from 'package:systemPipeR':
##
## results
library("dplyr")
library("apeglm")
Lets load in our data
countData <- read.csv("GLDS-102_rna_seq_Unnormalized_Counts.csv")
colData <- read.csv("PHENO_DATA_mouse.csv", sep = ",", row.names = 1)
Now we need to add leveling factors to the colData
colData$group <- factor(colData$group, levels = c("0", "1"))
Now lets make sure we have the same number of individuals as well as
groups
all(rownames(colData)) %in% colnames(countData)
## Warning in all(rownames(colData)): coercing argument of type 'character' to
## logical
## [1] FALSE
We need to round up the counts, because DESeq2 only allows intergers
as an input, and not fracitonal numbers. This depends on the method of
alignment that was used upstream.
countData %>%
mutate_if(is.numeric, ceiling)
countData[, 2:13] <- sapply(countData[,2:13], as.integer)
row.names(countData) <- countData[,1]
countData <- countData[2:13]
rownames(colData) == colnames(countData)
dds <- DESeqDataSetFromMatrix(countData = countData, colData = colData, design = ~group)
dds <- dds[rowSums(counts(dds)>2)>=4]
dds <- DESeq(dds)
## estimating size factors
## estimating dispersions
## gene-wise dispersion estimates
## mean-dispersion relationship
## final dispersion estimates
## fitting model and testing
res <- results(dds)
resLFc <- lfcShrink(dds, coef = 2)
## using 'apeglm' for LFC shrinkage. If used in published research, please cite:
## Zhu, A., Ibrahim, J.G., Love, M.I. (2018) Heavy-tailed prior distributions for
## sequence count data: removing the noise and preserving large differences.
## Bioinformatics. https://doi.org/10.1093/bioinformatics/bty895
(resOrdered <- res[order(res$padj), ])
## log2 fold change (MLE): group 1 vs 0
## Wald test p-value: group 1 vs 0
## DataFrame with 22008 rows and 6 columns
## baseMean log2FoldChange lfcSE stat pvalue
## <numeric> <numeric> <numeric> <numeric> <numeric>
## ENSMUSG00000002250 1459.223 -0.926292 0.1112628 -8.32526 8.41430e-17
## ENSMUSG00000007872 1719.375 0.818829 0.1122820 7.29261 3.04014e-13
## ENSMUSG00000026077 437.035 -1.191812 0.1655873 -7.19748 6.13338e-13
## ENSMUSG00000040998 14579.593 -0.506307 0.0703771 -7.19421 6.28252e-13
## ENSMUSG00000021775 2804.923 0.842511 0.1233312 6.83129 8.41546e-12
## ... ... ... ... ... ...
## ENSMUSG00000118345 4.22314 -0.12097478 0.599072 -0.20193699 0.839966
## ENSMUSG00000118353 6.60578 0.56456713 0.481195 1.17326031 0.240691
## ENSMUSG00000118358 3.30902 -0.00273584 0.763559 -0.00358301 0.997141
## ENSMUSG00000118369 2.91657 -1.11623145 0.790702 -1.41169702 0.158039
## ENSMUSG00000118384 7.43136 0.23830798 0.489273 0.48706567 0.626212
## padj
## <numeric>
## ENSMUSG00000002250 1.24077e-12
## ENSMUSG00000007872 2.24149e-09
## ENSMUSG00000026077 2.31605e-09
## ENSMUSG00000040998 2.31605e-09
## ENSMUSG00000021775 2.48189e-08
## ... ...
## ENSMUSG00000118345 NA
## ENSMUSG00000118353 NA
## ENSMUSG00000118358 NA
## ENSMUSG00000118369 NA
## ENSMUSG00000118384 NA
summary(res)
##
## out of 22008 with nonzero total read count
## adjusted p-value < 0.1
## LFC > 0 (up) : 325, 1.5%
## LFC < 0 (down) : 327, 1.5%
## outliers [1] : 15, 0.068%
## low counts [2] : 7247, 33%
## (mean count < 38)
## [1] see 'cooksCutoff' argument of ?results
## [2] see 'independentFiltering' argument of ?results
FLT_Vs_GC <- as.data.frame(res$log2FoldChange)
head(FLT_Vs_GC)
## res$log2FoldChange
## 1 0.042143404
## 2 -0.133427063
## 3 -0.018531421
## 4 -0.088172704
## 5 -0.007903417
## 6 0.113559785
plotMA(resLFc, ylim = c(-2,2))

pdf(file = "MA_Plot_FLT_vs_GC.pdf")
dev.off()
## png
## 2
Lets save our differential expression results to file.
write.csv(as.data.frame(resOrdered), file = "Mouse_DESeq.csv")
Lets perform a custom transformation
dds <- estimateSizeFactors(dds)
se <- SummarizedExperiment(log2(counts(dds, normalize = TRUE) +1), colData = colData(dds))
pdf(file = "PCA_PLOT_FLT_vs_GC.pdf")
plotPCA(DESeqTransform(se), intgroup = "group")
## using ntop=500 top features by variance
Lets load our required packages
library(AnnotationDbi)
library(org.Mm.eg.db)
columns(org.Mm.eg.db)
## [1] "ACCNUM" "ALIAS" "ENSEMBL" "ENSEMBLPROT" "ENSEMBLTRANS"
## [6] "ENTREZID" "ENZYME" "EVIDENCE" "EVIDENCEALL" "GENENAME"
## [11] "GENETYPE" "GO" "GOALL" "IPI" "MGI"
## [16] "ONTOLOGY" "ONTOLOGYALL" "PATH" "PFAM" "PMID"
## [21] "PROSITE" "REFSEQ" "SYMBOL" "UNIPROT"
foldchanges <- as.data.frame(res$log2FoldChange, row.names = row.names(res))
head(foldchanges)
## res$log2FoldChange
## ENSMUSG00000000001 0.042143404
## ENSMUSG00000000028 -0.133427063
## ENSMUSG00000000031 -0.018531421
## ENSMUSG00000000037 -0.088172704
## ENSMUSG00000000049 -0.007903417
## ENSMUSG00000000056 0.113559785
res$symbol = mapIds(org.Mm.eg.db,
keys = row.names(res),
column = "SYMBOL",
keytype = "ENSEMBL",
multiVals = "first")
## 'select()' returned 1:many mapping between keys and columns
res$entrez = mapIds(org.Mm.eg.db,
keys = row.names(res),
column = "ENTREZID",
keytype = "ENSEMBL",
multiVals = "first")
## 'select()' returned 1:many mapping between keys and columns
res$name = mapIds(org.Mm.eg.db,
keys = row.names(res),
column = "GENENAME",
keytype = "ENSEMBL",
multiVals = "first")
## 'select()' returned 1:many mapping between keys and columns
head(res, 10)
## log2 fold change (MLE): group 1 vs 0
## Wald test p-value: group 1 vs 0
## DataFrame with 10 rows and 9 columns
## baseMean log2FoldChange lfcSE stat pvalue
## <numeric> <numeric> <numeric> <numeric> <numeric>
## ENSMUSG00000000001 3132.35128 0.04214340 0.0436714 0.9650117 0.334539
## ENSMUSG00000000028 68.75801 -0.13342706 0.1565936 -0.8520597 0.394181
## ENSMUSG00000000031 21.05397 -0.01853142 0.2486477 -0.0745288 0.940590
## ENSMUSG00000000037 24.42314 -0.08817270 0.2982220 -0.2956613 0.767489
## ENSMUSG00000000049 3.24919 -0.00790342 0.9613572 -0.0082211 0.993441
## ENSMUSG00000000056 1424.88216 0.11355979 0.0777635 1.4603234 0.144201
## ENSMUSG00000000058 1420.78992 -0.03893850 0.0850602 -0.4577759 0.647113
## ENSMUSG00000000078 2254.53129 -0.07540275 0.0874314 -0.8624214 0.388456
## ENSMUSG00000000085 822.68179 0.04586772 0.0584699 0.7844667 0.432766
## ENSMUSG00000000088 5946.81754 -0.05461549 0.0691178 -0.7901795 0.429423
## padj symbol entrez name
## <numeric> <character> <character> <character>
## ENSMUSG00000000001 0.739637 Gnai3 14679 G protein subunit al..
## ENSMUSG00000000028 0.777085 Cdc45 12544 cell division cycle 45
## ENSMUSG00000000031 NA H19 14955 H19, imprinted mater..
## ENSMUSG00000000037 NA Scml2 107815 Scm polycomb group p..
## ENSMUSG00000000049 NA Apoh 11818 apolipoprotein H
## ENSMUSG00000000056 0.547527 Narf 67608 nuclear prelamin A r..
## ENSMUSG00000000058 0.901904 Cav2 12390 caveolin 2
## ENSMUSG00000000078 0.774294 Klf6 23849 Kruppel-like transcr..
## ENSMUSG00000000085 0.800018 Scmh1 29871 sex comb on midleg h..
## ENSMUSG00000000088 0.798420 Cox5a 12858 cytochrome c oxidase..
Lets load our pathview packages
library(pathview)
library(gage)
library(gageData)
data(kegg.sets.mm)
data(go.subs.mm)
foldchanges <- res$log2FoldChange
names(foldchanges) = res$entrez
head(foldchanges)
## 14679 12544 14955 107815 11818 67608
## 0.042143404 -0.133427063 -0.018531421 -0.088172704 -0.007903417 0.113559785
kegg.mm <- kegg.gsets("mmu", id.type = "entrez")
kegg.mm.sigmet <- kegg.mm$kg.sets[kegg.mm$sigmet.idx]
lets map the results
keggres <- gage(foldchanges, gsets = kegg.mm.sigmet, same.dir = TRUE)
lapply(keggres, head)
## $greater
## p.geomean stat.mean p.val
## mmu04022 cGMP-PKG signaling pathway 0.03029517 1.883802 0.03029517
## mmu04360 Axon guidance 0.03818124 1.778505 0.03818124
## mmu03010 Ribosome 0.04102493 1.745832 0.04102493
## mmu04330 Notch signaling pathway 0.04176177 1.753254 0.04176177
## mmu04658 Th1 and Th2 cell differentiation 0.05381907 1.620159 0.05381907
## mmu04015 Rap1 signaling pathway 0.07585374 1.437242 0.07585374
## q.val set.size exp1
## mmu04022 cGMP-PKG signaling pathway 0.9001224 152 0.03029517
## mmu04360 Axon guidance 0.9001224 176 0.03818124
## mmu03010 Ribosome 0.9001224 174 0.04102493
## mmu04330 Notch signaling pathway 0.9001224 58 0.04176177
## mmu04658 Th1 and Th2 cell differentiation 0.9001224 78 0.05381907
## mmu04015 Rap1 signaling pathway 0.9001224 195 0.07585374
##
## $less
## p.geomean stat.mean
## mmu04613 Neutrophil extracellular trap formation 0.004268865 -2.648234
## mmu04110 Cell cycle 0.006235122 -2.517638
## mmu04657 IL-17 signaling pathway 0.011254490 -2.306702
## mmu04145 Phagosome 0.033200917 -1.842912
## mmu04621 NOD-like receptor signaling pathway 0.038765200 -1.771785
## mmu04625 C-type lectin receptor signaling pathway 0.044104642 -1.713772
## p.val q.val
## mmu04613 Neutrophil extracellular trap formation 0.004268865 0.7513322
## mmu04110 Cell cycle 0.006235122 0.7513322
## mmu04657 IL-17 signaling pathway 0.011254490 0.9041107
## mmu04145 Phagosome 0.033200917 0.9057619
## mmu04621 NOD-like receptor signaling pathway 0.038765200 0.9057619
## mmu04625 C-type lectin receptor signaling pathway 0.044104642 0.9057619
## set.size exp1
## mmu04613 Neutrophil extracellular trap formation 160 0.004268865
## mmu04110 Cell cycle 151 0.006235122
## mmu04657 IL-17 signaling pathway 75 0.011254490
## mmu04145 Phagosome 144 0.033200917
## mmu04621 NOD-like receptor signaling pathway 154 0.038765200
## mmu04625 C-type lectin receptor signaling pathway 99 0.044104642
##
## $stats
## stat.mean exp1
## mmu04022 cGMP-PKG signaling pathway 1.883802 1.883802
## mmu04360 Axon guidance 1.778505 1.778505
## mmu03010 Ribosome 1.745832 1.745832
## mmu04330 Notch signaling pathway 1.753254 1.753254
## mmu04658 Th1 and Th2 cell differentiation 1.620159 1.620159
## mmu04015 Rap1 signaling pathway 1.437242 1.437242
Lets save our greater and less than pathways
greaters <- keggres$greater
lessers <- keggres$less
keggrespathways <- data.frame(id = rownames(keggres$greater), keggres$greater) %>%
tibble::as_tibble() %>%
filter(row_number() <= 3) %>%
.$id %>%
as.character()
keggrespathways
## [1] "mmu04022 cGMP-PKG signaling pathway" "mmu04360 Axon guidance"
## [3] "mmu03010 Ribosome"
keggresids <- substr(keggrespathways, start = 1, stop = 8)
keggresids
## [1] "mmu04022" "mmu04360" "mmu03010"
PLOT!
plot_pathway = function(pid) pathview(gene.data = foldchange, pathway.id = pid, species = "mmu", new.signature = FALSE)
tmp = sapply(keggresids, function(pid) pathview(gene.data = foldchanges, pathway.id = pid, species = "mmu"))
## 'select()' returned 1:1 mapping between keys and columns
## Info: Working in directory /home/student/Desktop/classroom/myfiles/mab151
## Info: Writing image file mmu04022.pathview.png
## 'select()' returned 1:1 mapping between keys and columns
## Info: Working in directory /home/student/Desktop/classroom/myfiles/mab151
## Info: Writing image file mmu04360.pathview.png
## 'select()' returned 1:1 mapping between keys and columns
## Info: Working in directory /home/student/Desktop/classroom/myfiles/mab151
## Info: Writing image file mmu03010.pathview.png
keggrespathways <- data.frame(id = rownames(keggres$less), keggres$less) %>%
tibble::as_tibble() %>%
filter(row_number() <= 3) %>%
.$id %>%
as.character()
keggrespathways
## [1] "mmu04613 Neutrophil extracellular trap formation"
## [2] "mmu04110 Cell cycle"
## [3] "mmu04657 IL-17 signaling pathway"
keggresids <- substr(keggrespathways, start = 1, stop = 8)
keggresids
## [1] "mmu04613" "mmu04110" "mmu04657"
PLOT!
plot_pathway = function(pid) pathview(gene.data = foldchanges, pathway.id = pid, species = "mmu", new.signature = FALSE)
tmp = sapply(keggresids, function(pid) pathview(gene.data = foldchanges, pathway.id = pid, species = "mmu"))
## 'select()' returned 1:1 mapping between keys and columns
## Info: Working in directory /home/student/Desktop/classroom/myfiles/mab151
## Info: Writing image file mmu04613.pathview.png
## 'select()' returned 1:1 mapping between keys and columns
## Info: Working in directory /home/student/Desktop/classroom/myfiles/mab151
## Info: Writing image file mmu04110.pathview.png
## 'select()' returned 1:1 mapping between keys and columns
## Info: Working in directory /home/student/Desktop/classroom/myfiles/mab151
## Info: Writing image file mmu04657.pathview.png
library(imager)
filenames <- list.files(path = "/home/student/Desktop/classroom/myfiles/mab151", pattern = ".*pathview.png")
all_images <- lapply(filenames, load.image)
knitr::include_graphics(filenames)













library(tidyverse)
EdgeR <- read.csv("Mouse_EdgeR_Results_Zero_vs_1.csv")
DESeq <- read.csv("Mouse_DESeq.csv")
DESeq2 <- DESeq %>%
filter(padj < 0.1)
DESeq2 <- DESeq2[, c(1,3)]
EdgeR <- EdgeR[, 1:2]
colnames(DESeq2) <- c("ID", "logFC")
colnames(EdgeR) <- c("ID", "logFC")
#install.packages("GOplot")
library(GOplot)
## Loading required package: ggdendro
##
## Attaching package: 'ggdendro'
## The following object is masked from 'package:imager':
##
## label
## Loading required package: gridExtra
##
## Attaching package: 'gridExtra'
## The following object is masked from 'package:Biobase':
##
## combine
## The following object is masked from 'package:BiocGenerics':
##
## combine
## The following object is masked from 'package:dplyr':
##
## combine
## Loading required package: RColorBrewer
comp <- GOVenn(DESeq2, EdgeR, label = c("DESeq1, EdgeR"), title = "Comparison of DESeq and EdgeR DE Genes", plot = FALSE)
## Warning in max(subset(outerCircle, id == label[2])$x): no non-missing arguments
## to max; returning -Inf
comp$plot

comp$table
## $A_only
## logFC Trend
## ENSMUSG00000022580 -0.34043605 DOWN
## ENSMUSG00000006517 -0.36062604 DOWN
## ENSMUSG00000038375 -0.31130461 DOWN
## ENSMUSG00000032374 -0.33109905 DOWN
## ENSMUSG00000014158 -0.24502238 DOWN
## ENSMUSG00000026179 -0.27739727 DOWN
## ENSMUSG00000037455 -0.31862627 DOWN
## ENSMUSG00000020232 -0.21361217 DOWN
## ENSMUSG00000023367 -0.22178404 DOWN
## ENSMUSG00000079465 -0.34758710 DOWN
## ENSMUSG00000032911 -0.25309500 DOWN
## ENSMUSG00000028671 -0.52885380 DOWN
## ENSMUSG00000022763 -0.46298775 DOWN
## ENSMUSG00000069565 -0.23279677 DOWN
## ENSMUSG00000029763 -0.32162558 DOWN
## ENSMUSG00000040263 -0.26665789 DOWN
## ENSMUSG00000039047 -0.19983906 DOWN
## ENSMUSG00000023938 -0.29838643 DOWN
## ENSMUSG00000048707 -0.25586039 DOWN
## ENSMUSG00000024958 -0.21648590 DOWN
## ENSMUSG00000022351 -0.37436283 DOWN
## ENSMUSG00000092500 -0.67848428 DOWN
## ENSMUSG00000031594 -0.70523616 DOWN
## ENSMUSG00000053414 -0.42344551 DOWN
## ENSMUSG00000035910 -0.46513297 DOWN
## ENSMUSG00000046079 -0.22956855 DOWN
## ENSMUSG00000039834 -0.20932200 DOWN
## ENSMUSG00000024064 -0.32190234 DOWN
## ENSMUSG00000017428 -0.19162199 DOWN
## ENSMUSG00000040188 -0.18162408 DOWN
## ENSMUSG00000026399 -0.46314331 DOWN
## ENSMUSG00000000594 -0.35328870 DOWN
## ENSMUSG00000001473 -0.52002824 DOWN
## ENSMUSG00000029032 -0.17274322 DOWN
## ENSMUSG00000034457 -0.65631310 DOWN
## ENSMUSG00000038704 -0.44210195 DOWN
## ENSMUSG00000004565 -0.18515711 DOWN
## ENSMUSG00000020381 -0.35535815 DOWN
## ENSMUSG00000041889 -0.40744760 DOWN
## ENSMUSG00000023259 -0.54936947 DOWN
## ENSMUSG00000100131 -0.74474095 DOWN
## ENSMUSG00000062203 -0.16941016 DOWN
## ENSMUSG00000025735 -0.54690338 DOWN
## ENSMUSG00000028545 -0.34910551 DOWN
## ENSMUSG00000058454 -0.32164280 DOWN
## ENSMUSG00000066441 -0.20590849 DOWN
## ENSMUSG00000022540 -0.22187166 DOWN
## ENSMUSG00000041939 -0.36932726 DOWN
## ENSMUSG00000035561 -0.62879396 DOWN
## ENSMUSG00000038023 -0.16230309 DOWN
## ENSMUSG00000101249 -0.42412986 DOWN
## ENSMUSG00000032370 -0.27699011 DOWN
## ENSMUSG00000004266 -0.24084074 DOWN
## ENSMUSG00000001627 -0.36761392 DOWN
## ENSMUSG00000029810 -0.21179083 DOWN
## ENSMUSG00000024579 -0.33851915 DOWN
## ENSMUSG00000030739 -0.25682885 DOWN
## ENSMUSG00000011382 -0.28887816 DOWN
## ENSMUSG00000032306 -0.19743357 DOWN
## ENSMUSG00000031960 -0.23176773 DOWN
## ENSMUSG00000022512 -0.31344079 DOWN
## ENSMUSG00000037243 -0.38350996 DOWN
## ENSMUSG00000028041 -0.22750078 DOWN
## ENSMUSG00000026307 -0.17987440 DOWN
## ENSMUSG00000029580 -0.22533941 DOWN
## ENSMUSG00000033107 -0.46466530 DOWN
## ENSMUSG00000112324 -1.17764416 DOWN
## ENSMUSG00000020744 -0.23882614 DOWN
## ENSMUSG00000055745 -0.33019362 DOWN
## ENSMUSG00000041959 -0.30235528 DOWN
## ENSMUSG00000036957 -0.23555650 DOWN
## ENSMUSG00000021697 -0.24350589 DOWN
## ENSMUSG00000037894 -0.14944012 DOWN
## ENSMUSG00000021792 -0.27076192 DOWN
## ENSMUSG00000037347 -0.58266833 DOWN
## ENSMUSG00000020877 -0.30477474 DOWN
## ENSMUSG00000087574 -0.52540516 DOWN
## ENSMUSG00000030512 -0.29687398 DOWN
## ENSMUSG00000006800 -0.38377676 DOWN
## ENSMUSG00000027412 -0.23807548 DOWN
## ENSMUSG00000031161 -0.19281421 DOWN
## ENSMUSG00000027429 -0.19684382 DOWN
## ENSMUSG00000045594 -0.32151069 DOWN
## ENSMUSG00000018171 -0.20991579 DOWN
## ENSMUSG00000032349 -0.20451880 DOWN
## ENSMUSG00000015094 -0.27391817 DOWN
## ENSMUSG00000028538 -0.21412826 DOWN
## ENSMUSG00000029616 -0.17008224 DOWN
## ENSMUSG00000019797 -0.25970900 DOWN
## ENSMUSG00000095193 -0.46525512 DOWN
## ENSMUSG00000068876 -0.36860006 DOWN
## ENSMUSG00000026784 -0.33710273 DOWN
## ENSMUSG00000057363 -0.23033682 DOWN
## ENSMUSG00000064367 -0.39714312 DOWN
## ENSMUSG00000024319 -0.16149089 DOWN
## ENSMUSG00000030137 -0.73293695 DOWN
## ENSMUSG00000030538 -0.20999518 DOWN
## ENSMUSG00000032978 -0.41230936 DOWN
## ENSMUSG00000069633 -0.24060250 DOWN
## ENSMUSG00000067158 -0.16710483 DOWN
## ENSMUSG00000024292 -0.69737707 DOWN
## ENSMUSG00000031958 -0.32616810 DOWN
## ENSMUSG00000064341 -0.42730743 DOWN
## ENSMUSG00000024993 -0.24009807 DOWN
## ENSMUSG00000074170 -0.32294297 DOWN
## ENSMUSG00000030641 -0.70784506 DOWN
## ENSMUSG00000034858 -0.24062718 DOWN
## ENSMUSG00000036040 -0.44878716 DOWN
## ENSMUSG00000063229 -0.27382474 DOWN
## ENSMUSG00000027490 -0.50089705 DOWN
## ENSMUSG00000047735 -0.29565887 DOWN
## ENSMUSG00000011752 -0.21564437 DOWN
## ENSMUSG00000034714 -0.25080269 DOWN
## ENSMUSG00000034613 -0.19780958 DOWN
## ENSMUSG00000032452 -0.36581093 DOWN
## ENSMUSG00000038775 -0.42844126 DOWN
## ENSMUSG00000045294 -0.41030779 DOWN
## ENSMUSG00000084128 -0.20450430 DOWN
## ENSMUSG00000037686 -0.48758044 DOWN
## ENSMUSG00000014245 -0.34281577 DOWN
## ENSMUSG00000029093 -0.70234753 DOWN
## ENSMUSG00000024736 -0.29462366 DOWN
## ENSMUSG00000028937 -0.45985182 DOWN
## ENSMUSG00000096795 -0.42948689 DOWN
## ENSMUSG00000051518 -0.23800525 DOWN
## ENSMUSG00000000934 -0.21014853 DOWN
## ENSMUSG00000030880 -0.37441058 DOWN
## ENSMUSG00000025726 -0.47088683 DOWN
## ENSMUSG00000052117 -0.38321567 DOWN
## ENSMUSG00000006342 -0.32237079 DOWN
## ENSMUSG00000062825 -0.21379569 DOWN
## ENSMUSG00000041733 -0.16402727 DOWN
## ENSMUSG00000028780 -0.39005496 DOWN
## ENSMUSG00000024665 -0.28310048 DOWN
## ENSMUSG00000025317 -0.45235802 DOWN
## ENSMUSG00000020142 -0.51264412 DOWN
## ENSMUSG00000082016 -0.49955518 DOWN
## ENSMUSG00000034371 -0.35642282 DOWN
## ENSMUSG00000032492 -0.23918204 DOWN
## ENSMUSG00000110755 -0.85464812 DOWN
## ENSMUSG00000064254 -0.35292181 DOWN
## ENSMUSG00000035845 -0.23039492 DOWN
## ENSMUSG00000017210 -0.18417790 DOWN
## ENSMUSG00000023832 -0.24175019 DOWN
## ENSMUSG00000037999 -0.13620662 DOWN
## ENSMUSG00000068220 -0.32723692 DOWN
## ENSMUSG00000064345 -0.46980898 DOWN
## ENSMUSG00000109532 -0.46848639 DOWN
## ENSMUSG00000024503 -0.29897613 DOWN
## ENSMUSG00000004843 -0.19267710 DOWN
## ENSMUSG00000030298 -0.18748533 DOWN
## ENSMUSG00000048578 -0.18464424 DOWN
## ENSMUSG00000085042 -0.53698651 DOWN
## ENSMUSG00000016942 -0.57269595 DOWN
## ENSMUSG00000020116 -0.22085460 DOWN
## ENSMUSG00000028989 -0.83020473 DOWN
## ENSMUSG00000045328 -0.67535269 DOWN
## ENSMUSG00000022012 -0.60236758 DOWN
## ENSMUSG00000030111 -0.89947043 DOWN
## ENSMUSG00000070283 -0.21761592 DOWN
## ENSMUSG00000015357 -0.25009527 DOWN
## ENSMUSG00000023004 -0.28582941 DOWN
## ENSMUSG00000026627 -0.31353739 DOWN
## ENSMUSG00000031604 -0.47098551 DOWN
## ENSMUSG00000032515 -0.30765131 DOWN
## ENSMUSG00000067924 -0.22381215 DOWN
## ENSMUSG00000037263 -0.84307635 DOWN
## ENSMUSG00000027230 -0.36164811 DOWN
## ENSMUSG00000110663 -0.54757250 DOWN
## ENSMUSG00000026042 -0.49210022 DOWN
## ENSMUSG00000024818 -0.34010637 DOWN
## ENSMUSG00000028063 -0.17577587 DOWN
## ENSMUSG00000002393 -0.15126020 DOWN
## ENSMUSG00000029304 -0.30383826 DOWN
## ENSMUSG00000063897 -0.23233448 DOWN
## ENSMUSG00000047281 -0.29186793 DOWN
## ENSMUSG00000020827 -0.09168105 DOWN
## ENSMUSG00000057103 -0.27231140 DOWN
## ENSMUSG00000035863 -0.13610649 DOWN
## ENSMUSG00000038217 -0.42652853 DOWN
## ENSMUSG00000021414 -0.46661624 DOWN
## ENSMUSG00000029394 -0.15498461 DOWN
## ENSMUSG00000025203 -0.44030029 DOWN
## ENSMUSG00000022021 -0.74691580 DOWN
## ENSMUSG00000021666 -0.17188589 DOWN
## ENSMUSG00000023153 -0.47625403 DOWN
## ENSMUSG00000032269 -0.48694668 DOWN
## ENSMUSG00000029701 -0.15488665 DOWN
## ENSMUSG00000044786 -0.44074359 DOWN
## ENSMUSG00000037470 -0.12784897 DOWN
## ENSMUSG00000003813 -0.17708927 DOWN
## ENSMUSG00000073405 -0.63005177 DOWN
## ENSMUSG00000022893 -0.26966324 DOWN
## ENSMUSG00000040694 -0.47993469 DOWN
## ENSMUSG00000078695 -0.22632974 DOWN
## ENSMUSG00000079261 -0.51711647 DOWN
## ENSMUSG00000022033 -0.71710771 DOWN
## ENSMUSG00000037169 -0.42847204 DOWN
## ENSMUSG00000031781 -0.21968285 DOWN
## ENSMUSG00000033538 -0.61098300 DOWN
## ENSMUSG00000058569 -0.13138672 DOWN
## ENSMUSG00000024683 -0.17417633 DOWN
## ENSMUSG00000027327 -0.29623261 DOWN
## ENSMUSG00000046999 -0.82105779 DOWN
## ENSMUSG00000036002 -0.17923658 DOWN
## ENSMUSG00000048277 -0.16122436 DOWN
## ENSMUSG00000039254 -0.17118157 DOWN
## ENSMUSG00000074890 -0.26457858 DOWN
## ENSMUSG00000020898 -0.17593559 DOWN
## ENSMUSG00000045725 -0.34833036 DOWN
## ENSMUSG00000069302 -0.82585594 DOWN
## ENSMUSG00000020917 -0.41372240 DOWN
## ENSMUSG00000025762 -0.15003923 DOWN
## ENSMUSG00000051397 -0.60203401 DOWN
## ENSMUSG00000071076 -0.32933199 DOWN
## ENSMUSG00000020062 -0.55686168 DOWN
## ENSMUSG00000027610 -0.20794747 DOWN
## ENSMUSG00000046603 -0.14976563 DOWN
## ENSMUSG00000026249 -0.39782610 DOWN
## ENSMUSG00000062248 -0.40340465 DOWN
## ENSMUSG00000067144 -0.58408027 DOWN
## ENSMUSG00000018427 -0.29793557 DOWN
## ENSMUSG00000029161 -0.31583678 DOWN
## ENSMUSG00000054951 -0.41975332 DOWN
## ENSMUSG00000026201 -0.16848363 DOWN
## ENSMUSG00000028001 -0.42942899 DOWN
## ENSMUSG00000055725 -0.33912602 DOWN
## ENSMUSG00000036452 -0.20940960 DOWN
## ENSMUSG00000038527 -0.27772701 DOWN
## ENSMUSG00000028042 -0.18167447 DOWN
## ENSMUSG00000056608 -0.36204115 DOWN
## ENSMUSG00000005667 -0.61927246 DOWN
## ENSMUSG00000037386 -0.40655769 DOWN
## ENSMUSG00000037725 -0.81899506 DOWN
## ENSMUSG00000047986 -0.32704252 DOWN
## ENSMUSG00000029771 -0.38565543 DOWN
## ENSMUSG00000032902 -0.54819451 DOWN
## ENSMUSG00000030805 -0.15360463 DOWN
## ENSMUSG00000102070 -0.34220468 DOWN
## ENSMUSG00000048911 -0.63602855 DOWN
## ENSMUSG00000020307 -0.20751527 DOWN
## ENSMUSG00000028327 -0.42924181 DOWN
## ENSMUSG00000061474 -0.21609621 DOWN
## ENSMUSG00000031776 -0.13310206 DOWN
## ENSMUSG00000023048 -0.18455058 DOWN
## ENSMUSG00000028834 -0.45291323 DOWN
## ENSMUSG00000032786 -0.34195633 DOWN
## ENSMUSG00000020571 -0.18909263 DOWN
## ENSMUSG00000026036 -0.18264554 DOWN
## ENSMUSG00000037103 -0.23365691 DOWN
## ENSMUSG00000032806 -0.21495738 DOWN
## ENSMUSG00000032115 -0.22570577 DOWN
## ENSMUSG00000026914 -0.18804137 DOWN
## ENSMUSG00000017221 -0.15410661 DOWN
## ENSMUSG00000093930 -0.25584929 DOWN
## ENSMUSG00000020775 -0.19252530 DOWN
## ENSMUSG00000015085 -0.27683632 DOWN
## ENSMUSG00000007783 -0.68091578 DOWN
## ENSMUSG00000040688 -0.16330101 DOWN
## ENSMUSG00000053291 -0.21867722 DOWN
## ENSMUSG00000027496 -0.54866734 DOWN
## ENSMUSG00000033031 -0.56341636 DOWN
## ENSMUSG00000030122 -0.20261560 DOWN
## ENSMUSG00000030340 -0.15278136 DOWN
## ENSMUSG00000045438 -0.17099859 DOWN
## ENSMUSG00000083287 -0.70234398 DOWN
## ENSMUSG00000017776 0.14272233 UP
## ENSMUSG00000050310 0.15730877 UP
## ENSMUSG00000039068 0.16552112 UP
## ENSMUSG00000021540 0.16974514 UP
## ENSMUSG00000031393 0.16555115 UP
## ENSMUSG00000036550 0.12156707 UP
## ENSMUSG00000020257 0.16527808 UP
## ENSMUSG00000022604 0.24502829 UP
## ENSMUSG00000028053 0.12934789 UP
## ENSMUSG00000030213 0.22802456 UP
## ENSMUSG00000060657 0.17091330 UP
## ENSMUSG00000002266 0.79783171 UP
## ENSMUSG00000027351 0.20109096 UP
## ENSMUSG00000041530 0.14167573 UP
## ENSMUSG00000031216 0.18505107 UP
## ENSMUSG00000025223 0.19904031 UP
## ENSMUSG00000032086 0.16026652 UP
## ENSMUSG00000050812 0.12317499 UP
## ENSMUSG00000038290 0.18129223 UP
## ENSMUSG00000038530 0.45839593 UP
## ENSMUSG00000038766 0.19354371 UP
## ENSMUSG00000050947 0.19499278 UP
## ENSMUSG00000045098 0.16736362 UP
## ENSMUSG00000026918 0.15066426 UP
## ENSMUSG00000037003 0.25424829 UP
## ENSMUSG00000074748 0.13496826 UP
## ENSMUSG00000097412 0.36207963 UP
## ENSMUSG00000031729 0.13562926 UP
## ENSMUSG00000060419 0.56685572 UP
## ENSMUSG00000027519 0.12701438 UP
## ENSMUSG00000021669 0.17305832 UP
## ENSMUSG00000051817 0.20501911 UP
## ENSMUSG00000043090 0.24594578 UP
## ENSMUSG00000037029 0.16142421 UP
## ENSMUSG00000027395 0.23250765 UP
## ENSMUSG00000021488 0.14004228 UP
## ENSMUSG00000073678 0.23800997 UP
## ENSMUSG00000041378 0.24727530 UP
## ENSMUSG00000046947 0.22963389 UP
## ENSMUSG00000058793 0.15787650 UP
## ENSMUSG00000037369 0.16875132 UP
## ENSMUSG00000035247 0.14419687 UP
## ENSMUSG00000026436 0.15115267 UP
## ENSMUSG00000046897 0.13756675 UP
## ENSMUSG00000057133 0.15198412 UP
## ENSMUSG00000027680 0.15459409 UP
## ENSMUSG00000043991 0.14326636 UP
## ENSMUSG00000034189 0.22252598 UP
## ENSMUSG00000018076 0.14012905 UP
## ENSMUSG00000052446 0.21343904 UP
## ENSMUSG00000000901 0.45991559 UP
## ENSMUSG00000040209 0.14891211 UP
## ENSMUSG00000021140 0.13983221 UP
## ENSMUSG00000015942 0.28091224 UP
## ENSMUSG00000043241 0.15443674 UP
## ENSMUSG00000017897 0.47930960 UP
## ENSMUSG00000022353 0.17044934 UP
## ENSMUSG00000005893 0.12727681 UP
## ENSMUSG00000044791 0.10791940 UP
## ENSMUSG00000034156 0.30435511 UP
## ENSMUSG00000037736 0.15594032 UP
## ENSMUSG00000059486 0.19137705 UP
## ENSMUSG00000040865 0.14637885 UP
## ENSMUSG00000035666 0.18348700 UP
## ENSMUSG00000029647 0.15099130 UP
## ENSMUSG00000038486 0.22349533 UP
## ENSMUSG00000025927 0.25984503 UP
## ENSMUSG00000022415 0.25978911 UP
## ENSMUSG00000092558 0.23291797 UP
## ENSMUSG00000014195 0.13187236 UP
## ENSMUSG00000019866 0.16782009 UP
## ENSMUSG00000078202 0.23751529 UP
## ENSMUSG00000035495 0.16182406 UP
## ENSMUSG00000044674 0.14713003 UP
## ENSMUSG00000102869 0.13344629 UP
## ENSMUSG00000026923 0.23816067 UP
## ENSMUSG00000020642 0.30373219 UP
## ENSMUSG00000037503 0.13213753 UP
## ENSMUSG00000043716 0.15548233 UP
## ENSMUSG00000037822 0.12323641 UP
## ENSMUSG00000035413 0.28018219 UP
## ENSMUSG00000021395 0.14521504 UP
## ENSMUSG00000036097 0.17021769 UP
## ENSMUSG00000034297 0.14164078 UP
## ENSMUSG00000037742 0.18278137 UP
## ENSMUSG00000031841 0.36669049 UP
## ENSMUSG00000021661 0.23587703 UP
## ENSMUSG00000021959 0.20075266 UP
## ENSMUSG00000020594 0.13250363 UP
## ENSMUSG00000027079 0.24468577 UP
## ENSMUSG00000087150 0.36942601 UP
## ENSMUSG00000091811 0.29288706 UP
## ENSMUSG00000066415 0.14665940 UP
## ENSMUSG00000027524 0.33434798 UP
## ENSMUSG00000008683 0.17886307 UP
## ENSMUSG00000066235 0.23782764 UP
## ENSMUSG00000099689 0.32626158 UP
## ENSMUSG00000074994 0.15405001 UP
## ENSMUSG00000005698 0.13620098 UP
## ENSMUSG00000020357 0.22004603 UP
## ENSMUSG00000051864 0.16719945 UP
## ENSMUSG00000033857 0.26199922 UP
## ENSMUSG00000027678 0.14062843 UP
## ENSMUSG00000028522 0.19096610 UP
## ENSMUSG00000038677 0.25597573 UP
## ENSMUSG00000031365 0.24344196 UP
## ENSMUSG00000079215 0.13562114 UP
## ENSMUSG00000008435 0.19593016 UP
## ENSMUSG00000022791 0.18451075 UP
## ENSMUSG00000035284 0.14974771 UP
## ENSMUSG00000071660 0.14855222 UP
## ENSMUSG00000031209 0.18013813 UP
## ENSMUSG00000043384 0.17656695 UP
## ENSMUSG00000062519 0.20297447 UP
## ENSMUSG00000046792 0.15421197 UP
## ENSMUSG00000060036 0.18317446 UP
## ENSMUSG00000027799 0.12769722 UP
## ENSMUSG00000070280 1.10401378 UP
## ENSMUSG00000039086 0.30162641 UP
## ENSMUSG00000010721 0.27895608 UP
## ENSMUSG00000026694 0.22373880 UP
## ENSMUSG00000090958 0.26005244 UP
## ENSMUSG00000041329 0.34034794 UP
## ENSMUSG00000110353 0.55867945 UP
## ENSMUSG00000024431 0.15484965 UP
## ENSMUSG00000028970 0.65324057 UP
## ENSMUSG00000044617 0.16893293 UP
## ENSMUSG00000053110 0.11279130 UP
## ENSMUSG00000033721 0.19446036 UP
## ENSMUSG00000033237 0.12502254 UP
## ENSMUSG00000026782 0.15350520 UP
## ENSMUSG00000020716 0.10673691 UP
## ENSMUSG00000028869 0.15740162 UP
## ENSMUSG00000040123 0.17586386 UP
## ENSMUSG00000023279 0.66039370 UP
## ENSMUSG00000031618 0.18153296 UP
## ENSMUSG00000046480 0.15271518 UP
## ENSMUSG00000053604 0.22222892 UP
## ENSMUSG00000019817 0.21644825 UP
## ENSMUSG00000063317 0.19166484 UP
## ENSMUSG00000027782 0.16867184 UP
## ENSMUSG00000003970 0.17459639 UP
## ENSMUSG00000020448 0.15632382 UP
## ENSMUSG00000075592 0.20864156 UP
## ENSMUSG00000005886 0.11350187 UP
## ENSMUSG00000097119 0.18600974 UP
## ENSMUSG00000049739 0.14773528 UP
## ENSMUSG00000033671 0.13212187 UP
## ENSMUSG00000036197 0.15522606 UP
## ENSMUSG00000048379 0.18278566 UP
## ENSMUSG00000039315 0.54908662 UP
## ENSMUSG00000033943 0.12402969 UP
## ENSMUSG00000017418 0.17834030 UP
## ENSMUSG00000041037 0.15250502 UP
## ENSMUSG00000048696 0.29218801 UP
## ENSMUSG00000039801 0.13664543 UP
## ENSMUSG00000060938 0.15419599 UP
## ENSMUSG00000049800 0.17484586 UP
## ENSMUSG00000013921 0.35894737 UP
## ENSMUSG00000031169 0.32132644 UP
## ENSMUSG00000106062 0.64153454 UP
## ENSMUSG00000017405 0.22549792 UP
## ENSMUSG00000034647 0.18745771 UP
## ENSMUSG00000095597 0.39811948 UP
## ENSMUSG00000048170 0.11852429 UP
## ENSMUSG00000038437 0.14446619 UP
## ENSMUSG00000043929 0.20035517 UP
## ENSMUSG00000052751 0.12710168 UP
## ENSMUSG00000038481 0.16330703 UP
## ENSMUSG00000090083 0.19007239 UP
## ENSMUSG00000034893 0.13303380 UP
## ENSMUSG00000069682 0.29528352 UP
## ENSMUSG00000025571 0.16972600 UP
## ENSMUSG00000040481 0.13665506 UP
## ENSMUSG00000009470 0.13683942 UP
## ENSMUSG00000038056 0.10731006 UP
## ENSMUSG00000020491 0.28645703 UP
## ENSMUSG00000038544 0.22610491 UP
## ENSMUSG00000015290 0.12352423 UP
## ENSMUSG00000017667 0.23232912 UP
## ENSMUSG00000037712 0.15193533 UP
## ENSMUSG00000031754 0.15231535 UP
## ENSMUSG00000039377 0.40927593 UP
## ENSMUSG00000065954 0.12953537 UP
## ENSMUSG00000021180 0.25150897 UP
## ENSMUSG00000021144 0.12282361 UP
## ENSMUSG00000032892 0.26597783 UP
## ENSMUSG00000047632 0.36107347 UP
## ENSMUSG00000036990 0.13781495 UP
## ENSMUSG00000025997 0.16500177 UP
## ENSMUSG00000025195 0.13258367 UP
## ENSMUSG00000018736 0.15633740 UP
## ENSMUSG00000002748 0.16011254 UP
## ENSMUSG00000062866 0.13881629 UP
## ENSMUSG00000047888 0.15729387 UP
## ENSMUSG00000053754 0.08600731 UP
## ENSMUSG00000105692 0.42397863 UP
## ENSMUSG00000029154 0.22432452 UP
## ENSMUSG00000062328 0.13488986 UP
## ENSMUSG00000020460 0.13408620 UP
## ENSMUSG00000026455 0.13998146 UP
## ENSMUSG00000028936 0.18765138 UP
## ENSMUSG00000048285 0.32387857 UP
##
## $B_only
## logFC Trend
## ENSMUSG00000095616 -2.1769413 DOWN
## ENSMUSG00000055254 -1.2550987 DOWN
## ENSMUSG00000036083 -0.4183815 DOWN
## ENSMUSG00000062901 0.3741223 UP
## ENSMUSG00000066113 0.5444662 UP
## ENSMUSG00000047861 0.4833056 UP
## ENSMUSG00000068270 0.3687809 UP
## ENSMUSG00000026315 0.4760848 UP
## ENSMUSG00000010651 0.3674542 UP
## ENSMUSG00000057914 0.6513540 UP
## ENSMUSG00000038567 0.7894624 UP
## ENSMUSG00000021379 0.4261534 UP
## ENSMUSG00000038528 0.2751894 UP
## ENSMUSG00000021876 1.0238526 UP
## ENSMUSG00000020566 0.3838638 UP
## ENSMUSG00000002289 0.9577221 UP
## ENSMUSG00000025880 0.3280076 UP
## ENSMUSG00000032898 0.2977232 UP
## ENSMUSG00000051344 0.4008839 UP
## ENSMUSG00000028234 0.2801047 UP
## ENSMUSG00000059173 0.3074740 UP
## ENSMUSG00000061410 0.2636736 UP
## ENSMUSG00000104445 0.2893000 UP
## ENSMUSG00000029004 0.2574155 UP
## ENSMUSG00000006599 0.3044062 UP
## ENSMUSG00000031530 0.4642611 UP
## ENSMUSG00000075520 0.3179824 UP
## ENSMUSG00000032604 0.2684222 UP
## ENSMUSG00000013089 0.4781068 UP
## ENSMUSG00000037058 0.2529552 UP
## ENSMUSG00000090165 0.7184069 UP
## ENSMUSG00000078429 0.2515789 UP
## ENSMUSG00000032554 0.5171617 UP
## ENSMUSG00000028266 0.2821554 UP
## ENSMUSG00000035504 0.4448372 UP
## ENSMUSG00000042379 0.6582600 UP
## ENSMUSG00000063415 0.5843388 UP
## ENSMUSG00000074179 0.5499015 UP
## ENSMUSG00000006494 0.2894124 UP
## ENSMUSG00000024472 0.3129528 UP
##
## $AB
## logFC_A logFC_B Trend
## ENSMUSG00000000253 -0.3595434 -0.2925206 DOWN
## ENSMUSG00000002250 -0.9262920 -0.8282806 DOWN
## ENSMUSG00000002797 -0.5260248 -0.4517791 DOWN
## ENSMUSG00000010663 -0.3768825 -0.3084000 DOWN
## ENSMUSG00000019944 -0.4292397 -0.5013974 DOWN
## ENSMUSG00000020326 -0.3483812 -0.2768944 DOWN
## ENSMUSG00000020538 -0.3380728 -0.4083125 DOWN
## ENSMUSG00000021135 -1.2370702 -1.1731063 DOWN
## ENSMUSG00000021185 -0.3740370 -0.3129352 DOWN
## ENSMUSG00000021214 -1.2910376 -1.2281892 DOWN
## ENSMUSG00000021364 -0.3535149 -0.2870384 DOWN
## ENSMUSG00000021670 -0.5234895 -0.5082552 DOWN
## ENSMUSG00000022797 -0.7591996 -0.6067643 DOWN
## ENSMUSG00000023067 -0.9245223 -0.8580091 DOWN
## ENSMUSG00000023120 -0.6574366 -0.7378386 DOWN
## ENSMUSG00000024772 -0.2141711 -0.2582016 DOWN
## ENSMUSG00000024866 -0.4551473 -0.4012607 DOWN
## ENSMUSG00000025185 -0.7766326 -0.7215431 DOWN
## ENSMUSG00000026077 -1.1918119 -1.3621448 DOWN
## ENSMUSG00000026188 -0.9720112 -0.8556904 DOWN
## ENSMUSG00000026189 -0.4861550 -0.4239890 DOWN
## ENSMUSG00000026202 -0.4756290 -0.4111740 DOWN
## ENSMUSG00000026827 -0.5840987 -0.5268599 DOWN
## ENSMUSG00000027111 -0.4662478 -0.3937836 DOWN
## ENSMUSG00000028357 -0.3743350 -0.3168247 DOWN
## ENSMUSG00000028919 -0.4216940 -0.3932807 DOWN
## ENSMUSG00000029361 -0.4016061 -0.6131567 DOWN
## ENSMUSG00000029752 -0.8326830 -0.7354788 DOWN
## ENSMUSG00000031283 -0.8186760 -0.8097413 DOWN
## ENSMUSG00000031349 -0.3866416 -0.3095144 DOWN
## ENSMUSG00000031725 -0.6273191 -0.5866902 DOWN
## ENSMUSG00000031994 -1.3340728 -1.2576373 DOWN
## ENSMUSG00000032420 -0.3875385 -0.3222816 DOWN
## ENSMUSG00000032758 -1.4700634 -1.4085255 DOWN
## ENSMUSG00000036752 -0.4901839 -0.4156718 DOWN
## ENSMUSG00000038224 -0.7736283 -0.6928777 DOWN
## ENSMUSG00000039062 -0.3740538 -0.3242167 DOWN
## ENSMUSG00000040998 -0.5063074 -0.4316969 DOWN
## ENSMUSG00000041605 -0.5089056 -0.4533881 DOWN
## ENSMUSG00000041920 -0.6988893 -0.6622833 DOWN
## ENSMUSG00000042487 -0.4880863 -0.4219246 DOWN
## ENSMUSG00000043091 -0.4290291 -0.3506166 DOWN
## ENSMUSG00000043681 -0.8131008 -0.7323673 DOWN
## ENSMUSG00000045136 -0.5276351 -0.4432654 DOWN
## ENSMUSG00000046070 -0.4976464 -0.4205017 DOWN
## ENSMUSG00000050097 -0.6917475 -0.6612130 DOWN
## ENSMUSG00000052562 -1.2044944 -1.1184746 DOWN
## ENSMUSG00000053303 -1.4525889 -1.3609659 DOWN
## ENSMUSG00000054520 -0.5348849 -0.5477566 DOWN
## ENSMUSG00000054986 -1.1315223 -1.0443240 DOWN
## ENSMUSG00000055116 -1.0422718 -0.9731592 DOWN
## ENSMUSG00000056749 -1.0285015 -0.9546407 DOWN
## ENSMUSG00000058258 -0.5010186 -0.4721006 DOWN
## ENSMUSG00000058672 -0.4863467 -0.4123032 DOWN
## ENSMUSG00000059743 -0.4205600 -0.3535114 DOWN
## ENSMUSG00000063694 -0.3459939 -0.2987493 DOWN
## ENSMUSG00000070985 -0.4878334 -0.3757916 DOWN
## ENSMUSG00000074261 -0.3726946 -0.3033684 DOWN
## ENSMUSG00000074715 -2.0504604 -1.9895168 DOWN
## ENSMUSG00000090236 -0.3588040 -0.3275031 DOWN
## ENSMUSG00000090264 -0.8530214 -0.7862631 DOWN
## ENSMUSG00000001280 0.1698162 0.2551824 UP
## ENSMUSG00000002265 0.3432974 0.3896732 UP
## ENSMUSG00000002346 0.4050076 0.4901537 UP
## ENSMUSG00000003477 0.6201260 0.6980817 UP
## ENSMUSG00000003849 0.3268514 0.3867684 UP
## ENSMUSG00000004105 0.3051901 0.3657005 UP
## ENSMUSG00000005034 0.1518728 0.2316732 UP
## ENSMUSG00000005483 0.3557327 0.4241636 UP
## ENSMUSG00000006127 0.2370249 0.2812682 UP
## ENSMUSG00000006216 0.2231693 0.3428627 UP
## ENSMUSG00000006269 0.1935071 0.2633107 UP
## ENSMUSG00000006333 0.1880189 0.2564139 UP
## ENSMUSG00000007872 0.8188287 0.8863833 UP
## ENSMUSG00000008682 0.2388295 0.3007693 UP
## ENSMUSG00000009927 0.1561310 0.2337027 UP
## ENSMUSG00000012848 0.2152579 0.2808452 UP
## ENSMUSG00000015656 0.3554208 0.3920070 UP
## ENSMUSG00000015957 1.1509070 1.4052695 UP
## ENSMUSG00000018900 0.4488356 0.5203872 UP
## ENSMUSG00000020372 0.1998048 0.2766451 UP
## ENSMUSG00000020427 0.6444349 0.7133284 UP
## ENSMUSG00000020473 0.2594927 0.3344559 UP
## ENSMUSG00000020482 0.3439173 0.4123332 UP
## ENSMUSG00000020607 0.3840443 0.4510781 UP
## ENSMUSG00000020653 0.8137974 0.8900246 UP
## ENSMUSG00000020889 0.7411906 0.7898922 UP
## ENSMUSG00000021482 0.2206442 0.2687837 UP
## ENSMUSG00000021508 0.7503095 0.8098564 UP
## ENSMUSG00000021775 0.8425111 0.9537055 UP
## ENSMUSG00000022122 0.4229408 0.4711366 UP
## ENSMUSG00000022389 0.6490066 0.7106873 UP
## ENSMUSG00000022949 0.7215862 0.7968710 UP
## ENSMUSG00000023022 0.2296504 0.2658583 UP
## ENSMUSG00000024298 0.2170724 0.3175357 UP
## ENSMUSG00000024900 0.3839135 0.4486259 UP
## ENSMUSG00000025019 0.2550725 0.3041367 UP
## ENSMUSG00000025197 0.2841821 0.3559208 UP
## ENSMUSG00000025511 0.4368006 0.5074200 UP
## ENSMUSG00000025764 0.2259555 0.2963116 UP
## ENSMUSG00000025815 0.5903765 0.4389222 UP
## ENSMUSG00000026313 0.1539409 0.3155407 UP
## ENSMUSG00000027314 0.5860998 0.6363438 UP
## ENSMUSG00000027796 0.7238468 0.7887084 UP
## ENSMUSG00000027875 1.6801031 1.7237129 UP
## ENSMUSG00000028081 0.2289425 0.2955672 UP
## ENSMUSG00000028957 1.2257695 1.2639279 UP
## ENSMUSG00000029587 0.2425108 0.3859120 UP
## ENSMUSG00000029714 0.2044113 0.3427134 UP
## ENSMUSG00000030201 0.2561248 0.2979620 UP
## ENSMUSG00000030256 0.9788098 1.1902396 UP
## ENSMUSG00000031167 0.5339867 0.6064347 UP
## ENSMUSG00000031320 0.2562037 0.3225764 UP
## ENSMUSG00000032097 0.1975063 0.2620877 UP
## ENSMUSG00000032594 0.1791449 0.2869414 UP
## ENSMUSG00000032624 0.2169595 0.2844803 UP
## ENSMUSG00000033327 0.4283032 0.4988136 UP
## ENSMUSG00000033350 0.3658972 0.4324706 UP
## ENSMUSG00000033411 0.2028373 0.3637525 UP
## ENSMUSG00000034111 0.2112985 0.2805112 UP
## ENSMUSG00000034450 1.8842281 1.9262759 UP
## ENSMUSG00000034460 0.3151958 0.3827674 UP
## ENSMUSG00000035469 0.1895596 0.2924039 UP
## ENSMUSG00000035530 0.2043676 0.2742151 UP
## ENSMUSG00000035614 0.1762571 0.3179184 UP
## ENSMUSG00000037172 0.2186601 0.2843207 UP
## ENSMUSG00000037465 0.5816765 0.6069454 UP
## ENSMUSG00000037523 0.1775014 0.2408319 UP
## ENSMUSG00000037621 0.5208284 0.5864163 UP
## ENSMUSG00000038393 0.6799281 0.7704989 UP
## ENSMUSG00000039108 0.1589655 0.2629091 UP
## ENSMUSG00000039783 0.3727112 0.4461003 UP
## ENSMUSG00000039789 0.2330017 0.3857054 UP
## ENSMUSG00000039831 0.1890496 0.3180946 UP
## ENSMUSG00000040363 0.1968440 0.2889748 UP
## ENSMUSG00000040423 0.2067007 0.2974977 UP
## ENSMUSG00000040584 0.5203918 0.5918106 UP
## ENSMUSG00000040740 0.5826671 0.6496599 UP
## ENSMUSG00000041075 0.2765236 0.3466008 UP
## ENSMUSG00000041351 0.4056171 0.4580201 UP
## ENSMUSG00000041841 0.2497089 0.3031808 UP
## ENSMUSG00000042046 0.1987536 0.2623530 UP
## ENSMUSG00000042659 0.3637161 0.4542682 UP
## ENSMUSG00000042745 0.4615762 0.5300710 UP
## ENSMUSG00000043144 0.6045460 0.6739626 UP
## ENSMUSG00000044026 0.2327234 0.2991081 UP
## ENSMUSG00000045382 0.5791433 0.6906577 UP
## ENSMUSG00000045441 0.3388331 0.4095947 UP
## ENSMUSG00000045519 0.3723172 0.5257857 UP
## ENSMUSG00000047215 0.2118594 0.2777338 UP
## ENSMUSG00000047878 0.2467415 0.3462712 UP
## ENSMUSG00000048826 0.2628893 0.3418879 UP
## ENSMUSG00000049241 0.5462103 0.6065400 UP
## ENSMUSG00000050100 0.7259042 0.7633803 UP
## ENSMUSG00000053411 0.3483959 0.4445080 UP
## ENSMUSG00000053964 0.6399772 0.8195312 UP
## ENSMUSG00000054499 0.2646533 0.3237166 UP
## ENSMUSG00000054793 0.2200166 0.2900769 UP
## ENSMUSG00000055866 0.8097100 0.7680132 UP
## ENSMUSG00000055980 0.2716179 0.3399208 UP
## ENSMUSG00000056851 0.1780946 0.2683844 UP
## ENSMUSG00000058056 0.3396438 0.4138623 UP
## ENSMUSG00000058600 0.1908576 0.2983421 UP
## ENSMUSG00000058655 0.2618143 0.3271659 UP
## ENSMUSG00000059824 2.2589260 2.2593713 UP
## ENSMUSG00000061143 0.2779725 0.3411319 UP
## ENSMUSG00000061353 0.5482823 0.6046250 UP
## ENSMUSG00000061477 0.1557154 0.2329950 UP
## ENSMUSG00000062563 0.2882025 0.3489916 UP
## ENSMUSG00000063681 0.6643961 0.7620083 UP
## ENSMUSG00000064065 0.2648191 0.3128913 UP
## ENSMUSG00000067586 0.3581061 0.4216239 UP
## ENSMUSG00000068742 0.4482648 0.4812722 UP
## ENSMUSG00000069495 0.1771416 0.2788410 UP
## ENSMUSG00000070348 0.3214200 0.3914842 UP
## ENSMUSG00000071415 0.1943319 0.2574978 UP
## ENSMUSG00000074063 0.4771479 0.5492749 UP
## ENSMUSG00000074578 0.3205346 0.4453591 UP
## ENSMUSG00000086583 0.4196877 0.4777842 UP
## ENSMUSG00000098557 0.2778455 0.3411789 UP
## ENSMUSG00000106847 0.2887040 0.3555178 UP
## ENSMUSG00000110185 0.2630431 0.3306584 UP
## ENSMUSG00000110195 0.3230275 0.3313455 UP
Lets load the required packages
library(ggplot2)
library(ggtree)
## ggtree v3.10.0 For help: https://yulab-smu.top/treedata-book/
##
## If you use the ggtree package suite in published research, please cite
## the appropriate paper(s):
##
## Guangchuang Yu, David Smith, Huachen Zhu, Yi Guan, Tommy Tsan-Yuk Lam.
## ggtree: an R package for visualization and annotation of phylogenetic
## trees with their covariates and other associated data. Methods in
## Ecology and Evolution. 2017, 8(1):28-36. doi:10.1111/2041-210X.12628
##
## Shuangbin Xu, Lin Li, Xiao Luo, Meijun Chen, Wenli Tang, Li Zhan, Zehan
## Dai, Tommy T. Lam, Yi Guan, Guangchuang Yu. Ggtree: A serialized data
## object for visualization of a phylogenetic tree and annotation data.
## iMeta 2022, 1(4):e56. doi:10.1002/imt2.56
##
## G Yu. Data Integration, Manipulation and Visualization of Phylogenetic
## Trees (1st ed.). Chapman and Hall/CRC. 2022. ISBN: 9781032233574
##
## Attaching package: 'ggtree'
## The following object is masked from 'package:magrittr':
##
## inset
## The following object is masked from 'package:reshape':
##
## expand
## The following object is masked from 'package:Biostrings':
##
## collapse
## The following object is masked from 'package:IRanges':
##
## collapse
## The following object is masked from 'package:S4Vectors':
##
## expand
## The following object is masked from 'package:tidyr':
##
## expand
library(treeio)
## treeio v1.26.0 For help: https://yulab-smu.top/treedata-book/
##
## If you use the ggtree package suite in published research, please cite
## the appropriate paper(s):
##
## LG Wang, TTY Lam, S Xu, Z Dai, L Zhou, T Feng, P Guo, CW Dunn, BR
## Jones, T Bradley, H Zhu, Y Guan, Y Jiang, G Yu. treeio: an R package
## for phylogenetic tree input and output with richly annotated and
## associated data. Molecular Biology and Evolution. 2020, 37(2):599-603.
## doi: 10.1093/molbev/msz240
##
## Guangchuang Yu, Tommy Tsan-Yuk Lam, Huachen Zhu, Yi Guan. Two methods
## for mapping and visualizing associated data on phylogeny using ggtree.
## Molecular Biology and Evolution. 2018, 35(12):3041-3043.
## doi:10.1093/molbev/msy194
##
## Guangchuang Yu. Using ggtree to visualize data on tree-like structures.
## Current Protocols in Bioinformatics. 2020, 69:e96. doi:10.1002/cpbi.96
##
## Attaching package: 'treeio'
## The following object is masked from 'package:Biostrings':
##
## mask
First we need to load our raw tree data. Its a Newick format so we
use:
Now we will print out a very basic phylogenetic tree
install.packages('BAMMtools')
## Installing package into '/home/student/R/x86_64-pc-linux-gnu-library/4.3'
## (as 'lib' is unspecified)
library(BAMMtools)
## Loading required package: ape
##
## Attaching package: 'ape'
## The following object is masked from 'package:treeio':
##
## drop.tip
## The following object is masked from 'package:ggtree':
##
## rotate
## The following object is masked from 'package:imager':
##
## where
## The following object is masked from 'package:ShortRead':
##
## zoom
## The following object is masked from 'package:Biostrings':
##
## complement
## The following object is masked from 'package:dplyr':
##
## where
Quantifying difference between trees with treespace
First lets load the required packages
library(ape)
library(adegraphics)
## Registered S3 methods overwritten by 'adegraphics':
## method from
## biplot.dudi ade4
## kplot.foucart ade4
## kplot.mcoa ade4
## kplot.mfa ade4
## kplot.pta ade4
## kplot.sepan ade4
## kplot.statis ade4
## scatter.coa ade4
## scatter.dudi ade4
## scatter.nipals ade4
## scatter.pco ade4
## score.acm ade4
## score.mix ade4
## score.pca ade4
## screeplot.dudi ade4
##
## Attaching package: 'adegraphics'
## The following object is masked from 'package:ape':
##
## zoom
## The following object is masked from 'package:ShortRead':
##
## zoom
## The following object is masked from 'package:GenomicRanges':
##
## score
## The following object is masked from 'package:Biostrings':
##
## score
## The following object is masked from 'package:BiocGenerics':
##
## score
library(treespace)
## Loading required package: ade4
##
## Attaching package: 'ade4'
## The following objects are masked from 'package:adegraphics':
##
## kplotsepan.coa, s.arrow, s.class, s.corcircle, s.distri, s.image,
## s.label, s.logo, s.match, s.traject, s.value, table.value,
## triangle.class
## The following object is masked from 'package:GenomicRanges':
##
## score
## The following object is masked from 'package:Biostrings':
##
## score
## The following object is masked from 'package:BiocGenerics':
##
## score
Now we need to load all the treefiles into a multiPhylo object
treefiles <- list.files(file.path("genetrees"), pattern = "\\.nwk$", full.names = TRUE)
tree_list <- lapply(treefiles, read.tree)
class(tree_list)
## [1] "list"
class(tree_list) <- "multiPhylo"
class(tree_list)
## [1] "multiPhylo"
Now we can compute the kendall-coljin distances between trees. This
function does a LOT of analyses.
First it runs a pairwise comparison of all trees in the input
Second it carries out clustering using PCA
These results are returned in a list of objects, where $D contains
the pairwise metric of the trees, and $pco contains the PCA.
The method we use (Kendal-Coljun) is particularly suitable for rooted
trees as we have here. The option NF tells us how many principal
components to retain.
Reconstructing trees from alignments
Lets load the packages
library(Biostrings)
library(msa)
library(phangorn)
First we’ll load the sequences into a seqs variable
seqs <- readAAStringSet("abc.fa")
Now, lets contruct an alignment with the msa package and
ClusalOmega
aln <- msa::msa(seqs, method = c("ClustalOmega"))
## using Gonnet
To create a tree, we need to convert the alignment to a phyData
objects
aln <- as.phyDat(aln, type = "AA")
class(aln)
## [1] "phyDat"
In this step, we’ll actually make the trees. Trees are made from
distance matrix, which can be computed with dist.ml() - ML stands for
maximum likelihood
dist_mat <- dist.ml(aln)
Now we pass the distance matrix to upgma to make a UPGMA tree
upgma_tree <- upgma(dist_mat)
plot(upgma_tree, main = "UPGMA")

We can conversely pass the distance matrix to a neighbor joining the
function
nj_tree <- NJ(dist_mat)
plot(nj_tree, main = "NJ")
Lastly, we are going to use the bootstraps.phyDat() function to compute
bootstrap Support for the branches of the tree. The first argument is
the object (aln), while the second argument is the funciton nj
Bootstraps are essentially confidence intervals for how the clade is
placed in the correct position
fit <- pml(nj_tree, aln)
bootstraps <- bootstrap.phyDat(aln, FUN = function(x) {NJ(dist.ml(x))}, bs = 100)
plotBS(nj_tree, bootstraps, p = 10)

Extracting and working with subtrees using APE
Load our required packages
library(ape)
Now lets load the tree data we will be working with
newick <- read.tree("mammal_tree.nwk")
l <- subtrees(newick)
Lets plot the tree to see what it looks like
plot(newick)

We can subset this plot using the “node” function
plot(l[[4]], sub = "Node 4")

Extract the tree manually
small_tree <- extract.clade(newick, 9)
plot(small_tree)

Now what if we want to bind two trees together.
new_tree <- bind.tree(newick, small_tree, 3)
plot(new_tree)
