Source: https://github.com/markziemann/lungbrain

Introduction

Eslam’s Summary of RNA seq

  • Project title: Characterization any gene expression changes in the mice brain in response to peripheral inflammation in the lung (asthma).

  • Methodology: Mice were divided into three groups (1 control group and 2 asthmatic groups OVA and LPS). At the end of the experiment, RNA was isolated from 5 different mice brain regions (Hypothalamus, Amygdala, Hippocampus, PAG, and NI) (n=7 per group) using (Qiagen RNAeasy Mini kit 250) (Cat# 74106, Hilden, Germany). In total 104 RNA samples. Afterward, RNA quality control was checked using Qubit4 and 4200 Tapestation. Then RNA sequencing was done using NEBNext® Ultra™ II Directional RNA Library Prep Kit for Illumina.

  • Data form: FASTQ raw data (FYI, RNA-seq reads table is attached in a separate page).

  • ID: (1-104)

  • Aim: Detection of the differences in gene expression for each brain region between our 3 different groups?

Bioinformatics methods

Fastqc (v0.11.9) was used to inspect sequence quality[1].

The mouse transcriptome was downloaded from GENCODE version 28[2].

Skewer (v0.2.2) was used to trim low quality bases (qual<20) from the 3’ end of the read[3].

Kallisto (0.46.1) was used to map RNA-seq reads to the transcriptome [4].

Multiqc was used to tabulate sequence quality, trimming and mapping statistics [5].

Data were read into R v4.1.2 and duplicate lane data were aggregated, and transcript level counts were aggregated to gene level counts.

Genes with an average of less than 10 reads across samples were excluded from downstream analysis.

DESeq (1.32.0) was used with default settings to assay differential expression between control and treatment groups for all tissues [6].

Pathway analysis was performed with reactome gene sets obtained from MSigDB and converted to mouse gene identifiers with the msigdbr package (performed on 16-02-2022) [7,8,9].

Differential pathway analysis was performed with the “mitch” bioconductor package [10].

Genes and pathways with false discovery rate (FDR)<0.05 were considered significant.

suppressPackageStartupMessages({
    library("zoo")
#    library("tidyverse")
    library("reshape2")
    library("DESeq2")
    library("gplots")
    library("fgsea")
    library("MASS")
    library("mitch")
    library("eulerr")
    library("limma")
    library("topconfects")
    library("kableExtra")
    library("vioplot")
    library("pkgload")
    library("beeswarm")
})

Import read counts

Importing RNA-seq data

#tmp <- read.table("3col.tsv.gz",header=F)
#x <- as.matrix(acast(tmp, V2~V1, value.var="V3", fun.aggregate = sum))
#x <- as.data.frame(x)
#accession <- sapply((strsplit(rownames(x),"\\|")),"[[",2)
#symbol<-sapply((strsplit(rownames(x),"\\|")),"[[",6)
#x$geneid <- paste(accession,symbol)
#xx <- aggregate(. ~ geneid,x,sum)
#rownames(xx) <- xx$geneid
#xx$geneid = NULL
#xx <- round(xx)
#xx <- xx[,which(colnames(xx)!="test")]
#xx[1:6,1:6]
#dim(xx)
xx <- read.table("lungbrain_counts.tsv",sep="\t")

Fix the sample names.

They are duplicated for lane 1 and 2, which I will aggregate.

#txx <- as.data.frame(t(xx))
#txx$label <- sapply(strsplit(rownames(txx),"_"),"[[",1)
#txx[1:3,c(1:4,ncol(txx))]
#txx2 <- aggregate(. ~ label,txx,sum)
#txx2[1:3,1:4]
#rownames(txx2) <- txx2[,1]
#txx2[,1] = NULL
#xx <- as.data.frame(t(txx2))
#xx[1:4,1:5]
##write.table(xx,file="lungbrain_counts.tsv",sep="\t",quote=FALSE)
rxx <- apply(xx,2,function(x) { x / sum(x) * 1e6  } )
rxx[1:4,1:5]
##                                EA11.1     EA11.2     EA11.3    EA11.4    EA11.5
## ENSMUSG00000000001.5 Gnai3  32.468943 28.3596016 30.1481583 32.451175 30.395016
## ENSMUSG00000000003.16 Pbsn   0.000000  0.0000000  0.0000000  0.000000  0.000000
## ENSMUSG00000000028.16 Cdc45  1.835885  1.7466205  2.5951711  1.687236  2.638796
## ENSMUSG00000000031.17 H19    1.101531  0.2757822  0.4417313  1.799719  2.492196
head(colSums(rxx))
## EA11.1 EA11.2 EA11.3 EA11.4 EA11.5 EA12.1 
##  1e+06  1e+06  1e+06  1e+06  1e+06  1e+06

Samplesheet.

Need to delete “EA13-4”.

ss <- read.table("lungbrain_samplesheet.tsv",header=TRUE)

rownames(ss) <- paste("EA",as.character(ss$OriginalID),sep="")
ss <- ss[order(rownames(ss)),]

rownames(ss) == colnames(rxx)
##   [1] TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE
##  [16] TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE
##  [31] TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE
##  [46] TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE
##  [61] TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE
##  [76] TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE
##  [91] TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE
ss %>% kbl(caption = "Sample sheet") %>%
  kable_paper("hover", full_width = F)
Sample sheet
Region Treatment SampleNum OriginalID InternalID PercentReads NumReads Gbases
EA11.1 hyp OVA 4 11.1 CSEA004 0.5566 40914716 4.091472
EA11.2 amy OVA 28 11.2 CSEA028 0.6315 46420487 4.642049
EA11.3 hip OVA 52 11.3 CSEA052 0.5436 39959108 3.995911
EA11.4 pag OVA 76 11.4 CSEA076 0.5279 38805028 3.880503
EA11.5 NI OVA 32 11.5 CSEA032 0.6059 44538674 4.453867
EA12.1 hyp OVA 5 12.1 CSEA005 0.6140 45134092 4.513409
EA12.2 amy OVA 29 12.2 CSEA029 0.6140 45134092 4.513409
EA12.3 hip OVA 53 12.3 CSEA053 0.4697 34526845 3.452684
EA12.4 pag OVA 77 12.4 CSEA077 0.6622 48677191 4.867719
EA12.5 NI OVA 40 12.5 CSEA040 0.6281 46170558 4.617056
EA13.1 hyp Control 20 13.1 CSEA020 0.6535 48037669 4.803767
EA13.2 amy Control 43 13.2 CSEA043 0.6126 45031180 4.503118
EA13.3 hip Control 68 13.3 CSEA068 0.6158 45266406 4.526641
EA13.4 pag Control 92 13.4 CSEA092 0.5902 43384594 4.338459
EA13.5 NI Control 100 13.5 CSEA100 0.5576 40988224 4.098822
EA14.1 hyp Control 21 14.1 CSEA021 0.6006 44149080 4.414908
EA14.2 amy Control 44 14.2 CSEA044 0.6354 46707169 4.670717
EA14.4 pag Control 93 14.4 CSEA093 0.6229 45788315 4.578832
EA14.5 NI Control 101 14.5 CSEA101 0.4591 33747657 3.374766
EA15.3 hip Control 69 15.3 CSEA069 0.6063 44568078 4.456808
EA16.2 amy Control 45 16.2 CSEA045 0.5070 37268704 3.726870
EA19.1 hyp Control 22 19.1 CSEA022 0.5334 39209323 3.920932
EA19.2 amy Control 46 19.2 CSEA046 0.5431 39922354 3.992235
EA19.3 hip Control 70 19.3 CSEA070 0.4972 36548323 3.654832
EA19.4 pag Control 94 19.4 CSEA094 0.6218 45707456 4.570746
EA19.5 NI Control 102 19.5 CSEA102 0.5271 38746221 3.874622
EA20.1 hyp Control 23 20.1 CSEA023 0.5896 43340489 4.334049
EA20.2 amy Control 47 20.2 CSEA047 0.5473 40231088 4.023109
EA20.3 hip Control 71 20.3 CSEA071 0.5420 39841494 3.984149
EA20.4 pag Control 95 20.4 CSEA095 0.6251 45950034 4.595003
EA20.5 NI Control 103 20.5 CSEA103 0.5385 39584215 3.958422
EA22.5 NI LPS 56 22.5 CSEA056 0.5462 40150229 4.015023
EA23.5 NI LPS 64 23.5 CSEA064 0.7148 52543727 5.254373
EA24.1 hyp LPS 9 24.1 CSEA009 0.6135 45097337 4.509734
EA24.2 amy LPS 33 24.2 CSEA033 0.6361 46758625 4.675862
EA24.3 hip LPS 57 24.3 CSEA057 0.5850 43002351 4.300235
EA24.4 pag LPS 81 24.4 CSEA081 0.5860 43075859 4.307586
EA24.5 NI LPS 72 24.5 CSEA072 0.5553 40819155 4.081915
EA25.1 hyp LPS 10 25.1 CSEA010 0.6531 48008266 4.800827
EA25.2 amy LPS 34 25.2 CSEA034 0.5554 40826506 4.082651
EA25.3 hip LPS 58 25.3 CSEA058 0.5951 43744785 4.374478
EA25.4 pag LPS 82 25.4 CSEA082 0.5224 38400732 3.840073
EA25.5 NI LPS 80 25.5 CSEA080 0.5595 41127890 4.112789
EA26.1 hyp LPS 11 26.1 CSEA011 0.5547 40775050 4.077505
EA26.2 amy LPS 35 26.2 CSEA035 0.5051 37129038 3.712904
EA26.3 hip LPS 59 26.3 CSEA059 0.5320 39106412 3.910641
EA26.4 pag LPS 83 26.4 CSEA083 0.5903 43391945 4.339195
EA26.5 NI LPS 88 26.5 CSEA088 0.5439 39981160 3.998116
EA28.1 hyp LPS 12 28.1 CSEA012 0.5116 37606842 3.760684
EA28.2 amy LPS 36 28.2 CSEA036 0.6100 44840058 4.484006
EA28.3 hip LPS 60 28.3 CSEA060 0.5066 37239301 3.723930
EA28.4 pag LPS 84 28.4 CSEA084 0.6240 45869174 4.586917
EA29.1 hyp LPS 13 29.1 CSEA013 0.5781 42495144 4.249514
EA29.2 amy LPS 37 29.2 CSEA037 0.5550 40797102 4.079710
EA29.3 hip LPS 61 29.3 CSEA061 0.6357 46729221 4.672922
EA29.4 pag LPS 85 29.4 CSEA085 0.5473 40231088 4.023109
EA29.5 NI LPS 96 29.5 CSEA096 0.6012 44193185 4.419319
EA3.1 hyp OVA 1 3.1 CSEA001 0.7106 52234993 5.223499
EA3.2 amy OVA 25 3.2 CSEA025 0.5306 39003500 3.900350
EA3.3 hip OVA 49 3.3 CSEA049 0.6483 47655426 4.765543
EA3.4 pag OVA 73 3.4 CSEA073 0.5320 39106412 3.910641
EA3.5 NI OVA 8 3.5 CSEA008 0.6426 47236429 4.723643
EA30.1 hyp LPS 14 30.1 CSEA014 0.5787 42539249 4.253925
EA30.2 amy LPS 38 30.2 CSEA038 0.5688 41811517 4.181152
EA30.3 hip LPS 62 30.3 CSEA062 0.6359 46743923 4.674392
EA30.4 pag LPS 86 30.4 CSEA086 0.6063 44568078 4.456808
EA30.5 NI LPS 104 30.5 CSEA104 0.5692 41840920 4.184092
EA31.1 hyp LPS 15 31.1 CSEA015 0.5738 42179058 4.217906
EA31.2 amy LPS 39 31.2 CSEA039 0.5634 41414572 4.141457
EA31.3 hip LPS 63 31.3 CSEA063 0.6144 45163495 4.516349
EA31.4 pag LPS 87 31.4 CSEA087 0.5989 44024116 4.402412
EA34.1 hyp OVA 6 34.1 CSEA006 0.6620 48662490 4.866249
EA34.2 amy OVA 30 34.2 CSEA030 0.5227 38422784 3.842278
EA34.3 hip OVA 54 34.3 CSEA054 0.6550 48147932 4.814793
EA34.4 pag OVA 78 34.4 CSEA078 0.6248 45927981 4.592798
EA35.1 hyp OVA 7 35.1 CSEA007 0.5053 37143740 3.714374
EA35.2 amy OVA 31 35.2 CSEA031 0.5840 42928843 4.292884
EA35.3 hip OVA 55 35.3 CSEA055 0.5617 41289608 4.128961
EA35.4 pag OVA 79 35.4 CSEA079 0.6147 45185547 4.518555
EA35.5 NI OVA 48 35.5 CSEA048 0.6017 44229940 4.422994
EA4.1 hyp OVA 2 4.1 CSEA002 0.5883 43244928 4.324493
EA4.2 amy OVA 26 4.2 CSEA026 0.5446 40032616 4.003262
EA4.3 hip OVA 50 4.3 CSEA050 0.5873 43171420 4.317142
EA4.4 pag OVA 74 4.4 CSEA074 0.5389 39613619 3.961362
EA4.5 NI OVA 16 4.5 CSEA016 0.6581 48375807 4.837581
EA5.1 hyp Control 17 5.1 CSEA017 0.5628 41370467 4.137047
EA5.2 amy Control 41 5.2 CSEA041 0.5405 39731232 3.973123
EA5.3 hip Control 65 5.3 CSEA065 0.6693 49199100 4.919910
EA5.4 pag Control 89 5.4 CSEA089 0.5372 39488655 3.948865
EA5.5 NI Control 97 5.5 CSEA097 0.6432 47280534 4.728053
EA6.1 hyp Control 18 6.1 CSEA018 0.6405 47082061 4.708206
EA6.2 amy Control 42 6.2 CSEA042 0.5692 41840920 4.184092
EA6.3 hip Control 66 6.3 CSEA066 0.6563 48243492 4.824349
EA6.4 pag Control 90 6.4 CSEA090 0.5525 40613332 4.061333
EA6.5 NI Control 98 6.5 CSEA098 0.5549 40789751 4.078975
EA7.1 hyp Control 19 7.1 CSEA019 0.5891 43303735 4.330374
EA7.3 hip Control 67 7.3 CSEA067 0.6897 50698669 5.069867
EA7.4 pag Control 91 7.4 CSEA091 0.5014 36857058 3.685706
EA7.5 NI Control 99 7.5 CSEA099 0.6789 49904780 4.990478
EA9.1 hyp OVA 3 9.1 CSEA003 0.5619 41304309 4.130431
EA9.2 amy OVA 27 9.2 CSEA027 0.4965 36496867 3.649687
EA9.3 hip OVA 51 9.3 CSEA051 0.4721 34703265 3.470326
EA9.4 pag OVA 75 9.4 CSEA075 0.6358 46736572 4.673657
EA9.5 NI OVA 24 9.5 CSEA024 0.5248 38577152 3.857715

QC analysis

Here I’ll look at a few different quality control measures.

The simplest is the number and proportion of reads that are assigned to genes.

par(mar=c(5,8,3,1))
barplot(colSums(xx),horiz=TRUE,las=1,xlab="num reads",col=ss$cols)

sums <- colSums(xx)
sums <- sums[order(sums)]
barplot(sums,horiz=TRUE,las=1,xlab="num reads",cex.names=0.8)
abline(v=15000000,col="red")

which(sums<15000000)
## EA9.5 
##     1
barplot(head(sums,6),horiz=TRUE,las=1,xlab="num reads",cex.names=1)
abline(v=15000000,col="red")

which(sums<15000000)
## EA9.5 
##     1
pdf("plot01_qc01.pdf")
par(mar=c(5,8,3,1))
barplot(colSums(xx),horiz=TRUE,las=1,xlab="num reads",col=ss$cols)
sums <- colSums(xx)
sums <- sums[order(sums)]
barplot(sums,horiz=TRUE,las=1,xlab="num reads",cex.names=0.8)
abline(v=15000000,col="red")
which(sums<15000000)
## EA9.5 
##     1
barplot(head(sums,6),horiz=TRUE,las=1,xlab="num reads",cex.names=1)
abline(v=15000000,col="red")
which(sums<15000000)
## EA9.5 
##     1
dev.off()
## X11cairo 
##        2

Now to look at the rRNA content.

rrna <- read.table("https://raw.githubusercontent.com/markziemann/lung_brain/main/rrna_res.tsv")
myrrna <- rrna$V2/10000
names(myrrna) <- rrna$V1
myrrna <- myrrna[order(myrrna)]

barplot(myrrna,horiz=TRUE,las=1,xlab="percent rRNA reads",cex.names=0.8)
abline(v=10,col="red")

barplot(tail(myrrna),horiz=TRUE,las=1,xlab="percent rRNA reads",cex.names=0.8)
abline(v=10,col="red")

pdf("plot02_rrna01.pdf")
barplot(myrrna,horiz=TRUE,las=1,xlab="percent rRNA reads",cex.names=0.8)
abline(v=10,col="red")

barplot(tail(myrrna),horiz=TRUE,las=1,xlab="percent rRNA reads",cex.names=0.8)
abline(v=10,col="red")
dev.off()
## X11cairo 
##        2
myrrna[which(myrrna>10)]
##  EA29-5  EA23-5   EA3-1   EA9-5 
## 10.1406 15.5685 18.0218 25.9348

MDS plot for all samples

Multidimensional scaling plot to show the variation between all samples, very similar to PCA.

par(mar=c(5.1,4.1,4.1,2.1))

mds <- cmdscale(dist(t(xx)))

cols <- as.numeric(as.factor(ss$Region))+1
pchs <- as.numeric(factor(ss$Treatment))+14

plot(mds, xlab="Coordinate 1", ylab="Coordinate 2",
  type = "p",bty="n",pch=pchs, cex=4 ,col=cols )
text(mds, labels=rownames(mds) ,col="black")

legend("bottomleft", inset=.02, title="tissue",
   legend=unique(as.factor(ss$Region)) , fill=unique(cols),  cex=1.2)

legend("left", inset=.02, title="treatment",
   legend=unique(as.factor(ss$Treatment)) , pch=unique(pchs),  cex=1.2)

pdf("plot03_mds01.pdf")
plot(mds, xlab="Coordinate 1", ylab="Coordinate 2",
  type = "p",bty="n",pch=pchs, cex=4 ,col=cols )
text(mds, labels=rownames(mds) ,col="black")
legend("bottomleft", inset=.02, title="tissue",
   legend=unique(as.factor(ss$Region)) , fill=unique(cols),  cex=1.2)
legend("left", inset=.02, title="treatment",
   legend=unique(as.factor(ss$Treatment)) , pch=unique(pchs),  cex=1.2)
dev.off()
## X11cairo 
##        2

Correlation heatmap

heatmap.2(cor(xx),trace="n",main="Pearson correlation heatmap",margin=c(8,8),cexRow=0.7,cexCol=0.7)

heatmap.2(cor(xx),trace="n",main="Pearson correlation heatmap",margin=c(8,8),cexRow=0.7,cexCol=0.7)

pdf("plot04_cor01.pdf")
heatmap.2(cor(xx),trace="n",main="Pearson correlation heatmap",margin=c(8,8),cexRow=0.7,cexCol=0.7)
heatmap.2(cor(xx),trace="n",main="Pearson correlation heatmap",margin=c(8,8),cexRow=0.7,cexCol=0.7)
dev.off()
## X11cairo 
##        2

Set up the different datasets for differential expression analysis

Here, I’ll give an example on how to separate the data matrix by tissue and then evaluate differential expression.

Don’t forget to remove poorly detected genes from the matrix with a threshold of 10 reads per sample on average.

There are 5 contrasts to set up, one for each tissue.

The separate sample sheets are called s1, s2, etc.

The separate counts tables are called x1, x2, etc.

I will begin with hypothalamus and leave the rest to Craig’s team.

# hyp 1
ss1 <- ss[which(ss$Region=="hyp"),]
xx1 <- xx[which(colnames(xx) %in% rownames(ss1))]
xx1 <- xx1[which(rowMeans(xx1)>=10),]
rpm1 <- apply(xx1,2,function(x) { x / sum(x) * 1e6  } )
ss1_l <- ss[which(ss$Region=="hyp" & ss$Treatment != "OVA"),]
xx1_l <- xx[which(colnames(xx) %in% rownames(ss1_l))]
xx1_l <- xx1_l[which(rowMeans(xx1_l)>=10),]
rpm1_l <- apply(xx1_l,2,function(x) { x / sum(x) * 1e6  } )
ss1_o <- ss[which(ss$Region=="hyp" & ss$Treatment != "LPS"),]
xx1_o <- xx[which(colnames(xx) %in% rownames(ss1_o))]
xx1_o <- xx1_o[which(rowMeans(xx1_o)>=10),]
rpm1_o <- apply(xx1_o,2,function(x) { x / sum(x) * 1e6  } )

# amy 2
ss2 <- ss[which(ss$Region=="amy"),]
xx2 <- xx[which(colnames(xx) %in% rownames(ss2))]
xx2 <- xx2[which(rowMeans(xx2)>=10),]
rpm2 <- apply(xx2,2,function(x) { x / sum(x) * 1e6  } )
ss2_l <- ss[which(ss$Region=="amy" & ss$Treatment != "OVA"),]
xx2_l <- xx[which(colnames(xx) %in% rownames(ss2_l))]
xx2_l <- xx2_l[which(rowMeans(xx2_l)>=10),]
rpm2_l <- apply(xx2_l,2,function(x) { x / sum(x) * 1e6  } )
ss2_o <- ss[which(ss$Region=="amy" & ss$Treatment != "LPS"),]
xx2_o <- xx[which(colnames(xx) %in% rownames(ss2_o))]
xx2_o <- xx2_o[which(rowMeans(xx2_o)>=10),]
rpm2_o <- apply(xx2_o,2,function(x) { x / sum(x) * 1e6  } )

# hip 3
ss3 <- ss[which(ss$Region=="hip"),]
xx3 <- xx[which(colnames(xx) %in% rownames(ss3))]
xx3 <- xx3[which(rowMeans(xx3)>=10),]
rpm3 <- apply(xx3,2,function(x) { x / sum(x) * 1e6  } )
ss3_l <- ss[which(ss$Region=="hip" & ss$Treatment != "OVA"),]
xx3_l <- xx[which(colnames(xx) %in% rownames(ss3_l))]
xx3_l <- xx3_l[which(rowMeans(xx3_l)>=10),]
rpm3_l <- apply(xx3_l,2,function(x) { x / sum(x) * 1e6  } )
ss3_o <- ss[which(ss$Region=="hip" & ss$Treatment != "LPS"),]
xx3_o <- xx[which(colnames(xx) %in% rownames(ss3_o))]
xx3_o <- xx3_o[which(rowMeans(xx3_o)>=10),]
rpm3_o <- apply(xx3_o,2,function(x) { x / sum(x) * 1e6  } )

# pag 4
ss4 <- ss[which(ss$Region=="pag"),]
xx4 <- xx[which(colnames(xx) %in% rownames(ss4))]
xx4 <- xx4[which(rowMeans(xx4)>=10),]
rpm4 <- apply(xx4,2,function(x) { x / sum(x) * 1e6  } )
ss4_l <- ss[which(ss$Region=="pag" & ss$Treatment != "OVA"),]
xx4_l <- xx[which(colnames(xx) %in% rownames(ss4_l))]
xx4_l <- xx4_l[which(rowMeans(xx4_l)>=10),]
rpm4_l <- apply(xx4_l,2,function(x) { x / sum(x) * 1e6  } )
ss4_o <- ss[which(ss$Region=="pag" & ss$Treatment != "LPS"),]
xx4_o <- xx[which(colnames(xx) %in% rownames(ss4_o))]
xx4_o <- xx4_o[which(rowMeans(xx4_o)>=10),]
rpm4_o <- apply(xx4_o,2,function(x) { x / sum(x) * 1e6  } )

# ni 5
ss5 <- ss[which(ss$Region=="NI"),]
xx5 <- xx[which(colnames(xx) %in% rownames(ss5))]
xx5 <- xx5[which(rowMeans(xx5)>=10),]
rpm5 <- apply(xx5,2,function(x) { x / sum(x) * 1e6  } )
ss5_l <- ss[which(ss$Region=="NI" & ss$Treatment != "OVA"),]
xx5_l <- xx[which(colnames(xx) %in% rownames(ss5_l))]
xx5_l <- xx5_l[which(rowMeans(xx5_l)>=10),]
rpm5_l <- apply(xx5,2,function(x) { x / sum(x) * 1e6  } )
ss5_o <- ss[which(ss$Region=="NI" & ss$Treatment != "LPS"),]
xx5_o <- xx[which(colnames(xx) %in% rownames(ss5_o))]
xx5_o <- xx5_o[which(rowMeans(xx5_o)>=10),]
rpm5 <- apply(xx5,2,function(x) { x / sum(x) * 1e6  } )

message("dimensions of objects: n genes, n samples")
## dimensions of objects: n genes, n samples
l <- list("xx"=xx,"xx1"=xx1,"xx1 l"= xx1_l,"xx1 o"=xx1_o,
  "xx2"=xx2,"xx2 l"=xx2_l,"xx2 o"=xx2_o,
  "xx3"=xx3,"xx3 l"=xx3_l,"xx3 o"=xx3_o,
  "xx4"=xx4,"xx4 l"=xx4_l,"xx4 o"=xx5_o,
  "xx5"=xx5,"xx5 l"=xx5_l,"xx5 o"=xx5_o)

lapply(l,dim)
## $xx
## [1] 55357   104
## 
## $xx1
## [1] 17091    21
## 
## $`xx1 l`
## [1] 17095    14
## 
## $`xx1 o`
## [1] 17114    14
## 
## $xx2
## [1] 16681    21
## 
## $`xx2 l`
## [1] 16818    14
## 
## $`xx2 o`
## [1] 16624    14
## 
## $xx3
## [1] 16897    21
## 
## $`xx3 l`
## [1] 16927    14
## 
## $`xx3 o`
## [1] 16953    14
## 
## $xx4
## [1] 17570    21
## 
## $`xx4 l`
## [1] 17612    14
## 
## $`xx4 o`
## [1] 17391    13
## 
## $xx5
## [1] 17474    20
## 
## $`xx5 l`
## [1] 17490    14
## 
## $`xx5 o`
## [1] 17391    13
par(mar=c(5.1,4.1,4.1,2.1))

# hyp 1
mds <- cmdscale(dist(t(xx1)))
cols <- as.numeric(factor(ss1$Treatment))+1

plot(mds, xlab="Coordinate 1", ylab="Coordinate 2",
  type = "p",bty="n",pch=19, cex=4 ,col=cols , main = "hyp")
text(mds, labels=rownames(mds) ,col="black")

legend("bottomleft", inset=.02, title="treatment",
   legend=unique(as.factor(ss$Treatment)) , pch=19,col=unique(cols),  cex=1.2)

pdf("plot05_mds02.pdf")
plot(mds, xlab="Coordinate 1", ylab="Coordinate 2",
  type = "p",bty="n",pch=19, cex=4 ,col=cols , main = "hyp")
text(mds, labels=rownames(mds) ,col="black")
legend("bottomleft", inset=.02, title="treatment",
   legend=unique(as.factor(ss$Treatment)) , pch=19,col=unique(cols),  cex=1.2)
dev.off()
## X11cairo 
##        2
# Sample 3.1à has high rRNA content
# Sample 9.1à no problem in its QC but will look for other explanation
rpm1m <- rowMeans(rpm1)
de1_inv <- data.frame(rpm1[,"EA9.1"] , rpm1m )
colnames(de1_inv) <- c("ea9.1","mean")
de1_inv$ratio <- de1_inv$ea9.1 / de1_inv$mean
de1_inv <- de1_inv[order(-de1_inv$ratio),]
head(de1_inv,20)
##                                          ea9.1         mean    ratio
## ENSMUSG00000114436.2 Gm48283          6.910956    0.8194787 8.433356
## ENSMUSG00000098975.8 Gm27177          7.913309    0.9571406 8.267655
## ENSMUSG00000099702.2 Gm29013         91.055804   11.9345178 7.629617
## ENSMUSG00000117748.2 Derpc           14.085689    2.0219406 6.966421
## ENSMUSG00000092006.2 Gm17139          4.220431    0.6200184 6.806945
## ENSMUSG00000070343.4 Gm10288         28.171378    5.5647018 5.062514
## ENSMUSG00000098650.2 Commd1b          6.066870    1.2624669 4.805567
## ENSMUSG00000090207.3 4930524O07Rik    5.117273    1.2855768 3.980527
## ENSMUSG00000085543.2 Gm13568          9.126683    2.3771039 3.839413
## ENSMUSG00000109168.2 Gm44709          4.220431    1.1013228 3.832147
## ENSMUSG00000042045.7 Sln              1.846439    0.5259509 3.510667
## ENSMUSG00000028459.12 Cd72            2.690525    0.7868600 3.419318
## ENSMUSG00000067038.7 Rps12-ps3       36.559485   11.0831020 3.298669
## ENSMUSG00000102275.2 Gm37144         32.075277    9.8096302 3.269774
## ENSMUSG00000104208.2 Gm37401          3.165323    1.0720356 2.952629
## ENSMUSG00000118181.2 Gm53015          8.124330    2.8270970 2.873736
## ENSMUSG00000107659.2 Gm44170          2.373993    0.8401805 2.825574
## ENSMUSG00000105373.2 Gm42429          8.493618    3.0166338 2.815595
## ENSMUSG00000001014.7 Icam4            1.477151    0.5279512 2.797893
## ENSMUSG00000064337.1 mt-Rnr1       7662.034620 2745.5643499 2.790696

Remove 3.1 as it has high rRNA content. Sample 9.1 appears as possible outlier, but no obvious reason to exclude it from the analysis. EG no problem with QC and no gene expression profile features that indicate tissue contamination.

Then repeat the MDS.

ss1 <- ss1[rownames(ss1)!="EA3.1",]
xx1 <- xx1[,colnames(xx1) %in% rownames(ss1)]

# hyp 1
mds <- cmdscale(dist(t(xx1)),k=4)
cols <- as.numeric(factor(ss1$Treatment))+1

# 1 vs 2
plot(mds, xlab="Coordinate 1", ylab="Coordinate 2",
  type = "p",bty="n",pch=19, cex=4 ,col=cols , main = "hyp")
text(mds, labels=rownames(mds) ,col="black")

legend("bottomleft", inset=.02, title="treatment",
  legend=unique(as.factor(ss$Treatment)) , pch=19,col=unique(cols),  cex=1.2)

# 1 vs 3
plot(mds[,c(1,3)], xlab="Coordinate 1", ylab="Coordinate 3",
  type = "p",bty="n",pch=19, cex=4 ,col=cols , main = "hyp")
text(mds[,c(1,3)], labels=rownames(mds[,c(1,3)]) ,col="black")
legend("bottomleft", inset=.02, title="treatment",
   legend=unique(as.factor(ss$Treatment)) , pch=19,col=unique(cols),  cex=1.2)

# 2 vs 3
plot(mds[,c(2,3)], xlab="Coordinate 2", ylab="Coordinate 3",
  type = "p",bty="n",pch=19, cex=4 ,col=cols , main = "hyp")
text(mds[,c(2,3)], labels=rownames(mds[,c(2,3)]) ,col="black")
legend("bottomleft", inset=.02, title="treatment",
  legend=unique(as.factor(ss$Treatment)) , pch=19,col=unique(cols),  cex=1.2)

# 1 vs 4
plot(mds[,c(1,4)], xlab="Coordinate 1", ylab="Coordinate 4",
  type = "p",bty="n",pch=19, cex=4 ,col=cols , main = "hyp")
text(mds[,c(1,4)], labels=rownames(mds[,c(1,4)]) ,col="black")
legend("bottomleft", inset=.02, title="treatment",
  legend=unique(as.factor(ss$Treatment)) , pch=19,col=unique(cols),  cex=1.2)

# 2 vs 4
plot(mds[,c(2,4)], xlab="Coordinate 2", ylab="Coordinate 4",
  type = "p",bty="n",pch=19, cex=4 ,col=cols , main = "hyp")
text(mds[,c(2,4)], labels=rownames(mds[,c(2,4)]) ,col="black")
legend("bottomleft", inset=.02, title="treatment",
  legend=unique(as.factor(ss$Treatment)) , pch=19,col=unique(cols),  cex=1.2)

# 3 vs 4
plot(mds[,c(3,4)], xlab="Coordinate 3", ylab="Coordinate 4",
  type = "p",bty="n",pch=19, cex=4 ,col=cols , main = "hyp")
text(mds[,c(3,4)], labels=rownames(mds[,c(3,4)]) ,col="black")
legend("topright", inset=.02, title="treatment",
  legend=unique(as.factor(ss$Treatment)) , pch=19,col=unique(cols),  cex=1.2)

pdf("plot06_mds03.pdf")
plot(mds, xlab="Coordinate 1", ylab="Coordinate 2",
  type = "p",bty="n",pch=19, cex=4 ,col=cols , main = "hyp")
text(mds, labels=rownames(mds) ,col="black")
legend("bottomleft", inset=.02, title="treatment",
   legend=unique(as.factor(ss$Treatment)) , pch=19,col=unique(cols),  cex=1.2)

# 1 vs 3
plot(mds[,c(1,3)], xlab="Coordinate 1", ylab="Coordinate 3",
  type = "p",bty="n",pch=19, cex=4 ,col=cols , main = "hyp")
text(mds[,c(1,3)], labels=rownames(mds[,c(1,3)]) ,col="black")
legend("bottomleft", inset=.02, title="treatment",
   legend=unique(as.factor(ss$Treatment)) , pch=19,col=unique(cols),  cex=1.2)

# 2 vs 3
plot(mds[,c(2,3)], xlab="Coordinate 2", ylab="Coordinate 3",
  type = "p",bty="n",pch=19, cex=4 ,col=cols , main = "hyp")
text(mds[,c(2,3)], labels=rownames(mds[,c(2,3)]) ,col="black")
legend("bottomleft", inset=.02, title="treatment",
  legend=unique(as.factor(ss$Treatment)) , pch=19,col=unique(cols),  cex=1.2)

# 1 vs 4
plot(mds[,c(1,4)], xlab="Coordinate 1", ylab="Coordinate 4",
  type = "p",bty="n",pch=19, cex=4 ,col=cols , main = "hyp")
text(mds[,c(1,4)], labels=rownames(mds[,c(1,4)]) ,col="black")
legend("bottomleft", inset=.02, title="treatment",
  legend=unique(as.factor(ss$Treatment)) , pch=19,col=unique(cols),  cex=1.2)

# 2 vs 4
plot(mds[,c(2,4)], xlab="Coordinate 2", ylab="Coordinate 4",
  type = "p",bty="n",pch=19, cex=4 ,col=cols , main = "hyp")
text(mds[,c(2,4)], labels=rownames(mds[,c(2,4)]) ,col="black")
legend("bottomleft", inset=.02, title="treatment",
  legend=unique(as.factor(ss$Treatment)) , pch=19,col=unique(cols),  cex=1.2)

# 3 vs 4
plot(mds[,c(3,4)], xlab="Coordinate 3", ylab="Coordinate 4",
  type = "p",bty="n",pch=19, cex=4 ,col=cols , main = "hyp")
text(mds[,c(3,4)], labels=rownames(mds[,c(3,4)]) ,col="black")
legend("topright", inset=.02, title="treatment",
  legend=unique(as.factor(ss$Treatment)) , pch=19,col=unique(cols),  cex=1.2)
dev.off()
## X11cairo 
##        2
# amy 2
mds <- cmdscale(dist(t(xx2)))
cols <- as.numeric(factor(ss2$Treatment))+1

plot(mds, xlab="Coordinate 1", ylab="Coordinate 2",
  type = "p",bty="n",pch=19, cex=4 ,col=cols , main = "amy")
text(mds, labels=rownames(mds) ,col="black")

legend("bottomleft", inset=.02, title="treatment",
   legend=unique(as.factor(ss$Treatment)) , pch=19,col=unique(cols),  cex=1.2)

pdf("plot07_mds04.pdf")
plot(mds, xlab="Coordinate 1", ylab="Coordinate 2",
  type = "p",bty="n",pch=19, cex=4 ,col=cols , main = "amy")
text(mds, labels=rownames(mds) ,col="black")
legend("bottomleft", inset=.02, title="treatment",
   legend=unique(as.factor(ss$Treatment)) , pch=19,col=unique(cols),  cex=1.2)
dev.off()
## X11cairo 
##        2
# hip 3
mds <- cmdscale(dist(t(xx3)))
cols <- as.numeric(factor(ss3$Treatment))+1

plot(mds, xlab="Coordinate 1", ylab="Coordinate 2",
  type = "p",bty="n",pch=19, cex=4 ,col=cols , main = "hip")
text(mds, labels=rownames(mds) ,col="black")

legend("bottomleft", inset=.02, title="treatment",
   legend=unique(as.factor(ss$Treatment)) , pch=19,col=unique(cols),  cex=1.2)

pdf("plot08_mds05.pdf")
plot(mds, xlab="Coordinate 1", ylab="Coordinate 2",
  type = "p",bty="n",pch=19, cex=4 ,col=cols , main = "hip")
text(mds, labels=rownames(mds) ,col="black")
legend("bottomleft", inset=.02, title="treatment",
   legend=unique(as.factor(ss$Treatment)) , pch=19,col=unique(cols),  cex=1.2)
dev.off()
## X11cairo 
##        2
# pag 4
mds <- cmdscale(dist(t(xx4)))
cols <- as.numeric(factor(ss4$Treatment))+1

plot(mds, xlab="Coordinate 1", ylab="Coordinate 2",
  type = "p",bty="n",pch=19, cex=4 ,col=cols , main = "pag")
text(mds, labels=rownames(mds) ,col="black")

legend("bottomleft", inset=.02, title="treatment",
   legend=unique(as.factor(ss$Treatment)) , pch=19,col=unique(cols),  cex=1.2)

pdf("plot09_mds06.pdf")
plot(mds, xlab="Coordinate 1", ylab="Coordinate 2",
  type = "p",bty="n",pch=19, cex=4 ,col=cols , main = "pag")
text(mds, labels=rownames(mds) ,col="black")
legend("bottomleft", inset=.02, title="treatment",
   legend=unique(as.factor(ss$Treatment)) , pch=19,col=unique(cols),  cex=1.2)
dev.off()
## X11cairo 
##        2
# ni 5
mds <- cmdscale(dist(t(xx5)))
cols <- as.numeric(factor(ss5$Treatment))+1

plot(mds, xlab="Coordinate 1", ylab="Coordinate 2",
  type = "p",bty="n",pch=19, cex=4 ,col=cols , main = "ni")
text(mds, labels=rownames(mds) ,col="black")

legend("bottomleft", inset=.02, title="treatment",
   legend=unique(as.factor(ss$Treatment)) , pch=19,col=unique(cols),  cex=1.2)

pdf("plot10_mds07.pdf")
plot(mds, xlab="Coordinate 1", ylab="Coordinate 2",
  type = "p",bty="n",pch=19, cex=4 ,col=cols , main = "ni")
text(mds, labels=rownames(mds) ,col="black")
legend("bottomleft", inset=.02, title="treatment",
   legend=unique(as.factor(ss$Treatment)) , pch=19,col=unique(cols),  cex=1.2)
dev.off()
## X11cairo 
##        2

Differential expression with DESeq2

For each brain region, there are two treatments, and so two contrasts are performed.

Before we do that, let’s look at the MDS plot of the hypothalamus data.

par(mar=c(5.1,4.1,4.1,2.1))

mds <- cmdscale(dist(t(xx1)))

cols <- as.numeric(factor(ss1$Treatment))+1

plot(mds, xlab="Coordinate 1", ylab="Coordinate 2",
  type = "p",bty="n", pch=19, cex=4 ,col=cols )
text(mds, labels=rownames(mds) ,col="black")

legend("bottomleft", inset=.02, title="treatment",
   legend=unique(as.factor(ss1$Treatment)) , col=unique(cols), pch=19,  cex=1.2)

pdf("plot11_mds08.pdf")
plot(mds, xlab="Coordinate 1", ylab="Coordinate 2",
  type = "p",bty="n", pch=19, cex=4 ,col=cols )
text(mds, labels=rownames(mds) ,col="black")
legend("bottomleft", inset=.02, title="treatment",
   legend=unique(as.factor(ss1$Treatment)) , col=unique(cols), pch=19,  cex=1.2)
dev.off()
## X11cairo 
##        2

Now run DESeq2 for all contrasts.

# 1 hyp
dds <- DESeqDataSetFromMatrix(countData = xx1_l , colData = ss1_l , design = ~ Treatment )
## Warning in DESeqDataSet(se, design = design, ignoreRank): some variables in
## design formula are characters, converting to factors
res <- DESeq(dds)
## estimating size factors
## estimating dispersions
## gene-wise dispersion estimates
## mean-dispersion relationship
## final dispersion estimates
## fitting model and testing
## -- replacing outliers and refitting for 7 genes
## -- DESeq argument 'minReplicatesForReplace' = 7 
## -- original counts are preserved in counts(dds)
## estimating dispersions
## fitting model and testing
z <- results(res)
vsd <- vst(dds, blind=FALSE)
zz <- cbind(as.data.frame(z),assay(vsd))
dge <- as.data.frame(zz[order(zz$pvalue),])
dge1_l <- dge
d1up_l <- rownames(subset(dge1_l,padj <= 0.05 & log2FoldChange > 0))
d1dn_l <- rownames(subset(dge1_l,padj <= 0.05 & log2FoldChange < 0))
write.table(dge1_l,file="dge1_l.tsv",quote=FALSE,sep="\t")

dds <- DESeqDataSetFromMatrix(countData = xx1_o , colData = ss1_o , design = ~ Treatment )
## Warning in DESeqDataSet(se, design = design, ignoreRank): some variables in
## design formula are characters, converting to factors
res <- DESeq(dds)
## estimating size factors
## estimating dispersions
## gene-wise dispersion estimates
## mean-dispersion relationship
## final dispersion estimates
## fitting model and testing
## -- replacing outliers and refitting for 10 genes
## -- DESeq argument 'minReplicatesForReplace' = 7 
## -- original counts are preserved in counts(dds)
## estimating dispersions
## fitting model and testing
z <- results(res)
vsd <- vst(dds, blind=FALSE)
zz <- cbind(as.data.frame(z),assay(vsd))
dge <- as.data.frame(zz[order(zz$pvalue),])
dge1_o <- dge
d1up_o <- rownames(subset(dge1_o,padj <= 0.05 & log2FoldChange > 0))
d1dn_o <- rownames(subset(dge1_o,padj <= 0.05 & log2FoldChange < 0))
write.table(dge1_o,file="dge1_o.tsv",quote=FALSE,sep="\t")

# 2 amy
dds <- DESeqDataSetFromMatrix(countData = xx2_l , colData = ss2_l , design = ~ Treatment )
## Warning in DESeqDataSet(se, design = design, ignoreRank): some variables in
## design formula are characters, converting to factors
res <- DESeq(dds)
## estimating size factors
## estimating dispersions
## gene-wise dispersion estimates
## mean-dispersion relationship
## final dispersion estimates
## fitting model and testing
## -- replacing outliers and refitting for 5 genes
## -- DESeq argument 'minReplicatesForReplace' = 7 
## -- original counts are preserved in counts(dds)
## estimating dispersions
## fitting model and testing
z <- results(res)
vsd <- vst(dds, blind=FALSE)
zz <- cbind(as.data.frame(z),assay(vsd))
dge <- as.data.frame(zz[order(zz$pvalue),])
dge2_l <- dge
d2up_l <- rownames(subset(dge2_l,padj <= 0.05 & log2FoldChange > 0))
d2dn_l <- rownames(subset(dge2_l,padj <= 0.05 & log2FoldChange < 0))
write.table(dge2_l,file="dge2_l.tsv",quote=FALSE,sep="\t")

dds <- DESeqDataSetFromMatrix(countData = xx2_o , colData = ss2_o , design = ~ Treatment )
## Warning in DESeqDataSet(se, design = design, ignoreRank): some variables in
## design formula are characters, converting to factors
res <- DESeq(dds)
## estimating size factors
## estimating dispersions
## gene-wise dispersion estimates
## mean-dispersion relationship
## final dispersion estimates
## fitting model and testing
## -- replacing outliers and refitting for 19 genes
## -- DESeq argument 'minReplicatesForReplace' = 7 
## -- original counts are preserved in counts(dds)
## estimating dispersions
## fitting model and testing
z <- results(res)
vsd <- vst(dds, blind=FALSE)
zz <- cbind(as.data.frame(z),assay(vsd))
dge <- as.data.frame(zz[order(zz$pvalue),])
dge2_o <- dge
d2up_o <- rownames(subset(dge2_o,padj <= 0.05 & log2FoldChange > 0))
d2dn_o <- rownames(subset(dge2_o,padj <= 0.05 & log2FoldChange < 0))
write.table(dge2_o,file="dge2_o.tsv",quote=FALSE,sep="\t")

# 3 hip
dds <- DESeqDataSetFromMatrix(countData = xx3_l , colData = ss3_l , design = ~ Treatment )
## Warning in DESeqDataSet(se, design = design, ignoreRank): some variables in
## design formula are characters, converting to factors
res <- DESeq(dds)
## estimating size factors
## estimating dispersions
## gene-wise dispersion estimates
## mean-dispersion relationship
## final dispersion estimates
## fitting model and testing
## -- replacing outliers and refitting for 2 genes
## -- DESeq argument 'minReplicatesForReplace' = 7 
## -- original counts are preserved in counts(dds)
## estimating dispersions
## fitting model and testing
z <- results(res)
vsd <- vst(dds, blind=FALSE)
zz <- cbind(as.data.frame(z),assay(vsd))
dge <- as.data.frame(zz[order(zz$pvalue),])
dge3_l <- dge
d3up_l <- rownames(subset(dge3_l,padj <= 0.05 & log2FoldChange > 0))
d3dn_l <- rownames(subset(dge3_l,padj <= 0.05 & log2FoldChange < 0))
write.table(dge3_l,file="dge3_l.tsv",quote=FALSE,sep="\t")

dds <- DESeqDataSetFromMatrix(countData = xx3_o , colData = ss3_o , design = ~ Treatment )
## Warning in DESeqDataSet(se, design = design, ignoreRank): some variables in
## design formula are characters, converting to factors
res <- DESeq(dds)
## estimating size factors
## estimating dispersions
## gene-wise dispersion estimates
## mean-dispersion relationship
## final dispersion estimates
## fitting model and testing
## -- replacing outliers and refitting for 6 genes
## -- DESeq argument 'minReplicatesForReplace' = 7 
## -- original counts are preserved in counts(dds)
## estimating dispersions
## fitting model and testing
z <- results(res)
vsd <- vst(dds, blind=FALSE)
zz <- cbind(as.data.frame(z),assay(vsd))
dge <- as.data.frame(zz[order(zz$pvalue),])
dge3_o <- dge
d3up_o <- rownames(subset(dge3_o,padj <= 0.05 & log2FoldChange > 0))
d3dn_o <- rownames(subset(dge3_o,padj <= 0.05 & log2FoldChange < 0))
write.table(dge3_o,file="dge3_o.tsv",quote=FALSE,sep="\t")

# 4 pag
dds <- DESeqDataSetFromMatrix(countData = xx4_l , colData = ss4_l , design = ~ Treatment )
## Warning in DESeqDataSet(se, design = design, ignoreRank): some variables in
## design formula are characters, converting to factors
res <- DESeq(dds)
## estimating size factors
## estimating dispersions
## gene-wise dispersion estimates
## mean-dispersion relationship
## final dispersion estimates
## fitting model and testing
## -- replacing outliers and refitting for 6 genes
## -- DESeq argument 'minReplicatesForReplace' = 7 
## -- original counts are preserved in counts(dds)
## estimating dispersions
## fitting model and testing
z <- results(res)
vsd <- vst(dds, blind=FALSE)
zz <- cbind(as.data.frame(z),assay(vsd))
dge <- as.data.frame(zz[order(zz$pvalue),])
dge4_l <- dge
d4up_l <- rownames(subset(dge4_l,padj <= 0.05 & log2FoldChange > 0))
d4dn_l <- rownames(subset(dge4_l,padj <= 0.05 & log2FoldChange < 0))
write.table(dge4_l,file="dge4_l.tsv",quote=FALSE,sep="\t")

dds <- DESeqDataSetFromMatrix(countData = xx4_o , colData = ss4_o , design = ~ Treatment )
## Warning in DESeqDataSet(se, design = design, ignoreRank): some variables in
## design formula are characters, converting to factors
res <- DESeq(dds)
## estimating size factors
## estimating dispersions
## gene-wise dispersion estimates
## mean-dispersion relationship
## final dispersion estimates
## fitting model and testing
## -- replacing outliers and refitting for 4 genes
## -- DESeq argument 'minReplicatesForReplace' = 7 
## -- original counts are preserved in counts(dds)
## estimating dispersions
## fitting model and testing
z <- results(res)
vsd <- vst(dds, blind=FALSE)
zz <- cbind(as.data.frame(z),assay(vsd))
dge <- as.data.frame(zz[order(zz$pvalue),])
dge4_o <- dge
d4up_o <- rownames(subset(dge4_o,padj <= 0.05 & log2FoldChange > 0))
d4dn_o <- rownames(subset(dge4_o,padj <= 0.05 & log2FoldChange < 0))
write.table(dge4_o,file="dge4_o.tsv",quote=FALSE,sep="\t")

# 5 NI
dds <- DESeqDataSetFromMatrix(countData = xx5_l , colData = ss5_l , design = ~ Treatment )
## Warning in DESeqDataSet(se, design = design, ignoreRank): some variables in
## design formula are characters, converting to factors
res <- DESeq(dds)
## estimating size factors
## estimating dispersions
## gene-wise dispersion estimates
## mean-dispersion relationship
## final dispersion estimates
## fitting model and testing
## -- replacing outliers and refitting for 15 genes
## -- DESeq argument 'minReplicatesForReplace' = 7 
## -- original counts are preserved in counts(dds)
## estimating dispersions
## fitting model and testing
z <- results(res)
vsd <- vst(dds, blind=FALSE)
zz <- cbind(as.data.frame(z),assay(vsd))
dge <- as.data.frame(zz[order(zz$pvalue),])
dge5_l <- dge
d5up_l <- rownames(subset(dge5_l,padj <= 0.05 & log2FoldChange > 0))
d5dn_l <- rownames(subset(dge5_l,padj <= 0.05 & log2FoldChange < 0))
write.table(dge5_l,file="dge5_l.tsv",quote=FALSE,sep="\t")

dds <- DESeqDataSetFromMatrix(countData = xx5_o , colData = ss5_o , design = ~ Treatment )
## Warning in DESeqDataSet(se, design = design, ignoreRank): some variables in
## design formula are characters, converting to factors
res <- DESeq(dds)
## estimating size factors
## estimating dispersions
## gene-wise dispersion estimates
## mean-dispersion relationship
## final dispersion estimates
## fitting model and testing
## -- replacing outliers and refitting for 41 genes
## -- DESeq argument 'minReplicatesForReplace' = 7 
## -- original counts are preserved in counts(dds)
## estimating dispersions
## fitting model and testing
z <- results(res)
vsd <- vst(dds, blind=FALSE)
zz <- cbind(as.data.frame(z),assay(vsd))
dge <- as.data.frame(zz[order(zz$pvalue),])
dge5_o <- dge
d5up_o <- rownames(subset(dge5_o,padj <= 0.05 & log2FoldChange > 0))
d5dn_o <- rownames(subset(dge5_o,padj <= 0.05 & log2FoldChange < 0))
write.table(dge5_o,file="dge5_o.tsv",quote=FALSE,sep="\t")

Here let’s look at some plots.

MA plot shows the average level and fold change of all detected genes. Volcano plot shows the fold change and the significance, as measured by -log(p-value). Significant genes are shown as red points.

There are heatmaps of the top ranked genes by p-value. Above the gene expression values there is a bar in orange/gray colours. Control is shown in orange and treatment in grey.

maplot <- function(de,contrast_name) {
  de <- de[which(!is.na(de$padj)),]
  sig <-subset(de, padj < 0.05 )
  up <-rownames(subset(de, padj < 0.05 & log2FoldChange > 0))
  dn <-rownames(subset(de, padj < 0.05 & log2FoldChange < 0))
  GENESUP <- length(up)
  GENESDN <- length(dn)
  DET=nrow(de)
  SUBHEADER = paste(GENESUP, "up, ", GENESDN, "down", DET, "detected")
  ns <-subset(de, padj > 0.05 )
  plot(log2(de$baseMean),de$log2FoldChange,
       xlab="log2 basemean", ylab="log2 foldchange",
       pch=19, cex=0.5, col="dark gray",
       main=contrast_name, cex.main=1)
  points(log2(sig$baseMean),sig$log2FoldChange,
         pch=19, cex=0.5, col="red")
  mtext(SUBHEADER,cex = 1)
}

make_volcano_old <- function(de,name) {
    de <- de[which(!is.na(de$padj)),]
    de$pvalue[which(de$pvalue==0)] <- 1e-320
    sig <- subset(de,padj<0.05)
    N_SIG=nrow(sig)
    N_UP=nrow(subset(sig,log2FoldChange>0))
    N_DN=nrow(subset(sig,log2FoldChange<0))
    DET=nrow(de)
    HEADER=paste( DET, "detected,", N_SIG,"@5%FDR:", N_DN, "dn", N_UP, "up")
    plot(de$log2FoldChange,-log10(de$pval),cex=0.5,pch=19,col="darkgray",
        main=name, xlab="log2 FC", ylab="-log10 pval")
    mtext(HEADER)
    grid()
    points(sig$log2FoldChange,-log10(sig$pval),cex=0.5,pch=19,col="red")
}

make_volcano <- function(de,name) {
    de <- de[which(!is.na(de$padj)),]
    de$pvalue[which(de$pvalue==0)] <- 1e-320
    sig <- subset(de,padj<0.05)
    # get 5% FDR thresh
    myp = tail(sig,1)$pvalue
    myfdr = tail(sig,1)$padj
    fdrthresh = -log10(myp / myfdr * 0.05)
    N_SIG=nrow(sig)
    N_UP=nrow(subset(sig,log2FoldChange>0))
    N_DN=nrow(subset(sig,log2FoldChange<0))
    DET=nrow(de)
    HEADER=paste( DET, "detected,", N_SIG,"@5%FDR:", N_DN, "dn", N_UP, "up")
    plot(de$log2FoldChange,-log10(de$pval),cex=0.5,pch=19,col="darkgray",
        main=name, xlab="log2 FC", ylab="-log10 pval")
    mtext(HEADER)
    abline(h=fdrthresh,col="red",lty=2)
    abline(v=0,col="black",lty=2)
    grid()
    points(sig$log2FoldChange,-log10(sig$pval),cex=0.5,pch=19,col="red")
}

make_heatmap <- function(de,name,myss,mx,n=30){
  colfunc <- colorRampPalette(c("blue", "white", "red"))
  csc <- myss$Treatment
  csc <- gsub("Control","orange",csc)
  csc <- gsub("LPS","gray",csc)
  csc <- gsub("OVA","yellow",csc)
  mxn <- mx/rowSums(mx)*1000000
  x <- mxn[which(rownames(mxn) %in% rownames(head(de,n))),]
  heatmap.2(as.matrix(x),trace="none",col=colfunc(25),scale="row", margins = c(10,15), cexRow=0.7,
    main=paste("Top ranked",n,"genes in",name) , ColSideColors = csc  )
  mtext("ctrl=orange, LPS=gray, OVA=yellow")
}

make_heatmap2 <- function(de,name,myss,mx,n=30){
  colfunc <- colorRampPalette(c("blue", "white", "red"))
  csc <- myss$Treatment
  csc <- gsub("Control","orange",csc)
  csc <- gsub("LPS","gray",csc)
  csc <- gsub("OVA","yellow",csc)
  mxn <- mx/rowSums(mx)*1000000
  x <- mxn[which(rownames(mxn) %in% rownames(head(de,n))),]
  rownames(x) <- sapply(strsplit(rownames(x)," "),"[[",2)
  heatmap.2(as.matrix(x),trace="none",col=colfunc(25),scale="row", margins = c(10,15), cexRow=0.7,
    main=paste("Top ranked",n,"genes in",name) ,  ColSideColors = csc   )
  mtext("ctrl=orange, LPS=gray, OVA=yellow")
}

mymds <- function(de,name,myss,mx) {
  mds <- cmdscale(dist(t(mx)))
  csc <-  myss$Treatment
  csc <- gsub("Control","orange",csc)
  csc <- gsub("LPS","gray",csc)
  csc <- gsub("OVA","yellow",csc)
  plot(mds, xlab="Coordinate 1", ylab="Coordinate 2", main = name ,
    type = "p",bty="n",pch=19, cex=4 ,col=csc )
  text(mds, labels=rownames(mds) ,col="black")
  legend("topright", inset=.02, title="treatment",
    legend=unique(as.factor(myss$Treatment)) , pch=19, col=unique(csc),  cex=1.4)
}

Results for hypothalamus

We show an MDS plot, MA plot, volcano plot, heatmap and table of top results for each contrast.

mymds(de=dge1_l,name="Cont1: Effect of LPS treatment in hypothalamus",myss=ss1_l,mx=xx1_l)

maplot(dge1_l,"Cont1: Effect of LPS treatment in hypothalamus")

make_volcano(dge1_l,"Cont1: Effect of LPS treatment in hypothalamus")

make_heatmap(de=dge1_l,name="Cont1: Effect of LPS treatment in hypothalamus",myss=ss1_l,mx=xx1_l,n=50)

make_heatmap2(de=dge1_l,name="Cont1: Effect of LPS treatment in hypothalamus",myss=ss1_l,mx=xx1_l,n=50)

dge1_l[1:20,1:6] %>% kbl(caption = "Top gene expression differences for contrast 1: Effect of LPS treatment in hypothalamus") %>%
  kable_paper("hover", full_width = F)
Top gene expression differences for contrast 1: Effect of LPS treatment in hypothalamus
baseMean log2FoldChange lfcSE stat pvalue padj
ENSMUSG00000054252.19 Fgfr3 2892.62590 0.3328185 0.0609055 5.464504 0.00e+00 0.0006909
ENSMUSG00000022715.4 Tmem114 100.67950 0.8836136 0.1650244 5.354442 1.00e-07 0.0006909
ENSMUSG00000025498.16 Irf7 77.47802 -0.8571473 0.1692562 -5.064199 4.00e-07 0.0017092
ENSMUSG00000027875.13 Hmgcs2 180.91714 -0.6653837 0.1315622 -5.057562 4.00e-07 0.0017092
ENSMUSG00000028820.14 Sfpq 2569.85119 0.2618911 0.0527559 4.964201 7.00e-07 0.0022213
ENSMUSG00000041926.16 Rnpep 654.35913 0.2935820 0.0598784 4.902971 9.00e-07 0.0025330
ENSMUSG00000079363.8 Gbp4 72.55881 -1.1002191 0.2263856 -4.859934 1.20e-06 0.0027008
ENSMUSG00000018822.8 Sfrp5 659.14853 0.4883485 0.1033004 4.727461 2.30e-06 0.0041077
ENSMUSG00000026222.17 Sp100 55.19664 -0.7479415 0.1582800 -4.725433 2.30e-06 0.0041077
ENSMUSG00000028655.12 Mfsd2a 443.11911 0.5572282 0.1205845 4.621059 3.80e-06 0.0061467
ENSMUSG00000040253.16 Gbp7 103.19267 -0.6006230 0.1353212 -4.438500 9.10e-06 0.0132588
ENSMUSG00000004891.17 Nes 206.29657 0.4958473 0.1122069 4.419045 9.90e-06 0.0133010
ENSMUSG00000035578.17 Iqcg 381.27559 0.4608992 0.1047871 4.398437 1.09e-05 0.0135034
ENSMUSG00000108852.2 Gm44911 34.74705 0.9903775 0.2263409 4.375601 1.21e-05 0.0139263
ENSMUSG00000024907.8 Gal 1601.34229 0.3959929 0.0914229 4.331441 1.48e-05 0.0153554
ENSMUSG00000020717.20 Pecam1 340.34994 -0.3114213 0.0720066 -4.324902 1.53e-05 0.0153554
ENSMUSG00000051159.17 Cited1 338.53219 0.6483567 0.1506781 4.302925 1.69e-05 0.0159634
ENSMUSG00000051427.15 Ccdc157 914.73405 0.2973665 0.0699150 4.253256 2.11e-05 0.0188445
ENSMUSG00000028519.17 Dab1 925.88165 -0.2341632 0.0557089 -4.203335 2.63e-05 0.0222867
ENSMUSG00000064247.15 Plcxd1 838.55340 0.2157020 0.0515714 4.182586 2.88e-05 0.0232011
mymds(de=dge1_o,name="Cont1: Effect of OVA treatment in hypothalamus",myss=ss1_o,mx=xx1_o)

maplot(dge1_o,"Cont1: Effect of OVA treatment in hypothalamus")

make_volcano(dge1_o,"Cont1: Effect of OVA treatment in hypothalamus")

make_heatmap(de=dge1_o,name="Cont1: Effect of OVA treatment in hypothalamus",myss=ss1_o,mx=xx1_o,n=50)

make_heatmap2(de=dge1_o,name="Cont1: Effect of OVA treatment in hypothalamus",myss=ss1_o,mx=xx1_o,n=50)

dge1_o[1:20,1:6] %>% kbl(caption = "Top gene expression differences for contrast 1: Effect of treatment in hypothalamus") %>%
  kable_paper("hover", full_width = F)
Top gene expression differences for contrast 1: Effect of treatment in hypothalamus
baseMean log2FoldChange lfcSE stat pvalue padj
ENSMUSG00000078880.11 Gm14308 92.882830 -0.9356691 0.2192963 -4.266689 0.0000198 0.3395346
ENSMUSG00000036915.18 Kirrel2 169.164941 0.8427760 0.2297223 3.668673 0.0002438 0.9998282
ENSMUSG00000044285.9 Ubb-ps 2336.340595 -0.3680306 0.1025092 -3.590221 0.0003304 0.9998282
ENSMUSG00000085328.3 Gm17131 141.467376 -0.6729148 0.1891178 -3.558178 0.0003734 0.9998282
ENSMUSG00000030413.8 Pglyrp1 106.131949 0.6503273 0.1833759 3.546416 0.0003905 0.9998282
ENSMUSG00000033502.16 Cdc14a 100.974101 0.4596276 0.1301010 3.532853 0.0004111 0.9998282
ENSMUSG00000108601.2 Gm44645 94.446899 0.6303080 0.1803630 3.494664 0.0004747 0.9998282
ENSMUSG00000075014.2 Gm10800 33.751721 3.2629734 0.9463915 3.447805 0.0005652 0.9998282
ENSMUSG00000054252.19 Fgfr3 2730.435705 0.2147599 0.0630824 3.404437 0.0006630 0.9998282
ENSMUSG00000059970.8 Hspa2 641.897572 0.3132088 0.0939489 3.333822 0.0008566 0.9998282
ENSMUSG00000092483.2 Gm20421 22.954083 0.7081938 0.2204315 3.212761 0.0013147 0.9998282
ENSMUSG00000021892.15 Sh3bp5 762.980552 -0.1810008 0.0565574 -3.200302 0.0013728 0.9998282
ENSMUSG00000041079.13 Rwdd2b 175.004412 0.2696634 0.0866861 3.110802 0.0018658 0.9998282
ENSMUSG00000044707.8 Ccnjl 31.491228 -0.6302744 0.2031683 -3.102228 0.0019207 0.9998282
ENSMUSG00000053279.9 Aldh1a1 339.445293 0.4826510 0.1581715 3.051441 0.0022775 0.9998282
ENSMUSG00000020123.7 Avpr1a 98.069219 0.4957189 0.1626906 3.047004 0.0023113 0.9998282
ENSMUSG00000020374.17 Rasgef1c 258.064242 -0.2698852 0.0889452 -3.034285 0.0024111 0.9998282
ENSMUSG00000091318.3 Gm5415 9.042075 1.4281893 0.4797236 2.977109 0.0029098 0.9998282
ENSMUSG00000021750.17 Fam107a 3483.985160 0.2995835 0.1007207 2.974398 0.0029356 0.9998282
ENSMUSG00000013089.16 Etv5 587.848238 0.2785646 0.0939914 2.963723 0.0030394 0.9998282
pdf("plot12_de01.pdf")
mymds(de=dge1_l,name="Cont1: Effect of LPS treatment in hypothalamus",myss=ss1_l,mx=xx1_l)
maplot(dge1_l,"Cont1: Effect of LPS treatment in hypothalamus")
make_volcano(dge1_l,"Cont1: Effect of LPS treatment in hypothalamus")
make_heatmap(de=dge1_l,name="Cont1: Effect of LPS treatment in hypothalamus",myss=ss1_l,mx=xx1_l,n=50)
make_heatmap2(de=dge1_l,name="Cont1: Effect of LPS treatment in hypothalamus",myss=ss1_l,mx=xx1_l,n=50)
mymds(de=dge1_o,name="Cont1: Effect of OVA treatment in hypothalamus",myss=ss1_o,mx=xx1_o)
maplot(dge1_o,"Cont1: Effect of OVA treatment in hypothalamus")
make_volcano(dge1_o,"Cont1: Effect of OVA treatment in hypothalamus")
make_heatmap(de=dge1_o,name="Cont1: Effect of OVA treatment in hypothalamus",myss=ss1_o,mx=xx1_o,n=50)
make_heatmap2(de=dge1_o,name="Cont1: Effect of OVA treatment in hypothalamus",myss=ss1_o,mx=xx1_o,n=50)
dev.off()
## X11cairo 
##        2

Results for amygdala

mymds(de=dge2_l,name="Cont2: Effect of LPS treatment in amygdala",myss=ss2_l,mx=xx2_l)

maplot(dge2_l,"Cont2: Effect of LPS treatment in amygdala")

make_volcano(dge2_l,"Cont2: Effect of LPS treatment in amygdala")

make_heatmap(de=dge2_l,name="Cont2: Effect of LPS treatment in amygdala",myss=ss2_l,mx=xx2_l,n=50)

make_heatmap2(de=dge2_l,name="Cont2: Effect of LPS treatment in amygdala",myss=ss2_l,mx=xx2_l,n=50)

dge2_l[1:20,1:6] %>% kbl(caption = "Top gene expression differences for contrast 2: Effect of LPS treatment in amygdala") %>%
  kable_paper("hover", full_width = F)
Top gene expression differences for contrast 2: Effect of LPS treatment in amygdala
baseMean log2FoldChange lfcSE stat pvalue padj
ENSMUSG00000025498.16 Irf7 54.87672 -1.2294874 0.2232120 -5.508159 0.0000000 0.0006098
ENSMUSG00000079363.8 Gbp4 62.26653 -0.9118851 0.1718895 -5.305066 0.0000001 0.0006560
ENSMUSG00000036915.18 Kirrel2 254.72910 0.6575428 0.1241095 5.298088 0.0000001 0.0006560
ENSMUSG00000032902.2 Slc16a1 429.58840 -0.4275636 0.0835198 -5.119305 0.0000003 0.0011124
ENSMUSG00000018822.8 Sfrp5 179.17105 0.6336687 0.1241260 5.105042 0.0000003 0.0011124
ENSMUSG00000078921.4 Tgtp2 10.75353 -2.2904610 0.4554595 -5.028902 0.0000005 0.0013827
ENSMUSG00000027875.13 Hmgcs2 130.58206 -0.7567441 0.1547343 -4.890602 0.0000010 0.0024153
ENSMUSG00000007097.15 Atp1a2 13121.54535 0.2852928 0.0589693 4.837987 0.0000013 0.0027573
ENSMUSG00000027333.19 Smox 993.08881 0.3229665 0.0686244 4.706291 0.0000025 0.0047140
ENSMUSG00000004891.17 Nes 147.63914 0.5842943 0.1253589 4.660972 0.0000031 0.0052929
ENSMUSG00000102275.2 Gm37144 83.14632 -1.1552394 0.2515488 -4.592506 0.0000044 0.0066959
ENSMUSG00000089824.11 Rbm12 379.55172 -0.3020121 0.0696401 -4.336755 0.0000145 0.0202659
ENSMUSG00000060862.11 Zbtb40 209.30249 0.4768500 0.1107158 4.306972 0.0000166 0.0214112
ENSMUSG00000044712.16 Slc38a6 1014.61207 -0.4381471 0.1034282 -4.236245 0.0000227 0.0273039
ENSMUSG00000020680.16 Taf15 956.83934 0.3203512 0.0800847 4.000154 0.0000633 0.0709734
ENSMUSG00000034173.14 Zbed5 124.05394 -0.4521479 0.1157090 -3.907630 0.0000932 0.0979709
ENSMUSG00000006390.16 Elovl1 217.76918 0.3244737 0.0834422 3.888604 0.0001008 0.0997431
ENSMUSG00000052911.10 Lamb2 645.20070 0.3401842 0.0883340 3.851114 0.0001176 0.1098606
ENSMUSG00000031465.7 Angpt2 32.01754 -0.7723745 0.2036123 -3.793359 0.0001486 0.1315547
ENSMUSG00000100750.2 Gm29084 513.48571 -0.3339886 0.0899518 -3.712974 0.0002048 0.1722483
mymds(de=dge2_o,name="Cont2: Effect of OVA treatment in amygdala",myss=ss2_o,mx=xx2_o)

maplot(dge2_o,"Cont2: Effect of OVA treatment in amygdala")

make_volcano(dge2_o,"Cont2: Effect of OVA treatment in amygdala")

make_heatmap(de=dge2_o,name="Cont2: Effect of OVA treatment in amygdala",myss=ss2_o,mx=xx2_o,n=50)

make_heatmap2(de=dge2_o,name="Cont2: Effect of OVA treatment in amygdala",myss=ss2_o,mx=xx2_o,n=50)

dge2_o[1:20,1:6] %>% kbl(caption = "Top gene expression differences for contrast 2: Effect of treatment in amygdala") %>%
  kable_paper("hover", full_width = F)
Top gene expression differences for contrast 2: Effect of treatment in amygdala
baseMean log2FoldChange lfcSE stat pvalue padj
ENSMUSG00000107676.2 Gm44178 185.4223 -0.8648437 0.1423153 -6.076956 0.0e+00 0.0000164
ENSMUSG00000025791.19 Pgm1 1679.6378 0.2939654 0.0506255 5.806664 0.0e+00 0.0000315
ENSMUSG00000030889.15 Vwa3a 101.9254 -0.7011680 0.1211103 -5.789499 0.0e+00 0.0000315
ENSMUSG00000059149.18 Mfsd4a 841.7077 -0.3390365 0.0621451 -5.455561 0.0e+00 0.0001636
ENSMUSG00000036915.18 Kirrel2 266.3206 0.8297410 0.1549163 5.356062 1.0e-07 0.0002019
ENSMUSG00000024782.8 Ak3 1076.8616 0.3287706 0.0615097 5.345017 1.0e-07 0.0002019
ENSMUSG00000018822.8 Sfrp5 171.4710 0.6007642 0.1168718 5.140370 3.0e-07 0.0005249
ENSMUSG00000032507.16 Fbxl2 973.7927 -0.3006599 0.0592058 -5.078214 4.0e-07 0.0006064
ENSMUSG00000053279.9 Aldh1a1 232.1522 0.5728101 0.1130798 5.065538 4.0e-07 0.0006064
ENSMUSG00000034413.15 Neurl1b 998.7317 -0.4392775 0.0892047 -4.924376 8.0e-07 0.0010672
ENSMUSG00000038633.6 Degs1 1216.6775 0.3005384 0.0611145 4.917627 9.0e-07 0.0010672
ENSMUSG00000030256.12 Bhlhe41 1281.0403 0.3288133 0.0684756 4.801908 1.6e-06 0.0017551
ENSMUSG00000030499.10 Kctd15 178.8979 -0.4463070 0.0942096 -4.737384 2.2e-06 0.0022317
ENSMUSG00000030209.15 Grin2b 4116.6194 -0.4866258 0.1043231 -4.664600 3.1e-06 0.0029599
ENSMUSG00000038738.16 Shank1 6687.6830 -0.3929989 0.0868324 -4.525946 6.0e-06 0.0053717
ENSMUSG00000006390.16 Elovl1 227.2895 0.5070433 0.1126133 4.502516 6.7e-06 0.0054351
ENSMUSG00000038260.11 Trpm4 233.7264 -0.4194385 0.0935316 -4.484457 7.3e-06 0.0054351
ENSMUSG00000034818.18 Celf5 4451.3635 -0.3143020 0.0701827 -4.478343 7.5e-06 0.0054351
ENSMUSG00000079018.11 Ly6c1 374.3433 0.4597376 0.1027940 4.472418 7.7e-06 0.0054351
ENSMUSG00000031513.9 Leprotl1 1221.1671 0.2195997 0.0492131 4.462220 8.1e-06 0.0054351
pdf("plot13_de02.pdf")
mymds(de=dge2_l,name="Cont2: Effect of LPS treatment in amygdala",myss=ss2_l,mx=xx2_l)
maplot(dge2_l,"Cont2: Effect of LPS treatment in amygdala")
make_volcano(dge2_l,"Cont2: Effect of LPS treatment in amygdala")
make_heatmap(de=dge2_l,name="Cont2: Effect of LPS treatment in amygdala",myss=ss2_l,mx=xx2_l,n=50)
make_heatmap2(de=dge2_l,name="Cont2: Effect of LPS treatment in amygdala",myss=ss2_l,mx=xx2_l,n=50)
mymds(de=dge2_o,name="Cont2: Effect of OVA treatment in amygdala",myss=ss2_o,mx=xx2_o)
maplot(dge2_o,"Cont2: Effect of OVA treatment in amygdala")
make_volcano(dge2_o,"Cont2: Effect of OVA treatment in amygdala")
make_heatmap(de=dge2_o,name="Cont2: Effect of OVA treatment in amygdala",myss=ss2_o,mx=xx2_o,n=50)
make_heatmap2(de=dge2_o,name="Cont2: Effect of OVA treatment in amygdala",myss=ss2_o,mx=xx2_o,n=50)
dev.off()
## X11cairo 
##        2

Results for hippocampus

mymds(de=dge3_l,name="Cont3: Effect of LPS treatment in hippocampus",myss=ss3_l,mx=xx3_l)

maplot(dge3_l,"Cont3: Effect of LPS treatment in hippocampus")

make_volcano(dge3_l,"Cont3: Effect of LPS treatment in hippocampus")

make_heatmap(de=dge3_l,name="Cont3: Effect of LPS treatment in hippocampus",myss=ss3_l,mx=xx3_l,n=50)

make_heatmap2(de=dge3_l,name="Cont3: Effect of LPS treatment in hippocampus",myss=ss3_l,mx=xx3_l,n=50)

dge3_l[1:20,1:6] %>% kbl(caption = "Top gene expression differences for contrast 3: Effect of LPS treatment in hippocampus") %>%
  kable_paper("hover", full_width = F)
Top gene expression differences for contrast 3: Effect of LPS treatment in hippocampus
baseMean log2FoldChange lfcSE stat pvalue padj
ENSMUSG00000100862.2 Gm10925 4975.55176 7.1868883 0.6335748 11.343393 0 0
ENSMUSG00000070713.6 Gm10282 208.77183 -1.0025619 0.0983370 -10.195161 0 0
ENSMUSG00000040447.16 Spns2 1554.46939 0.5308742 0.0527511 10.063750 0 0
ENSMUSG00000081603.2 Gm14681 107.33155 -1.1109529 0.1168663 -9.506187 0 0
ENSMUSG00000068882.14 Ssb 1815.27129 -0.5934983 0.0624491 -9.503708 0 0
ENSMUSG00000096006.2 Gm21596 253.23289 -0.7510200 0.0804176 -9.338997 0 0
ENSMUSG00000024261.7 Syt4 2094.97545 -0.5610059 0.0603557 -9.294993 0 0
ENSMUSG00000025104.14 Hdgfl3 2080.41389 -0.4435812 0.0489446 -9.062924 0 0
ENSMUSG00000017831.9 Rab5a 2217.40639 -0.4345348 0.0480838 -9.037037 0 0
ENSMUSG00000047879.18 Usp14 2271.47824 -0.4272710 0.0481656 -8.870869 0 0
ENSMUSG00000022884.17 Eif4a2 11561.93282 -0.4719840 0.0534312 -8.833493 0 0
ENSMUSG00000001891.17 Ugp2 1364.63153 -0.5993403 0.0678779 -8.829678 0 0
ENSMUSG00000084838.4 Gm10241 29.45661 8.3716581 0.9510624 8.802428 0 0
ENSMUSG00000026775.10 Yme1l1 1252.73281 -0.4786876 0.0544396 -8.792996 0 0
ENSMUSG00000020650.16 Bcap29 663.57029 -0.7001171 0.0803572 -8.712561 0 0
ENSMUSG00000042303.20 Sgsm3 1281.38919 0.3735305 0.0430203 8.682650 0 0
ENSMUSG00000071533.12 Pcnp 2553.37357 -0.4279186 0.0500775 -8.545132 0 0
ENSMUSG00000020238.15 Ncln 1446.32940 0.4261658 0.0499872 8.525490 0 0
ENSMUSG00000014905.5 Dnajb9 663.84669 -0.6632246 0.0778235 -8.522161 0 0
ENSMUSG00000057963.10 Itpk1 1451.17452 0.4522885 0.0532812 8.488701 0 0
mymds(de=dge3_o,name="Cont3: Effect of OVA treatment in hippocampus",myss=ss3_o,mx=xx3_o)

maplot(dge3_o,"Cont3: Effect of OVA treatment in hippocampus")

make_volcano(dge3_o,"Cont3: Effect of OVA treatment in hippocampus")

make_heatmap(de=dge3_o,name="Cont3: Effect of OVA treatment in hippocampus",myss=ss3_o,mx=xx3_o,n=50)

make_heatmap2(de=dge3_o,name="Cont3: Effect of OVA treatment in hippocampus",myss=ss3_o,mx=xx3_o,n=50)

dge3_o[1:20,1:6] %>% kbl(caption = "Top gene expression differences for contrast 3: Effect of treatment in hippocampus") %>%
  kable_paper("hover", full_width = F)
Top gene expression differences for contrast 3: Effect of treatment in hippocampus
baseMean log2FoldChange lfcSE stat pvalue padj
ENSMUSG00000008668.16 Rps18 286.52172 -1.2451711 0.1674818 -7.434667 0.0e+00 0.0000000
ENSMUSG00000069008.4 Gm5537 14.35881 21.8370339 2.9884331 7.307185 0.0e+00 NA
ENSMUSG00000103034.2 Gm8797 107.80783 -1.1733731 0.1762296 -6.658206 0.0e+00 NA
ENSMUSG00000100862.2 Gm10925 1945.80382 5.8231351 0.9533584 6.108023 0.0e+00 0.0000059
ENSMUSG00000040447.16 Spns2 1527.35914 0.4988942 0.0886928 5.624970 0.0e+00 0.0000723
ENSMUSG00000081603.2 Gm14681 113.88393 -0.8342655 0.1522504 -5.479560 0.0e+00 0.0001247
ENSMUSG00000031858.17 Mau2 1851.99608 0.4053541 0.0759055 5.340248 1.0e-07 0.0002171
ENSMUSG00000084838.4 Gm10241 17.62940 7.6366750 1.4333637 5.327800 1.0e-07 NA
ENSMUSG00000021270.14 Hsp90aa1 19731.71056 -0.4150097 0.0812580 -5.107311 3.0e-07 0.0006369
ENSMUSG00000024883.9 Rin1 1730.36849 0.3961802 0.0785513 5.043585 5.0e-07 0.0007633
ENSMUSG00000001467.6 Cyp51 914.60992 -0.3266949 0.0652770 -5.004751 6.0e-07 0.0008176
ENSMUSG00000102627.2 Snurf 22.95625 8.0174386 1.6395147 4.890129 1.0e-06 NA
ENSMUSG00000044285.9 Ubb-ps 2010.40856 -0.9247134 0.1896289 -4.876438 1.1e-06 0.0014035
ENSMUSG00000107499.2 Ccdc142 44.66779 1.0467235 0.2150830 4.866603 1.1e-06 NA
ENSMUSG00000060862.11 Zbtb40 211.85127 0.6799751 0.1415661 4.803233 1.6e-06 0.0018257
ENSMUSG00000053550.14 Shisa7 2819.07578 0.6097051 0.1286592 4.738915 2.1e-06 0.0021791
ENSMUSG00000048154.18 Kmt2d 2495.07018 0.7784121 0.1651030 4.714707 2.4e-06 0.0021791
ENSMUSG00000032855.7 Pkd1 2513.84342 0.7124951 0.1511267 4.714553 2.4e-06 0.0021791
ENSMUSG00000078881.11 Gm14434 265.26689 -1.1328384 0.2439904 -4.642963 3.4e-06 0.0028688
ENSMUSG00000094437.3 Gm9830 43.94751 1.7576897 0.3813574 4.609036 4.0e-06 NA
pdf("plot14_de03.pdf")
mymds(de=dge3_l,name="Cont3: Effect of LPS treatment in hippocampus",myss=ss3_l,mx=xx3_l)
maplot(dge3_l,"Cont3: Effect of LPS treatment in hippocampus")
make_volcano(dge3_l,"Cont3: Effect of LPS treatment in hippocampus")
make_heatmap(de=dge3_l,name="Cont3: Effect of LPS treatment in hippocampus",myss=ss3_l,mx=xx3_l,n=50)
make_heatmap2(de=dge3_l,name="Cont3: Effect of LPS treatment in hippocampus",myss=ss3_l,mx=xx3_l,n=50)
mymds(de=dge3_o,name="Cont3: Effect of OVA treatment in hippocampus",myss=ss3_o,mx=xx3_o)
maplot(dge3_o,"Cont3: Effect of OVA treatment in hippocampus")
make_volcano(dge3_o,"Cont3: Effect of OVA treatment in hippocampus")
make_heatmap(de=dge3_o,name="Cont3: Effect of OVA treatment in hippocampus",myss=ss3_o,mx=xx3_o,n=50)
make_heatmap2(de=dge3_o,name="Cont3: Effect of OVA treatment in hippocampus",myss=ss3_o,mx=xx3_o,n=50)
dev.off()
## X11cairo 
##        2

Results for PAG

mymds(de=dge4_l,name="Cont4: Effect of LPS treatment in PAG",myss=ss4_l,mx=xx4_l)

maplot(dge4_l,"Cont4: Effect of LPS treatment in PAG")

make_volcano(dge4_l,"Cont4: Effect of LPS treatment in PAG")

make_heatmap(de=dge4_l,name="Cont4: Effect of LPS treatment in PAG",myss=ss4_l,mx=xx4_l,n=50)

make_heatmap2(de=dge4_l,name="Cont3: Effect of LPS treatment in PAG",myss=ss4_l,mx=xx4_l,n=50)

dge4_l[1:20,1:6] %>% kbl(caption = "Top gene expression differences for contrast 4: Effect of LPS treatment in PAG") %>%
  kable_paper("hover", full_width = F)
Top gene expression differences for contrast 4: Effect of LPS treatment in PAG
baseMean log2FoldChange lfcSE stat pvalue padj
ENSMUSG00000101111.2 Gm28437 1489.59991 -28.4058070 2.9866471 -9.510935 0.0000000 0.0000000
ENSMUSG00000034459.9 Ifit1 55.64874 -1.1808759 0.1686328 -7.002649 0.0000000 0.0000000
ENSMUSG00000079363.8 Gbp4 95.91494 -1.2292487 0.1854179 -6.629613 0.0000000 0.0000002
ENSMUSG00000025498.16 Irf7 84.22641 -1.0483087 0.1595935 -6.568618 0.0000000 0.0000002
ENSMUSG00000078922.10 Tgtp1 21.82329 -2.6093058 0.4065209 -6.418626 0.0000000 0.0000005
ENSMUSG00000102070.2 Gm28661 10196.94116 -14.7763443 2.9540986 -5.001981 0.0000006 0.0016656
ENSMUSG00000028820.14 Sfpq 2198.16793 0.2648449 0.0535496 4.945791 0.0000008 0.0019080
ENSMUSG00000036915.18 Kirrel2 82.56463 0.9736571 0.2004918 4.856344 0.0000012 0.0026324
ENSMUSG00000026222.17 Sp100 58.86066 -0.8315047 0.1797559 -4.625743 0.0000037 0.0073042
ENSMUSG00000075602.11 Ly6a 107.28664 -0.8323082 0.1822514 -4.566814 0.0000050 0.0087213
ENSMUSG00000024079.5 Eif2ak2 182.29278 -0.3940654 0.0893055 -4.412555 0.0000102 0.0155853
ENSMUSG00000078921.4 Tgtp2 20.19923 -1.2810520 0.2908727 -4.404167 0.0000106 0.0155853
ENSMUSG00000052776.11 Oas1a 19.16469 -1.2619796 0.2896101 -4.357512 0.0000132 0.0178219
ENSMUSG00000028268.15 Gbp3 138.45727 -0.5635390 0.1327639 -4.244671 0.0000219 0.0275394
ENSMUSG00000054072.13 Iigp1 23.29794 -1.4762784 0.3644390 -4.050824 0.0000510 0.0599248
ENSMUSG00000110862.2 Gm35835 17.20473 -1.2465344 0.3123628 -3.990663 0.0000659 0.0685953
ENSMUSG00000027875.13 Hmgcs2 123.00353 -0.7999616 0.2005166 -3.989504 0.0000662 0.0685953
ENSMUSG00000002289.17 Angptl4 67.16713 -0.6692079 0.1702196 -3.931438 0.0000844 0.0826191
ENSMUSG00000015085.9 Entpd2 359.15806 0.3576188 0.0921084 3.882584 0.0001034 0.0954024
ENSMUSG00000030107.11 Usp18 27.77358 -0.9172425 0.2372305 -3.866461 0.0001104 0.0954024
mymds(de=dge4_o,name="Cont4: Effect of OVA treatment in PAG",myss=ss4_o,mx=xx4_o)

maplot(dge4_o,"Cont4: Effect of OVA treatment in PAG")

make_volcano(dge4_o,"Cont4: Effect of OVA treatment in PAG")

make_heatmap(de=dge4_o,name="Cont4: Effect of OVA treatment in PAG",myss=ss4_o,mx=xx4_o,n=50)

make_heatmap2(de=dge4_o,name="Cont4: Effect of OVA treatment in PAG",myss=ss4_o,mx=xx4_o,n=50)

dge4_o[1:20,1:6] %>% kbl(caption = "Top gene expression differences for contrast 4: Effect of treatment in PAG") %>%
  kable_paper("hover", full_width = F)
Top gene expression differences for contrast 4: Effect of treatment in PAG
baseMean log2FoldChange lfcSE stat pvalue padj
ENSMUSG00000101111.2 Gm28437 1504.44501 -28.8708740 2.9866471 -9.666651 0.0000000 0.0000000
ENSMUSG00000036915.18 Kirrel2 88.57030 1.1004532 0.2077438 5.297165 0.0000001 0.0010387
ENSMUSG00000106604.3 Gm42535 45.90967 -1.3651174 0.2757149 -4.951192 0.0000007 0.0043425
ENSMUSG00000102070.2 Gm28661 10298.72248 -14.1414027 2.9291777 -4.827772 0.0000014 0.0060964
ENSMUSG00000085328.3 Gm17131 231.90596 -0.6897420 0.1730516 -3.985758 0.0000673 0.2376070
ENSMUSG00000118642.2 AY036118 813.47892 -0.9127923 0.2465059 -3.702922 0.0002131 0.6273842
ENSMUSG00000102289.2 Gm31258 14.36741 -1.5814526 0.4320332 -3.660488 0.0002517 0.6351635
ENSMUSG00000021906.15 Oxnad1 298.24353 0.2627823 0.0731645 3.591666 0.0003286 0.7254015
ENSMUSG00000028820.14 Sfpq 2221.70651 0.2671342 0.0763080 3.500736 0.0004640 0.9105264
ENSMUSG00000094672.3 Vmn2r25 14.38564 -1.6452102 0.4753780 -3.460847 0.0005385 0.9510627
ENSMUSG00000054252.19 Fgfr3 2567.78162 0.3560764 0.1040765 3.421295 0.0006232 0.9754406
ENSMUSG00000024998.18 Plce1 525.21275 0.3861609 0.1134704 3.403185 0.0006661 0.9754406
ENSMUSG00000013089.16 Etv5 501.24250 0.2879667 0.0851978 3.379980 0.0007249 0.9754406
ENSMUSG00000047216.9 Cdh19 172.79548 0.5469923 0.1627061 3.361844 0.0007742 0.9754406
ENSMUSG00000115632.2 Gm17922 12.17839 -2.0478089 0.6150693 -3.329396 0.0008703 0.9754406
ENSMUSG00000067220.13 Cnga1 22.07693 -1.3574772 0.4082491 -3.325120 0.0008838 0.9754406
ENSMUSG00000046678.7 Olfr981 15.67008 -1.2921922 0.3905994 -3.308229 0.0009389 0.9754406
ENSMUSG00000007682.8 Dio2 395.46383 0.4716641 0.1435644 3.285383 0.0010184 0.9904947
ENSMUSG00000108827.4 Olfr1310 28.09654 -1.3088894 0.4003901 -3.269035 0.0010791 0.9904947
ENSMUSG00000002831.15 Plin4 203.85756 1.4385797 0.4416960 3.256946 0.0011262 0.9904947
pdf("plot15_de04.pdf")
mymds(de=dge4_l,name="Cont4: Effect of LPS treatment in PAG",myss=ss4_l,mx=xx4_l)
maplot(dge4_l,"Cont4: Effect of LPS treatment in PAG")
make_volcano(dge4_l,"Cont4: Effect of LPS treatment in PAG")
make_heatmap(de=dge4_l,name="Cont4: Effect of LPS treatment in PAG",myss=ss4_l,mx=xx4_l,n=50)
make_heatmap2(de=dge4_l,name="Cont3: Effect of LPS treatment in PAG",myss=ss4_l,mx=xx4_l,n=50)
mymds(de=dge4_o,name="Cont4: Effect of OVA treatment in PAG",myss=ss4_o,mx=xx4_o)
maplot(dge4_o,"Cont4: Effect of OVA treatment in PAG")
make_volcano(dge4_o,"Cont4: Effect of OVA treatment in PAG")
make_heatmap(de=dge4_o,name="Cont4: Effect of OVA treatment in PAG",myss=ss4_o,mx=xx4_o,n=50)
make_heatmap2(de=dge4_o,name="Cont4: Effect of OVA treatment in PAG",myss=ss4_o,mx=xx4_o,n=50)
dev.off()
## X11cairo 
##        2

Results for NI

mymds(de=dge5_l,name="Cont5: Effect of LPS treatment in NI",myss=ss5_l,mx=xx5_l)

maplot(dge5_l,"Cont5: Effect of LPS treatment in NI")

make_volcano(dge5_l,"Cont5: Effect of LPS treatment in NI")

make_heatmap(de=dge5_l,name="Cont5: Effect of LPS treatment in NI",myss=ss5_l,mx=xx5_l,n=50)

make_heatmap2(de=dge5_l,name="Cont3: Effect of LPS treatment in NI",myss=ss5_l,mx=xx5_l,n=50)

dge5_l[1:20,1:6] %>% kbl(caption = "Top gene expression differences for contrast 5: Effect of LPS treatment in NI") %>%
  kable_paper("hover", full_width = F)
Top gene expression differences for contrast 5: Effect of LPS treatment in NI
baseMean log2FoldChange lfcSE stat pvalue padj
ENSMUSG00000004655.6 Aqp1 64.33666 -2.5245691 0.4256671 -5.930853 0.0e+00 0.0000404
ENSMUSG00000002831.15 Plin4 250.84384 1.5543801 0.2773464 5.604472 0.0e+00 0.0001368
ENSMUSG00000026822.15 Lcn2 16.22880 -2.6059016 0.4734932 -5.503567 0.0e+00 NA
ENSMUSG00000028919.12 Arhgef19 395.89057 0.4100393 0.0746763 5.490892 0.0e+00 0.0001368
ENSMUSG00000022425.17 Enpp2 8280.82063 -1.1048917 0.2013475 -5.487486 0.0e+00 0.0001368
ENSMUSG00000068699.13 Flnc 125.76677 0.8058438 0.1494388 5.392467 1.0e-07 0.0001573
ENSMUSG00000053646.14 Plxnb1 2389.38786 0.3753821 0.0697524 5.381640 1.0e-07 0.0001573
ENSMUSG00000071267.12 Zfp942 226.23109 -0.5520131 0.1029389 -5.362533 1.0e-07 0.0001573
ENSMUSG00000036890.14 Gtdc1 411.57310 -0.4107206 0.0781476 -5.255700 1.0e-07 0.0002474
ENSMUSG00000078922.10 Tgtp1 37.06696 -2.2129060 0.4225152 -5.237459 2.0e-07 NA
ENSMUSG00000039959.14 Hip1 856.67943 0.5239050 0.1013262 5.170477 2.0e-07 0.0003482
ENSMUSG00000068323.13 Slc4a5 92.61322 -1.8988675 0.3702782 -5.128219 3.0e-07 0.0003771
ENSMUSG00000114133.2 Gm20075 468.65132 -0.3716223 0.0726130 -5.117845 3.0e-07 0.0003771
ENSMUSG00000021696.10 Elovl7 524.66657 -0.4441318 0.0873935 -5.081979 4.0e-07 0.0004178
ENSMUSG00000027875.13 Hmgcs2 132.26542 -1.1687659 0.2334476 -5.006545 6.0e-07 0.0005721
ENSMUSG00000060862.11 Zbtb40 245.30142 0.6788979 0.1360226 4.991069 6.0e-07 0.0005756
ENSMUSG00000113337.2 Gm19220 2324.88228 1.0465161 0.2131860 4.908936 9.0e-07 0.0008193
ENSMUSG00000045039.10 Megf8 3979.39321 0.3979746 0.0822716 4.837328 1.3e-06 0.0011038
ENSMUSG00000069833.14 Ahnak 814.46670 0.6652302 0.1391700 4.779984 1.8e-06 0.0013840
ENSMUSG00000015652.10 Steap1 18.65542 -2.4798774 0.5203028 -4.766219 1.9e-06 NA
mymds(de=dge5_o,name="Cont5: Effect of OVA treatment in NI",myss=ss5_o,mx=xx5_o)

maplot(dge5_o,"Cont4: Effect of OVA treatment in NI")

make_volcano(dge5_o,"Cont5: Effect of OVA treatment in NI")

make_heatmap(de=dge5_o,name="Cont5: Effect of OVA treatment in NI",myss=ss5_o,mx=xx5_o,n=50)

make_heatmap2(de=dge5_o,name="Cont5: Effect of OVA treatment in NI",myss=ss5_o,mx=xx5_o,n=50)

dge5_o[1:20,1:6] %>% kbl(caption = "Top gene expression differences for contrast 5: Effect of treatment in NI") %>%
  kable_paper("hover", full_width = F)
Top gene expression differences for contrast 5: Effect of treatment in NI
baseMean log2FoldChange lfcSE stat pvalue padj
ENSMUSG00000056260.16 Lrif1 211.98587 -0.7336887 0.1100875 -6.664595 0.00e+00 0.0000003
ENSMUSG00000002831.15 Plin4 258.40488 1.6709594 0.2980839 5.605668 0.00e+00 0.0001173
ENSMUSG00000055322.17 Tns1 1466.90156 0.3981360 0.0721780 5.516031 0.00e+00 0.0001307
ENSMUSG00000015944.10 Castor2 3213.72353 0.3932529 0.0758616 5.183820 2.00e-07 0.0006144
ENSMUSG00000024175.3 Tekt4 67.10906 0.9393058 0.1822044 5.155233 3.00e-07 NA
ENSMUSG00000020116.8 Pno1 507.57144 -0.3892492 0.0798403 -4.875347 1.10e-06 0.0024561
ENSMUSG00000000194.14 Gpr107 1069.00316 0.3266125 0.0685118 4.767246 1.90e-06 0.0035192
ENSMUSG00000055782.10 Abcd2 665.20587 -0.4696031 0.0996124 -4.714301 2.40e-06 0.0035595
ENSMUSG00000117284.2 Gm7072 208.57068 -0.5445045 0.1156892 -4.706613 2.50e-06 0.0035595
ENSMUSG00000074505.7 Fat3 548.94128 0.5489851 0.1177974 4.660416 3.20e-06 0.0039643
ENSMUSG00000060862.11 Zbtb40 233.67044 0.5799773 0.1251034 4.635981 3.60e-06 0.0040164
ENSMUSG00000069833.14 Ahnak 857.16074 0.8065828 0.1763222 4.574483 4.80e-06 0.0046838
ENSMUSG00000067038.7 Rps12-ps3 447.47971 -1.9169288 0.4198274 -4.565993 5.00e-06 0.0046838
ENSMUSG00000027708.15 Dcun1d1 788.59922 -0.3874162 0.0869258 -4.456861 8.30e-06 0.0072331
ENSMUSG00000045039.10 Megf8 3981.85021 0.4012817 0.0919057 4.366235 1.26e-05 0.0101992
ENSMUSG00000043733.15 Ptpn11 4319.80686 0.3173738 0.0730162 4.346623 1.38e-05 0.0101992
ENSMUSG00000019232.15 Etnppl 1154.63560 0.7040907 0.1623392 4.337157 1.44e-05 0.0101992
ENSMUSG00000068798.11 Rap1a 1471.01059 -0.4872519 0.1137471 -4.283643 1.84e-05 0.0115374
ENSMUSG00000027206.14 Cops2 2031.84090 -0.3788991 0.0885072 -4.280998 1.86e-05 0.0115374
ENSMUSG00000025903.15 Lypla1 715.48002 -0.5016851 0.1174408 -4.271815 1.94e-05 0.0115374
pdf("plot16_de05.pdf")
mymds(de=dge5_l,name="Cont5: Effect of LPS treatment in NI",myss=ss5_l,mx=xx5_l)
maplot(dge5_l,"Cont5: Effect of LPS treatment in NI")
make_volcano(dge5_l,"Cont5: Effect of LPS treatment in NI")
make_heatmap(de=dge5_l,name="Cont5: Effect of LPS treatment in NI",myss=ss5_l,mx=xx5_l,n=50)
make_heatmap2(de=dge5_l,name="Cont3: Effect of LPS treatment in NI",myss=ss5_l,mx=xx5_l,n=50)
mymds(de=dge5_o,name="Cont5: Effect of OVA treatment in NI",myss=ss5_o,mx=xx5_o)
maplot(dge5_o,"Cont4: Effect of OVA treatment in NI")
make_volcano(dge5_o,"Cont5: Effect of OVA treatment in NI")
make_heatmap(de=dge5_o,name="Cont5: Effect of OVA treatment in NI",myss=ss5_o,mx=xx5_o,n=50)
make_heatmap2(de=dge5_o,name="Cont5: Effect of OVA treatment in NI",myss=ss5_o,mx=xx5_o,n=50)
dev.off()
## X11cairo 
##        2

Euler diagrams

Below we’re comparing the effect of the two treatments on the number of genes found, using an Euler diagram.

par(mar=c(2,2,2,2))

v1 <- list("hyp LPS up"=d1up_l,
  "hyp LPS dn"=d1dn_l,
  "hyp OVA up"=d1up_o,
  "hyp OVA dn"=d1dn_o)
plot(euler(v1),quantities = TRUE, edges = "gray", main="effect of treatments on hyp")

v2 <- list("amy LPS up"=d2up_l,
  "amy LPS dn"=d2dn_l,
  "amy OVA up"=d2up_o,
  "amy OVA dn"=d2dn_o)
plot(euler(v2),quantities = TRUE, edges = "gray", main="effect of treatments on amy")

v3 <- list("hip LPS up"=d3up_l,
  "hip LPS dn"=d3dn_l,
  "hip OVA up"=d3up_o,
  "hip OVA dn"=d3dn_o)
plot(euler(v3),quantities = TRUE, edges = "gray", main="effect of treatments on hip")

v4 <- list("pag LPS up"=d4up_l,
  "pag LPS dn"=d4dn_l,
  "pag OVA up"=d4up_o,
  "pag OVA dn"=d4dn_o)
plot(euler(v4),quantities = TRUE, edges = "gray", main="effect of treatments on pag")

v5 <- list("NI LPS up"=d5up_l,
  "NI LPS dn"=d5dn_l,
  "NI OVA up"=d5up_o,
  "NI OVA dn"=d5dn_o)
plot(euler(v5),quantities = TRUE, edges = "gray", main="effect of treatments on ni")

pdf("plot17_euler01.pdf")
plot(euler(v1),quantities = TRUE, edges = "gray", main="effect of treatments on hyp")
plot(euler(v2),quantities = TRUE, edges = "gray", main="effect of treatments on amy")
plot(euler(v3),quantities = TRUE, edges = "gray", main="effect of treatments on hip")
plot(euler(v4),quantities = TRUE, edges = "gray", main="effect of treatments on pag")
plot(euler(v5),quantities = TRUE, edges = "gray", main="effect of treatments on ni")
dev.off()
## X11cairo 
##        2

Mitch pathway analysis in hyp

Gene sets are obtained from Reactome.

Firstly need to conduct mitch enrichment analysis for each contrast separately.

if  (!file.exists("mouse_msigdb_reactome_2022-02-16.gmt")) {
  download.file("http://ziemann-lab.net/public/msigdb_mouse/mouse_msigdb_reactome_2022-02-16.gmt",
    destfile="mouse_msigdb_reactome_2022-02-16.gmt")
}
genesets <- gmt_import("mouse_msigdb_reactome_2022-02-16.gmt")
names(genesets) <- gsub("REACTOME_","",names(genesets))
names(genesets) <- gsub("_"," ",names(genesets))

# gene table
gt <- as.data.frame(rownames(xx))
gt$gene <- sapply(strsplit(gt[,1]," "),"[[",2)

Mitch for LPS in hyp

m1_l <- mitch_import(dge1_l, DEtype="deseq2",geneTable=gt)
## The input is a single dataframe; one contrast only. Converting
##         it to a list for you.
## Note: Mean no. genes in input = 17095
## Note: no. genes in output = 17078
## Note: estimated proportion of input genes in output = 0.999
mres1_l <- mitch_calc(m1_l, genesets, priority="effect")
## Note: Enrichments with large effect sizes may not be
##             statistically significant.
head(mres1_l$enrichment_result,20) %>% 
  kbl(caption = "Top gene pathway differences in hypothalamus for LPS") %>%
  kable_paper("hover", full_width = F)
Top gene pathway differences in hypothalamus for LPS
set setSize pANOVA s.dist p.adjustANOVA
726 POST CHAPERONIN TUBULIN FOLDING PATHWAY 17 0.0000074 0.6276475 0.0005672
1138 TRANSPORT OF CONNEXONS TO THE PLASMA MEMBRANE 13 0.0002276 0.5904167 0.0059636
337 FORMATION OF TUBULIN FOLDING INTERMEDIATES BY CCT TRIC 19 0.0000123 0.5793608 0.0007239
143 CGMP EFFECTS 15 0.0001518 -0.5648596 0.0046087
785 REDUCTION OF CYTOSOLIC CA LEVELS 11 0.0013299 -0.5588296 0.0211886
629 NITRIC OXIDE STIMULATES GUANYLATE CYCLASE 20 0.0000597 -0.5184078 0.0022044
910 SEALING OF THE NUCLEAR ENVELOPE NE BY ESCRT III 23 0.0000223 0.5107644 0.0010947
679 P75NTR REGULATES AXONOGENESIS 10 0.0068532 -0.4937895 0.0658661
66 APOPTOSIS INDUCED DNA FRAGMENTATION 10 0.0090864 -0.4764237 0.0799470
1173 WNT5A DEPENDENT INTERNALIZATION OF FZD2 FZD5 AND ROR2 13 0.0033668 0.4696658 0.0400954
161 CLEC7A DECTIN 1 INDUCES NFAT ACTIVATION 11 0.0108122 -0.4438070 0.0912014
368 GAP JUNCTION ASSEMBLY 21 0.0005679 0.4344397 0.0111598
498 IRE1ALPHA ACTIVATES CHAPERONES 50 0.0000004 0.4142965 0.0000789
388 GLYCOGEN STORAGE DISEASES 12 0.0142109 0.4087855 0.1069793
201 CYTOSOLIC IRON SULFUR CLUSTER ASSEMBLY 13 0.0111223 0.4066848 0.0930013
1170 VOLTAGE GATED POTASSIUM CHANNELS 39 0.0000142 -0.4016592 0.0007980
112 CARBOXYTERMINAL POST TRANSLATIONAL MODIFICATIONS OF TUBULIN 36 0.0000414 0.3947991 0.0018099
43 AGGREPHAGY 35 0.0000579 0.3927561 0.0022044
1072 THE ROLE OF GTSE1 IN G2 M PROGRESSION AFTER G2 CHECKPOINT 66 0.0000001 0.3869996 0.0000213
1006 SODIUM CALCIUM EXCHANGERS 10 0.0352725 -0.3844739 0.1970914
m1_l_top <- subset(mres1_l$enrichment_result,p.adjustANOVA<0.05)
m1_l_up <- subset(m1_l_top,s.dist>0)$set
m1_l_dn <- subset(m1_l_top,s.dist<0)$set
mitch_report(mres1_l,outfile="mitch1_l.html",overwrite=TRUE)
## Note: overwriting existing report
## Dataset saved as " /tmp/RtmpXoIrRA/mitch1_l.rds ".
## 
## 
## processing file: mitch.Rmd
## 1/34                             
## 2/34 [checklibraries]            
## 3/34                             
## 4/34 [peek]                      
## 5/34                             
## 6/34 [metrics]                   
## 7/34                             
## 8/34 [scatterplot]
## 9/34                             
## 10/34 [contourplot]               
## 11/34                             
## 12/34 [input_geneset_metrics1]    
## 13/34                             
## 14/34 [input_geneset_metrics2]
## 15/34                             
## 16/34 [input_geneset_metrics3]
## 17/34                             
## 18/34 [echart1d]                  
## 19/34 [echart2d]                  
## 20/34                             
## 21/34 [heatmap]                   
## 22/34                             
## 23/34 [effectsize]                
## 24/34                             
## 25/34 [results_table]             
## 26/34                             
## 27/34 [results_table_complete]    
## 28/34                             
## 29/34 [detailed_geneset_reports1d]
## 30/34                             
## 31/34 [detailed_geneset_reports2d]
## 32/34                             
## 33/34 [session_info]              
## 34/34
## output file: /home/mark.ziemann@domain.internal.burnet.edu.au/projects/lung_brain/mitch.knit.md
## /usr/bin/pandoc +RTS -K512m -RTS /home/mark.ziemann@domain.internal.burnet.edu.au/projects/lung_brain/mitch.knit.md --to html4 --from markdown+autolink_bare_uris+tex_math_single_backslash --output /tmp/RtmpXoIrRA/mitch_report.html --lua-filter /usr/local/lib/R/site-library/rmarkdown/rmarkdown/lua/pagebreak.lua --lua-filter /usr/local/lib/R/site-library/rmarkdown/rmarkdown/lua/latex-div.lua --self-contained --variable bs3=TRUE --section-divs --template /usr/local/lib/R/site-library/rmarkdown/rmd/h/default.html --no-highlight --variable highlightjs=1 --variable theme=bootstrap --mathjax --variable 'mathjax-url=https://mathjax.rstudio.com/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML' --include-in-header /tmp/RtmpXoIrRA/rmarkdown-str2d120558663da5.html
## 
## Output created: /tmp/RtmpXoIrRA/mitch_report.html
## [1] TRUE
write.table(mres1_l$enrichment_result,file="mitch1_l.tsv",quote=FALSE,sep="\t",row.names=FALSE)

m1_l_top_up <- head(subset(m1_l_top,s.dist>0),10)[,"s.dist"]
names(m1_l_top_up) <- head(subset(m1_l_top,s.dist>0),10)[,"set"]
m1_l_top_dn <- head(subset(m1_l_top,s.dist<0),10)[,"s.dist"]
names(m1_l_top_dn) <- head(subset(m1_l_top,s.dist<0),10)[,"set"]
m1_l_top_updn <- c(m1_l_top_up,m1_l_top_dn)
m1_l_top_updn <- m1_l_top_updn[order(m1_l_top_updn)]

par(mar=c(5,25,3,1))
barplot(m1_l_top_updn,horiz=TRUE,las=1,col="darkgray",
  xlab="Enrichment score",cex.names=0.8,xlim=c(-1,1),
  main="Effect of LPS in hyp")
grid()

pdf("plot18_mitch1lps01.pdf")
par(mar=c(5,25,3,1))
barplot(m1_l_top_updn,horiz=TRUE,las=1,col="darkgray",
  xlab="Enrichment score",cex.names=0.8,xlim=c(-1,1),
  main="Effect of LPS in hyp")
grid()
dev.off()
## X11cairo 
##        2

Mitch for OVA in hyp

m1_o <- mitch_import(dge1_o, DEtype="deseq2",geneTable=gt)
## The input is a single dataframe; one contrast only. Converting
##         it to a list for you.
## Note: Mean no. genes in input = 17114
## Note: no. genes in output = 17098
## Note: estimated proportion of input genes in output = 0.999
mres1_o <- mitch_calc(m1_o, genesets, priority="effect")
## Note: Enrichments with large effect sizes may not be
##             statistically significant.
head(mres1_o$enrichment_result,20) %>%
  kbl(caption = "Top gene pathway differences in hypothalamus for OVA") %>%
  kable_paper("hover", full_width = F)
Top gene pathway differences in hypothalamus for OVA
set setSize pANOVA s.dist p.adjustANOVA
304 EUKARYOTIC TRANSLATION ELONGATION 87 0.0000000 0.7530699 0.0000000
1011 SRP DEPENDENT COTRANSLATIONAL PROTEIN TARGETING TO MEMBRANE 106 0.0000000 0.6729904 0.0000000
838 RESPONSE OF EIF2AK4 GCN2 TO AMINO ACID DEFICIENCY 95 0.0000000 0.6490378 0.0000000
305 EUKARYOTIC TRANSLATION INITIATION 114 0.0000000 0.6267498 0.0000000
790 REGULATION OF COMMISSURAL AXON PATHFINDING BY SLIT AND ROBO 10 0.0006045 -0.6262757 0.0066551
1175 YAP1 AND WWTR1 TAZ STIMULATED GENE EXPRESSION 11 0.0004322 0.6128157 0.0050408
28 ACTIVATION OF THE MRNA UPON BINDING OF THE CAP BINDING COMPLEX AND EIFS AND SUBSEQUENT BINDING TO 43S 59 0.0000000 0.5830522 0.0000000
912 SELENOAMINO ACID METABOLISM 109 0.0000000 0.5768390 0.0000000
27 ACTIVATION OF THE AP 1 FAMILY OF TRANSCRIPTION FACTORS 10 0.0024467 -0.5533006 0.0208860
328 FORMATION OF ATP BY CHEMIOSMOTIC COUPLING 18 0.0000761 0.5385896 0.0013381
631 NONSENSE MEDIATED DECAY NMD 109 0.0000000 0.5243355 0.0000000
171 COMPLEX I BIOGENESIS 56 0.0000000 0.5181778 0.0000000
157 CLASS C 3 METABOTROPIC GLUTAMATE PHEROMONE RECEPTORS 12 0.0019736 -0.5158414 0.0174809
923 SEROTONIN NEUROTRANSMITTER RELEASE CYCLE 18 0.0001951 -0.5071494 0.0028248
8 ACETYLCHOLINE BINDING AND DOWNSTREAM EVENTS 10 0.0061111 -0.5007022 0.0449932
419 HIGHLY CALCIUM PERMEABLE POSTSYNAPTIC NICOTINIC ACETYLCHOLINE RECEPTORS 10 0.0061111 -0.5007022 0.0449932
283 ENDOSOMAL VACUOLAR PATHWAY 11 0.0048329 0.4906814 0.0377032
1049 SYNTHESIS OF PROSTAGLANDINS PG AND THROMBOXANES TX 13 0.0031618 0.4727809 0.0265201
791 REGULATION OF EXPRESSION OF SLITS AND ROBOS 160 0.0000000 0.4703396 0.0000000
836 RESPIRATORY ELECTRON TRANSPORT ATP SYNTHESIS BY CHEMIOSMOTIC COUPLING AND HEAT PRODUCTION BY UNCOUPLING PROTEINS 125 0.0000000 0.4603881 0.0000000
m1_o_top <- subset(mres1_o$enrichment_result,p.adjustANOVA<0.05)
m1_o_up <- subset(m1_o_top,s.dist>0)$set
m1_o_dn <- subset(m1_o_top,s.dist<0)$set
mitch_report(mres1_o,outfile="mitch1_o.html",overwrite=TRUE)
## Note: overwriting existing report
## Dataset saved as " /tmp/RtmpXoIrRA/mitch1_o.rds ".
## 
## 
## processing file: mitch.Rmd
## 1/34                             
## 2/34 [checklibraries]            
## 3/34                             
## 4/34 [peek]                      
## 5/34                             
## 6/34 [metrics]                   
## 7/34                             
## 8/34 [scatterplot]
## 9/34                             
## 10/34 [contourplot]               
## 11/34                             
## 12/34 [input_geneset_metrics1]    
## 13/34                             
## 14/34 [input_geneset_metrics2]
## 15/34                             
## 16/34 [input_geneset_metrics3]
## 17/34                             
## 18/34 [echart1d]                  
## 19/34 [echart2d]                  
## 20/34                             
## 21/34 [heatmap]                   
## 22/34                             
## 23/34 [effectsize]                
## 24/34                             
## 25/34 [results_table]             
## 26/34                             
## 27/34 [results_table_complete]    
## 28/34                             
## 29/34 [detailed_geneset_reports1d]
## 30/34                             
## 31/34 [detailed_geneset_reports2d]
## 32/34                             
## 33/34 [session_info]              
## 34/34
## output file: /home/mark.ziemann@domain.internal.burnet.edu.au/projects/lung_brain/mitch.knit.md
## /usr/bin/pandoc +RTS -K512m -RTS /home/mark.ziemann@domain.internal.burnet.edu.au/projects/lung_brain/mitch.knit.md --to html4 --from markdown+autolink_bare_uris+tex_math_single_backslash --output /tmp/RtmpXoIrRA/mitch_report.html --lua-filter /usr/local/lib/R/site-library/rmarkdown/rmarkdown/lua/pagebreak.lua --lua-filter /usr/local/lib/R/site-library/rmarkdown/rmarkdown/lua/latex-div.lua --self-contained --variable bs3=TRUE --section-divs --template /usr/local/lib/R/site-library/rmarkdown/rmd/h/default.html --no-highlight --variable highlightjs=1 --variable theme=bootstrap --mathjax --variable 'mathjax-url=https://mathjax.rstudio.com/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML' --include-in-header /tmp/RtmpXoIrRA/rmarkdown-str2d1205566a47c8.html
## 
## Output created: /tmp/RtmpXoIrRA/mitch_report.html
## [1] TRUE
write.table(mres1_o$enrichment_result,file="mitch1_o.tsv",quote=FALSE,sep="\t",row.names=FALSE)

m1_o_top_up <- head(subset(m1_o_top,s.dist>0),10)[,"s.dist"]
names(m1_o_top_up) <- head(subset(m1_o_top,s.dist>0),10)[,"set"]
m1_o_top_dn <- head(subset(m1_o_top,s.dist<0),10)[,"s.dist"]
names(m1_o_top_dn) <- head(subset(m1_o_top,s.dist<0),10)[,"set"]
m1_o_top_updn <- c(m1_o_top_up,m1_o_top_dn)
m1_o_top_updn <- m1_o_top_updn[order(m1_o_top_updn)]

par(mar=c(5,25,3,1))
barplot(m1_o_top_updn,horiz=TRUE,las=1,col="darkgray",
  xlab="Enrichment score",cex.names=0.8,xlim=c(-1,1),
  main="Effect of LPS in hyp")
grid()

pdf("plot19_mitch1ova01.pdf")
par(mar=c(5,25,3,1))
barplot(m1_o_top_updn,horiz=TRUE,las=1,col="darkgray",
  xlab="Enrichment score",cex.names=0.8,xlim=c(-1,1),
  main="Effect of LPS in hyp")
grid()
dev.off()
## X11cairo 
##        2
m1_l_up <- subset(m1_l_top,s.dist>0)$set
m1_l_dn <- subset(m1_l_top,s.dist<0)$set
m1_o_up <- subset(m1_o_top,s.dist>0)$set
m1_o_dn <- subset(m1_o_top,s.dist<0)$set

par(mar=c(2,2,2,2))

v0 <- list("LPS up"=m1_l_up,
  "LPS dn"=m1_l_dn,
  "OVA up"=m1_o_up,
  "OVA dn"=m1_o_dn)
plot(euler(v0),quantities = TRUE, edges = "gray", main="effect of treatments on hyp")

pdf("plot20_mitch1lpsovaeuler01.pdf")
plot(euler(v0),quantities = TRUE, edges = "gray", main="effect of treatments on hyp")
dev.off()
## X11cairo 
##        2

Two dimensional mitch analysis in hyp.

ml <- list("LPS"=dge1_l,"OVA"=dge1_o)
m1 <- mitch_import(ml, DEtype="deseq2",geneTable=gt)
## Note: Mean no. genes in input = 17104.5
## Note: no. genes in output = 16956
## Note: estimated proportion of input genes in output = 0.991
head(m1)
##                      LPS         OVA
## 0610009B22Rik -0.3304181  0.09722066
## 0610009E02Rik  0.7596333  1.26326253
## 0610009L18Rik -1.2521412 -0.66374969
## 0610010K14Rik  0.4193627 -0.45368981
## 0610012G03Rik  1.4462155  0.12236243
## 0610030E20Rik -0.2426628 -0.04562294
mres1 <- mitch_calc(m1, genesets, priority="effect")
## Note: Enrichments with large effect sizes may not be 
##             statistically significant.
head(mres1$enrichment_result,20) %>%
  kbl(caption = "Top gene pathway differences in hypothalamus for LPS and OVA") %>%
  kable_paper("hover", full_width = F)
Top gene pathway differences in hypothalamus for LPS and OVA
set setSize pMANOVA s.LPS s.OVA p.LPS p.OVA s.dist SD p.adjustMANOVA
304 EUKARYOTIC TRANSLATION ELONGATION 87 0.0000000 0.3005016 0.7571632 0.0000013 0.0000000 0.8146148 0.3229085 0.0000000
1008 SRP DEPENDENT COTRANSLATIONAL PROTEIN TARGETING TO MEMBRANE 106 0.0000000 0.2541257 0.6771379 0.0000062 0.0000000 0.7232535 0.2991148 0.0000000
837 RESPONSE OF EIF2AK4 GCN2 TO AMINO ACID DEFICIENCY 95 0.0000000 0.2223137 0.6530942 0.0001818 0.0000000 0.6898952 0.3046078 0.0000000
789 REGULATION OF COMMISSURAL AXON PATHFINDING BY SLIT AND ROBO 10 0.0029071 -0.2596719 -0.6241001 0.1550844 0.0006316 0.6759663 0.2576896 0.0208948
305 EUKARYOTIC TRANSLATION INITIATION 114 0.0000000 0.2044179 0.6309008 0.0001645 0.0000000 0.6631912 0.3015689 0.0000000
783 REDUCTION OF CYTOSOLIC CA LEVELS 11 0.0047378 -0.5570697 -0.3357011 0.0013775 0.0538808 0.6504013 0.1565312 0.0307566
1172 YAP1 AND WWTR1 TAZ STIMULATED GENE EXPRESSION 11 0.0015116 0.1440006 0.6164919 0.4082939 0.0003990 0.6330864 0.3341017 0.0126863
724 POST CHAPERONIN TUBULIN FOLDING PATHWAY 17 0.0000053 0.6289245 -0.0037748 0.0000071 0.9785061 0.6289359 0.4473860 0.0001302
910 SELENOAMINO ACID METABOLISM 109 0.0000000 0.2407970 0.5807448 0.0000142 0.0000000 0.6286873 0.2403794 0.0000000
337 FORMATION OF TUBULIN FOLDING INTERMEDIATES BY CCT TRIC 19 0.0000642 0.5807870 0.1993860 0.0000117 0.1324715 0.6140589 0.2696913 0.0010059
28 ACTIVATION OF THE MRNA UPON BINDING OF THE CAP BINDING COMPLEX AND EIFS AND SUBSEQUENT BINDING TO 43S 59 0.0000000 0.1620035 0.5870293 0.0314327 0.0000000 0.6089733 0.3005386 0.0000000
143 CGMP EFFECTS 15 0.0008013 -0.5629853 -0.2197627 0.0001597 0.1406164 0.6043576 0.2426950 0.0079791
1135 TRANSPORT OF CONNEXONS TO THE PLASMA MEMBRANE 13 0.0007834 0.5915627 0.1217340 0.0002213 0.4473220 0.6039582 0.3322191 0.0078672
677 P75NTR REGULATES AXONOGENESIS 10 0.0196686 -0.4918683 -0.3298241 0.0070734 0.0709274 0.5922148 0.1145825 0.0917086
27 ACTIVATION OF THE AP 1 FAMILY OF TRANSCRIPTION FACTORS 10 0.0104349 -0.2020772 -0.5511153 0.2685386 0.0025455 0.5869951 0.2468072 0.0581091
618 NEUROTOXICITY OF CLOSTRIDIUM TOXINS 10 0.0247523 -0.3757583 -0.4496990 0.0396398 0.0138005 0.5860235 0.0522840 0.1062004
410 HDR THROUGH MMEJ ALT NHEJ 10 0.0286875 -0.3549982 -0.4486486 0.0519199 0.0140234 0.5721096 0.0662208 0.1182731
283 ENDOSOMAL VACUOLAR PATHWAY 11 0.0001919 -0.2757209 0.4955551 0.1133476 0.0044279 0.5670952 0.5453745 0.0023985
157 CLASS C 3 METABOTROPIC GLUTAMATE PHEROMONE RECEPTORS 12 0.0086329 -0.2343799 -0.5132200 0.1598075 0.0020809 0.5642063 0.1971697 0.0494811
631 NONSENSE MEDIATED DECAY NMD 109 0.0000000 0.1972774 0.5282464 0.0003761 0.0000000 0.5638817 0.2340304 0.0000000
m1_top <- subset(mres1$enrichment_result,p.adjustMANOVA<0.05)
m1_up <- subset(m1_top,s.dist>0)$set
m1_dn <- subset(m1_top,s.dist<0)$set
mitch_report(mres1,outfile="mitch1.html",overwrite=TRUE)
## Note: overwriting existing report
## Dataset saved as " /tmp/RtmpXoIrRA/mitch1.rds ".
## 
## 
## processing file: mitch.Rmd
## 1/34                             
## 2/34 [checklibraries]            
## 3/34                             
## 4/34 [peek]                      
## 5/34                             
## 6/34 [metrics]                   
## 7/34                             
## 8/34 [scatterplot]
## 9/34                             
## 10/34 [contourplot]
## 11/34                             
## 12/34 [input_geneset_metrics1]    
## 13/34                             
## 14/34 [input_geneset_metrics2]
## 15/34                             
## 16/34 [input_geneset_metrics3]
## 17/34                             
## 18/34 [echart1d]                  
## 19/34 [echart2d]                  
## 20/34                             
## 21/34 [heatmap]
## 22/34                             
## 23/34 [effectsize]                
## 24/34                             
## 25/34 [results_table]             
## 26/34                             
## 27/34 [results_table_complete]    
## 28/34                             
## 29/34 [detailed_geneset_reports1d]
## 30/34                             
## 31/34 [detailed_geneset_reports2d]
## 32/34                             
## 33/34 [session_info]              
## 34/34
## output file: /home/mark.ziemann@domain.internal.burnet.edu.au/projects/lung_brain/mitch.knit.md
## /usr/bin/pandoc +RTS -K512m -RTS /home/mark.ziemann@domain.internal.burnet.edu.au/projects/lung_brain/mitch.knit.md --to html4 --from markdown+autolink_bare_uris+tex_math_single_backslash --output /tmp/RtmpXoIrRA/mitch_report.html --lua-filter /usr/local/lib/R/site-library/rmarkdown/rmarkdown/lua/pagebreak.lua --lua-filter /usr/local/lib/R/site-library/rmarkdown/rmarkdown/lua/latex-div.lua --self-contained --variable bs3=TRUE --section-divs --template /usr/local/lib/R/site-library/rmarkdown/rmd/h/default.html --no-highlight --variable highlightjs=1 --variable theme=bootstrap --mathjax --variable 'mathjax-url=https://mathjax.rstudio.com/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML' --include-in-header /tmp/RtmpXoIrRA/rmarkdown-str2d120544767d3.html
## 
## Output created: /tmp/RtmpXoIrRA/mitch_report.html
## [1] TRUE
write.table(mres1$enrichment_result,file="mitch1.tsv",quote=FALSE,sep="\t",row.names=FALSE)

m1_top_up <- head(subset(m1_top,s.dist>0),10)[,"s.dist"]
names(m1_top_up) <- head(subset(m1_top,s.dist>0),10)[,"set"]
m1_top_dn <- head(subset(m1_top,s.dist<0),10)[,"s.dist"]
names(m1_top_dn) <- head(subset(m1_top,s.dist<0),10)[,"set"]
m1_top_updn <- c(m1_top_up,m1_top_dn)
m1_top_updn <- m1_top_updn[order(m1_top_updn)]

Need to make a scatterplot to highlight the following:

  • Serotonin Neurotransmitter Release Cycle (DN)
  • Class C3 metabotropic glutamate pheromone receptors (DN)
  • Regulation of commissural axon pathfinding by SLIT AND robo (DN)
  • Reduction of Cytosolic Ca (DN)
  • YAP1 and WWTR1 TAZ STIMULATED GENE EXPRESSION (UP)
  • Activation of the mRNA upon binding (UP)
  • Regulation of expression of slits and robs (UP)
par(mar=c(4,4,2,1))

a <- mres1$enrichment_result
plot(a$s.LPS , a$s.OVA,pch=19,col="gray")
abline(h=0,lty=2)
abline(v=0,lty=2)
as <- subset(a,p.adjustMANOVA<0.05)
points(as$s.LPS , as$s.OVA,pch=19,col="red")

abline(h=0.2,lty=2,col="red")
abline(v=0.2,lty=2,col="red")
abline(h=-0.2,lty=2,col="red")
abline(v=-0.2,lty=2,col="red")

mysets <- c("SEROTONIN NEUROTRANSMITTER RELEASE CYCLE",
  "CLASS C 3 METABOTROPIC GLUTAMATE PHEROMONE RECEPTORS",
  "REGULATION OF COMMISSURAL AXON PATHFINDING BY SLIT AND ROBO",
  "REDUCTION OF CYTOSOLIC CA LEVELS",
  "YAP1 AND WWTR1 TAZ STIMULATED GENE EXPRESSION",
  "ACTIVATION OF THE MRNA UPON BINDING OF THE CAP BINDING COMPLEX AND EIFS AND SUBSEQUENT BINDING TO 43S",
  "REGULATION OF EXPRESSION OF SLITS AND ROBOS")

a2 <- a[which(a$set %in% mysets),]

points(a2$s.LPS , a2$s.OVA+0.025,pch=25,col="red")

pdf("plot21_mitch1_scatter01.pdf")

a <- mres1$enrichment_result
plot(a$s.LPS , a$s.OVA,pch=19,col="gray")
abline(h=0,lty=2)
abline(v=0,lty=2)
as <- subset(a,p.adjustMANOVA<0.05)
points(as$s.LPS , as$s.OVA,pch=19,col="red")

abline(h=0.2,lty=2,col="red")
abline(v=0.2,lty=2,col="red")
abline(h=-0.2,lty=2,col="red")
abline(v=-0.2,lty=2,col="red")

mysets <- c("SEROTONIN NEUROTRANSMITTER RELEASE CYCLE",
  "CLASS C 3 METABOTROPIC GLUTAMATE PHEROMONE RECEPTORS",
  "REGULATION OF COMMISSURAL AXON PATHFINDING BY SLIT AND ROBO",
  "REDUCTION OF CYTOSOLIC CA LEVELS",
  "YAP1 AND WWTR1 TAZ STIMULATED GENE EXPRESSION",
  "ACTIVATION OF THE MRNA UPON BINDING OF THE CAP BINDING COMPLEX AND EIFS AND SUBSEQUENT BINDING TO 43S",
  "REGULATION OF EXPRESSION OF SLITS AND ROBOS")

a2 <- a[which(a$set %in% mysets),]

points(a2$s.LPS , a2$s.OVA+0.025,pch=25,col="red")

dev.off()
## X11cairo 
##        2
subset(as,s.LPS>0.2 & s.OVA>0.2)  %>%
  kbl(caption = "Pathways upregulated in LPS and OVA") %>%
  kable_paper("hover", full_width = F)
Pathways upregulated in LPS and OVA
set setSize pMANOVA s.LPS s.OVA p.LPS p.OVA s.dist SD p.adjustMANOVA
304 EUKARYOTIC TRANSLATION ELONGATION 87 0.0000000 0.3005016 0.7571632 0.0000013 0.0000000 0.8146148 0.3229085 0.0000000
1008 SRP DEPENDENT COTRANSLATIONAL PROTEIN TARGETING TO MEMBRANE 106 0.0000000 0.2541257 0.6771379 0.0000062 0.0000000 0.7232535 0.2991148 0.0000000
837 RESPONSE OF EIF2AK4 GCN2 TO AMINO ACID DEFICIENCY 95 0.0000000 0.2223137 0.6530942 0.0001818 0.0000000 0.6898952 0.3046078 0.0000000
305 EUKARYOTIC TRANSLATION INITIATION 114 0.0000000 0.2044179 0.6309008 0.0001645 0.0000000 0.6631912 0.3015689 0.0000000
910 SELENOAMINO ACID METABOLISM 109 0.0000000 0.2407970 0.5807448 0.0000142 0.0000000 0.6286873 0.2403794 0.0000000
190 CROSS PRESENTATION OF SOLUBLE EXOGENOUS ANTIGENS ENDOSOMES 46 0.0000008 0.3238732 0.4183478 0.0001447 0.0000009 0.5290640 0.0668036 0.0000309
790 REGULATION OF EXPRESSION OF SLITS AND ROBOS 160 0.0000000 0.2161534 0.4744210 0.0000024 0.0000000 0.5213421 0.1826228 0.0000000
1125 TRANSLATION 286 0.0000000 0.2603207 0.4144965 0.0000000 0.0000000 0.4894632 0.1090188 0.0000000
85 AUF1 HNRNP D0 BINDS AND DESTABILIZES MRNA 53 0.0000013 0.3252286 0.3648733 0.0000422 0.0000043 0.4887803 0.0280330 0.0000434
1009 STABILIZATION OF P53 54 0.0000015 0.3124658 0.3662771 0.0000715 0.0000032 0.4814496 0.0380503 0.0000458
569 MITOCHONDRIAL TRANSLATION 93 0.0000000 0.3126021 0.3617636 0.0000002 0.0000000 0.4781139 0.0347624 0.0000000
1069 THE ROLE OF GTSE1 IN G2 M PROGRESSION AFTER G2 CHECKPOINT 66 0.0000001 0.3888889 0.2636005 0.0000000 0.0002135 0.4698082 0.0885923 0.0000040
412 HEDGEHOG LIGAND BIOGENESIS 61 0.0000009 0.3091486 0.3447552 0.0000298 0.0000032 0.4630648 0.0251777 0.0000309
817 REGULATION OF RUNX3 EXPRESSION AND ACTIVITY 53 0.0000061 0.3216879 0.3309907 0.0000511 0.0000307 0.4615603 0.0065781 0.0001425
215 DECTIN 1 MEDIATED NONCANONICAL NF KB SIGNALING 59 0.0000018 0.2991956 0.3466256 0.0000706 0.0000041 0.4578944 0.0335380 0.0000533
221 DEGRADATION OF AXIN 53 0.0000080 0.3016468 0.3407936 0.0001458 0.0000178 0.4551165 0.0276810 0.0001718
609 NEGATIVE REGULATION OF NOTCH4 SIGNALING 54 0.0000067 0.2904916 0.3477498 0.0002226 0.0000099 0.4531173 0.0404876 0.0001481
80 ASYMMETRIC LOCALIZATION OF PCP PROTEINS 62 0.0000020 0.3135452 0.3171655 0.0000196 0.0000157 0.4459871 0.0025599 0.0000580
180 COOPERATION OF PREFOLDIN AND TRIC CCT IN ACTIN AND TUBULIN FOLDING 26 0.0025700 0.3846063 0.2224863 0.0006876 0.0495991 0.4443221 0.1146362 0.0194758
217 DEFECTIVE CFTR CAUSES CYSTIC FIBROSIS 59 0.0000032 0.2687760 0.3531336 0.0003570 0.0000027 0.4437836 0.0596498 0.0000851
550 METABOLISM OF POLYAMINES 57 0.0000065 0.2571449 0.3530833 0.0007872 0.0000040 0.4367966 0.0678387 0.0001470
224 DEGRADATION OF DVL 55 0.0000126 0.2792637 0.3357703 0.0003412 0.0000166 0.4367264 0.0399562 0.0002515
225 DEGRADATION OF GLI1 BY THE PROTEASOME 57 0.0000340 0.2685667 0.3106392 0.0004542 0.0000499 0.4106395 0.0297497 0.0005788
139 CELLULAR RESPONSE TO HYPOXIA 72 0.0000009 0.2095508 0.3530529 0.0021163 0.0000002 0.4105580 0.1014713 0.0000309
907 SCF SKP2 MEDIATED DEGRADATION OF P27 P21 59 0.0000220 0.2476811 0.3249268 0.0010028 0.0000159 0.4085626 0.0546209 0.0004034
798 REGULATION OF HMOX1 EXPRESSION AND ACTIVITY 63 0.0000159 0.2548562 0.3127519 0.0004696 0.0000177 0.4034420 0.0409384 0.0003012
235 DISEASES ASSOCIATED WITH GLYCOSAMINOGLYCAN METABOLISM 40 0.0013469 0.2596240 0.2950993 0.0044999 0.0012418 0.3930499 0.0250848 0.0116093
62 APC C CDH1 MEDIATED DEGRADATION OF CDC20 AND OTHER APC C CDH1 TARGETED PROTEINS IN LATE MITOSIS EARLY G1 70 0.0000101 0.2627316 0.2916482 0.0001447 0.0000246 0.3925386 0.0204471 0.0002055
894 RRNA PROCESSING 194 0.0000000 0.2045188 0.3201775 0.0000009 0.0000000 0.3799231 0.0817830 0.0000000
568 MITOCHONDRIAL PROTEIN IMPORT 63 0.0000657 0.2583629 0.2772774 0.0003916 0.0001416 0.3789910 0.0133746 0.0010158
358 G1 S DNA DAMAGE CHECKPOINTS 65 0.0000450 0.2391888 0.2928578 0.0008561 0.0000446 0.3781230 0.0379497 0.0007443
681 PCP CE PATHWAY 89 0.0000021 0.2723788 0.2532696 0.0000090 0.0000365 0.3719351 0.0135122 0.0000580
63 APC C MEDIATED DEGRADATION OF CELL CYCLE PROTEINS 81 0.0000062 0.2382244 0.2850290 0.0002113 0.0000093 0.3714733 0.0330958 0.0001425
812 REGULATION OF PTEN STABILITY AND ACTIVITY 66 0.0001012 0.2339218 0.2745142 0.0010182 0.0001154 0.3606626 0.0287032 0.0014879
814 REGULATION OF RAS BY GAPS 66 0.0001026 0.2104222 0.2875002 0.0031237 0.0000538 0.3562778 0.0545024 0.0014879
3 ABC TRANSPORTER DISORDERS 70 0.0001017 0.2058273 0.2786687 0.0029134 0.0000556 0.3464407 0.0515067 0.0014879
1082 TNFR2 NON CANONICAL NF KB PATHWAY 79 0.0001123 0.2240192 0.2409983 0.0005795 0.0002140 0.3290362 0.0120061 0.0015519
subset(as,s.LPS<-0.2 & s.OVA<0.2)  %>%
  kbl(caption = "Pathways downregulated in LPS and OVA") %>%
  kable_paper("hover", full_width = F)
Pathways downregulated in LPS and OVA
set setSize pMANOVA s.LPS s.OVA p.LPS p.OVA s.dist SD p.adjustMANOVA
789 REGULATION OF COMMISSURAL AXON PATHFINDING BY SLIT AND ROBO 10 0.0029071 -0.2596719 -0.6241001 0.1550844 0.0006316 0.6759663 0.2576896 0.0208948
783 REDUCTION OF CYTOSOLIC CA LEVELS 11 0.0047378 -0.5570697 -0.3357011 0.0013775 0.0538808 0.6504013 0.1565312 0.0307566
724 POST CHAPERONIN TUBULIN FOLDING PATHWAY 17 0.0000053 0.6289245 -0.0037748 0.0000071 0.9785061 0.6289359 0.4473860 0.0001302
337 FORMATION OF TUBULIN FOLDING INTERMEDIATES BY CCT TRIC 19 0.0000642 0.5807870 0.1993860 0.0000117 0.1324715 0.6140589 0.2696913 0.0010059
143 CGMP EFFECTS 15 0.0008013 -0.5629853 -0.2197627 0.0001597 0.1406164 0.6043576 0.2426950 0.0079791
1135 TRANSPORT OF CONNEXONS TO THE PLASMA MEMBRANE 13 0.0007834 0.5915627 0.1217340 0.0002213 0.4473220 0.6039582 0.3322191 0.0078672
157 CLASS C 3 METABOTROPIC GLUTAMATE PHEROMONE RECEPTORS 12 0.0086329 -0.2343799 -0.5132200 0.1598075 0.0020809 0.5642063 0.1971697 0.0494811
627 NITRIC OXIDE STIMULATES GUANYLATE CYCLASE 20 0.0003350 -0.5164974 -0.1981105 0.0000636 0.1251300 0.5531883 0.2251335 0.0038218
1167 VOLTAGE GATED POTASSIUM CHANNELS 39 0.0000057 -0.3994268 -0.3608675 0.0000159 0.0000964 0.5383002 0.0272655 0.0001377
921 SEROTONIN NEUROTRANSMITTER RELEASE CYCLE 18 0.0009568 -0.1551803 -0.5046378 0.2544237 0.0002099 0.5279586 0.2471038 0.0090228
908 SEALING OF THE NUCLEAR ENVELOPE NE BY ESCRT III 23 0.0000754 0.5121746 0.1040597 0.0000212 0.3877283 0.5226387 0.2885808 0.0011363
832 RESOLUTION OF D LOOP STRUCTURES THROUGH SYNTHESIS DEPENDENT STRAND ANNEALING SDSA 24 0.0011054 -0.2831325 -0.4170456 0.0163599 0.0004053 0.5040745 0.0946909 0.0099913
690 PHASE 0 RAPID DEPOLARISATION 30 0.0003539 -0.3085746 -0.3865926 0.0034450 0.0002476 0.4946434 0.0551671 0.0039987
1170 WNT5A DEPENDENT INTERNALIZATION OF FZD2 FZD5 AND ROR2 13 0.0083226 0.4713315 0.0516256 0.0032558 0.7472597 0.4741504 0.2967769 0.0486518
368 GAP JUNCTION ASSEMBLY 21 0.0018563 0.4361804 0.0880481 0.0005396 0.4849389 0.4449784 0.2461666 0.0149397
306 EXPORT OF VIRAL RIBONUCLEOPROTEINS FROM NUCLEUS 31 0.0004774 -0.1683804 -0.4058303 0.1047476 0.0000920 0.4393748 0.1679024 0.0051465
498 IRE1ALPHA ACTIVATES CHAPERONES 50 0.0000021 0.4158926 0.1340140 0.0000004 0.1012442 0.4369512 0.1993183 0.0000585
796 REGULATION OF GLUCOKINASE BY GLUCOKINASE REGULATORY PROTEIN 29 0.0007187 -0.1400680 -0.4072355 0.1917954 0.0001472 0.4306505 0.1889160 0.0074079
1022 SUMOYLATION OF RNA BINDING PROTEINS 45 0.0000622 -0.2136584 -0.3731470 0.0131666 0.0000149 0.4299868 0.1127754 0.0009878
650 NUCLEAR PORE COMPLEX NPC DISASSEMBLY 32 0.0008181 -0.1919353 -0.3831319 0.0602776 0.0001762 0.4285198 0.1351965 0.0080777
797 REGULATION OF GLYCOLYSIS BY FRUCTOSE 2 6 BISPHOSPHATE METABOLISM 11 0.0086111 0.2012983 -0.3727085 0.2477085 0.0323273 0.4235949 0.4058841 0.0494811
1023 SUMOYLATION OF SUMOYLATION PROTEINS 33 0.0008405 -0.1951244 -0.3757357 0.0524359 0.0001874 0.4233803 0.1277115 0.0080946
645 NS1 MEDIATED EFFECTS ON HOST PATHWAYS 37 0.0005468 -0.2250325 -0.3578497 0.0178702 0.0001655 0.4227245 0.0939160 0.0057882
261 DOWNREGULATION OF SMAD2 3 SMAD4 TRANSCRIPTIONAL ACTIVITY 23 0.0079424 -0.3708709 -0.1992482 0.0020784 0.0981475 0.4210048 0.1213556 0.0468962
112 CARBOXYTERMINAL POST TRANSLATIONAL MODIFICATIONS OF TUBULIN 36 0.0000011 0.3966476 -0.1229249 0.0000381 0.2019370 0.4152588 0.3673932 0.0000372
487 INTRAFLAGELLAR TRANSPORT 51 0.0000097 0.3864607 0.1171332 0.0000018 0.1480047 0.4038218 0.1904433 0.0001997
649 NUCLEAR IMPORT OF REV PROTEIN 32 0.0013536 -0.1562906 -0.3712184 0.1260604 0.0002789 0.4027777 0.1519769 0.0116093
461 INTERACTIONS OF VPR WITH HOST CELLULAR PROTEINS 34 0.0010912 -0.1498189 -0.3660220 0.1306564 0.0002213 0.3954969 0.1528787 0.0099395
43 AGGREPHAGY 35 0.0000703 0.3944836 0.0110243 0.0000537 0.9101567 0.3946376 0.2711466 0.0010735
460 INTERACTIONS OF REV WITH HOST CELLULAR PROTEINS 35 0.0017261 -0.1436170 -0.3484276 0.1415469 0.0003610 0.3768655 0.1448230 0.0140845
204 CYTOSOLIC TRNA AMINOACYLATION 24 0.0004582 0.3516074 -0.1311225 0.0028680 0.2662404 0.3752611 0.3413416 0.0050314
506 KERATAN SULFATE KERATIN METABOLISM 30 0.0081298 0.3202332 0.1921068 0.0024014 0.0686331 0.3734358 0.0905990 0.0477628
1137 TRANSPORT OF MATURE MRNAS DERIVED FROM INTRONLESS TRANSCRIPTS 41 0.0003045 -0.0901480 -0.3580845 0.3180266 0.0000727 0.3692576 0.1894597 0.0035422
854 RHO GTPASES ACTIVATE WASPS AND WAVES 36 0.0001425 -0.3676123 0.0062812 0.0001352 0.9480132 0.3676660 0.2643826 0.0018815
728 POTASSIUM CHANNELS 90 0.0000037 -0.2507952 -0.2607336 0.0000394 0.0000192 0.3617737 0.0070276 0.0000970
1026 SUMOYLATION OF UBIQUITINYLATION PROTEINS 37 0.0029377 -0.1579433 -0.3231502 0.0964797 0.0006709 0.3596834 0.1168189 0.0209197
1016 SUMOYLATION OF CHROMATIN ORGANIZATION PROTEINS 58 0.0002329 -0.1873064 -0.3025190 0.0136421 0.0000677 0.3558109 0.0814676 0.0028504
1140 TRANSPORT OF THE SLBP DEPENDANT MATURE MRNA 34 0.0050458 -0.1398632 -0.3222015 0.1582242 0.0011497 0.3512485 0.1289327 0.0323979
205 DAG AND IP3 SIGNALING 40 0.0069085 -0.2447328 -0.2387887 0.0074100 0.0089808 0.3419272 0.0042031 0.0416282
1017 SUMOYLATION OF DNA DAMAGE RESPONSE AND REPAIR PROTEINS 73 0.0001894 -0.2199091 -0.2483466 0.0011638 0.0002447 0.3317168 0.0201083 0.0023930
416 HEME SIGNALING 45 0.0032838 -0.2904500 -0.1401152 0.0007502 0.1039978 0.3224802 0.1063027 0.0232440
113 CARDIAC CONDUCTION 109 0.0000193 -0.2203060 -0.2130807 0.0000714 0.0001224 0.3064933 0.0051091 0.0003605
413 HEDGEHOG OFF STATE 106 0.0000077 0.2711707 0.1390594 0.0000014 0.0134336 0.3047476 0.0934168 0.0001665
432 HSP90 CHAPERONE CYCLE FOR STEROID HORMONE RECEPTORS SHR 48 0.0001255 0.3000552 -0.0488083 0.0003232 0.5586625 0.3039990 0.2466837 0.0016952
1147 TRNA AMINOACYLATION 42 0.0011312 0.3033525 0.0082997 0.0006708 0.9258706 0.3034661 0.2086339 0.0101460
356 G PROTEIN MEDIATED EVENTS 52 0.0048812 -0.2501729 -0.1717140 0.0018080 0.0322415 0.3034340 0.0554788 0.0315130
615 NETRIN 1 SIGNALING 49 0.0053213 -0.1340165 -0.2657769 0.1047055 0.0012910 0.2976538 0.0931687 0.0337703
390 GLYCOLYSIS 66 0.0000014 0.1209143 -0.2700827 0.0894988 0.0001485 0.2959137 0.2764766 0.0000434
1113 TRANSCRIPTIONAL REGULATION BY MECP2 59 0.0016695 -0.2682223 -0.0876527 0.0003671 0.2444037 0.2821812 0.1276820 0.0138148
679 PARASITE INFECTION 55 0.0004304 -0.2777985 0.0061761 0.0003666 0.9368747 0.2778672 0.2008004 0.0048167
840 RET SIGNALING 37 0.0077383 -0.0172795 -0.2771792 0.8557095 0.0035316 0.2777173 0.1837768 0.0459218
596 NCAM1 INTERACTIONS 41 0.0029164 0.0274500 -0.2694174 0.7610935 0.0028400 0.2708122 0.2099170 0.0208948
380 GLUCOSE METABOLISM 80 0.0000008 0.1365386 -0.2322159 0.0348382 0.0003314 0.2693826 0.2607488 0.0000296
60 ANTIVIRAL MECHANISM BY IFN STIMULATED GENES 73 0.0036468 -0.2027305 -0.1756091 0.0027548 0.0095076 0.2682130 0.0191777 0.0255057
463 INTERFERON ALPHA BETA SIGNALING 55 0.0001042 -0.1834910 0.1800378 0.0186137 0.0209500 0.2570653 0.2570537 0.0014892
1155 UNFOLDED PROTEIN RESPONSE UPR 86 0.0002531 0.2495692 0.0585545 0.0000636 0.3482038 0.2563463 0.1350678 0.0030344
166 COLLAGEN CHAIN TRIMERIZATION 40 0.0022161 0.1117167 -0.2279262 0.2215988 0.0126346 0.2538326 0.2401638 0.0169438
109 CA2 PATHWAY 57 0.0002600 -0.2337032 0.0925301 0.0022799 0.2270896 0.2513544 0.2306818 0.0030648
617 NEURONAL SYSTEM 368 0.0000000 -0.1545673 -0.1970436 0.0000004 0.0000000 0.2504341 0.0300353 0.0000000
702 PI METABOLISM 79 0.0062249 -0.1601198 -0.1857408 0.0139208 0.0043321 0.2452305 0.0181168 0.0382944
959 SIGNALING BY HEDGEHOG 141 0.0000457 0.2167682 0.1112385 0.0000090 0.0227080 0.2436441 0.0746208 0.0007466
86 AURKA ACTIVATION BY TPX2 71 0.0008368 -0.0110883 -0.2403592 0.8717178 0.0004636 0.2406148 0.1621190 0.0080946
182 COPI INDEPENDENT GOLGI TO ER RETROGRADE TRAFFIC 44 0.0051310 0.2334195 -0.0510960 0.0073977 0.5577099 0.2389466 0.2011829 0.0327656
464 INTERFERON GAMMA SIGNALING 77 0.0000357 -0.2175923 0.0978846 0.0009672 0.1377361 0.2385955 0.2230759 0.0005991
165 COLLAGEN BIOSYNTHESIS AND MODIFYING ENZYMES 62 0.0006506 0.2261253 -0.0608634 0.0020805 0.4073908 0.2341730 0.2029317 0.0067655
748 PROTEIN FOLDING 89 0.0060296 0.1738139 0.1538347 0.0046141 0.0121719 0.2321129 0.0141274 0.0376850
243 DISEASES OF METABOLISM 197 0.0000086 0.1906160 0.1322132 0.0000041 0.0013950 0.2319801 0.0412970 0.0001808
909 SELECTIVE AUTOPHAGY 72 0.0046856 0.2174330 0.0420665 0.0014274 0.5373059 0.2214649 0.1240029 0.0307566
183 COPI MEDIATED ANTEROGRADE TRANSPORT 91 0.0001194 0.2117481 -0.0482376 0.0004837 0.4267162 0.2171730 0.1838377 0.0016320
780 RECRUITMENT OF MITOTIC CENTROSOME PROTEINS AND COMPLEXES 78 0.0011959 0.0072359 -0.2164736 0.9120719 0.0009529 0.2165945 0.1581865 0.0106457
595 NCAM SIGNALING FOR NEURITE OUT GROWTH 61 0.0065049 0.0001213 -0.2145838 0.9986933 0.0037584 0.2145838 0.1518194 0.0396024
466 INTERLEUKIN 1 FAMILY SIGNALING 121 0.0021357 0.1127801 0.1795202 0.0322695 0.0006534 0.2120068 0.0471924 0.0165096
107 C TYPE LECTIN RECEPTORS CLRS 111 0.0012511 0.0616618 0.1998331 0.2620870 0.0002779 0.2091303 0.0977019 0.0110525
781 RECRUITMENT OF NUMA TO MITOTIC CENTROSOMES 85 0.0002316 0.0784995 -0.1913893 0.2111802 0.0022978 0.2068624 0.1908402 0.0028504
255 DNA REPLICATION 121 0.0043012 0.1192267 0.1641391 0.0236074 0.0018313 0.2028710 0.0317578 0.0285531
465 INTERFERON SIGNALING 164 0.0000152 -0.2019378 -0.0193675 0.0000083 0.6690301 0.2028644 0.1290967 0.0002930
1133 TRANSMISSION ACROSS CHEMICAL SYNAPSES 240 0.0000223 -0.1182036 -0.1643485 0.0016359 0.0000119 0.2024414 0.0326294 0.0004034
338 FOXO MEDIATED TRANSCRIPTION 58 0.0025987 -0.1543623 0.1305113 0.0420862 0.0856940 0.2021408 0.2014360 0.0194758
308 EXTRA NUCLEAR ESTROGEN SIGNALING 67 0.0020367 -0.1873524 0.0732094 0.0080253 0.3002912 0.2011480 0.1842450 0.0161699
619 NEUROTRANSMITTER RECEPTORS AND POSTSYNAPTIC SIGNAL TRANSMISSION 179 0.0004401 -0.1137654 -0.1623568 0.0087304 0.0001819 0.1982481 0.0343593 0.0048788
181 COPI DEPENDENT GOLGI TO ER RETROGRADE TRAFFIC 86 0.0040545 0.1951889 0.0161274 0.0017633 0.7961226 0.1958541 0.1266156 0.0272230
1115 TRANSCRIPTIONAL REGULATION BY RUNX2 108 0.0038546 0.0631045 0.1853204 0.2575519 0.0008828 0.1957698 0.0864197 0.0261112
168 COLLAGEN FORMATION 79 0.0017144 0.1901614 -0.0445149 0.0034911 0.4941933 0.1953022 0.1659412 0.0140845
992 SIGNALING BY VEGF 103 0.0071549 -0.1793320 -0.0751760 0.0016722 0.1877076 0.1944515 0.0736494 0.0428930
391 GLYCOSAMINOGLYCAN METABOLISM 114 0.0084254 0.1615781 0.1067496 0.0028994 0.0491295 0.1936568 0.0387696 0.0490092
588 MUSCLE CONTRACTION 162 0.0016629 -0.1492920 -0.1206405 0.0010539 0.0081230 0.1919433 0.0202597 0.0138148
810 REGULATION OF PLK1 ACTIVITY AT G2 M TRANSITION 85 0.0026189 0.0171676 -0.1900923 0.7845170 0.0024610 0.1908659 0.1465549 0.0194758
621 NEUTROPHIL DEGRANULATION 385 0.0000000 0.0636419 0.1754163 0.0325021 0.0000000 0.1866043 0.0790364 0.0000013
87 AUTOPHAGY 139 0.0017778 0.1721712 0.0416053 0.0004622 0.3975186 0.1771268 0.0923240 0.0144062
977 SIGNALING BY NTRKS 130 0.0037245 -0.0482193 -0.1685222 0.3428543 0.0009146 0.1752850 0.0850669 0.0258953
141 CELLULAR RESPONSES TO EXTERNAL STIMULI 603 0.0000000 0.0875495 0.1500045 0.0002549 0.0000000 0.1736843 0.0441624 0.0000001
572 MITOTIC G1 PHASE AND G1 S TRANSITION 140 0.0047121 0.0648838 0.1603779 0.1854507 0.0010624 0.1730057 0.0675245 0.0307566
53 ANCHORING OF THE BASAL BODY TO THE PLASMA MEMBRANE 96 0.0014390 0.0634230 -0.1606230 0.2831757 0.0065632 0.1726912 0.1584245 0.0122527
152 CILIUM ASSEMBLY 191 0.0000140 0.1608409 -0.0409220 0.0001287 0.3300682 0.1659651 0.1426679 0.0002736
770 RAC3 GTPASE CYCLE 89 0.0053458 -0.1600566 0.0420134 0.0090929 0.4935615 0.1654788 0.1428851 0.0337703
552 METABOLISM OF RNA 644 0.0000000 0.1093603 0.1198438 0.0000024 0.0000002 0.1622412 0.0074129 0.0000013
902 S PHASE 153 0.0061011 0.0515901 0.1493870 0.2712351 0.0014411 0.1580444 0.0691528 0.0379035
396 GOLGI TO ER RETROGRADE TRANSPORT 119 0.0045286 0.1547517 -0.0106224 0.0035704 0.8414935 0.1551159 0.1169371 0.0298935
768 RAC1 GTPASE CYCLE 177 0.0038275 -0.1452114 -0.0502656 0.0008717 0.2492517 0.1536652 0.0671368 0.0261112
543 METABOLISM OF CARBOHYDRATES 258 0.0000264 0.1513722 -0.0012089 0.0000292 0.9733771 0.1513770 0.1078911 0.0004704
293 ER TO GOLGI ANTEROGRADE TRANSPORT 142 0.0013200 0.1385172 -0.0444725 0.0044120 0.3607199 0.1454813 0.1293933 0.0115745
226 DEGRADATION OF THE EXTRACELLULAR MATRIX 107 0.0068537 0.0524289 -0.1328230 0.3491111 0.0176815 0.1427961 0.1309928 0.0415109
575 MITOTIC PROMETAPHASE 177 0.0040863 -0.0188280 -0.1386846 0.6660604 0.0014764 0.1399568 0.0847514 0.0272809
441 INFECTIOUS DISEASE 732 0.0000001 0.0472228 0.1224633 0.0304164 0.0000000 0.1312526 0.0532031 0.0000059
1142 TRANSPORT TO THE GOLGI AND SUBSEQUENT MODIFICATION 171 0.0014987 0.1204825 -0.0471331 0.0066242 0.2881978 0.1293737 0.1185221 0.0126685
450 INNATE IMMUNE SYSTEM 778 0.0000001 0.0112042 0.1128776 0.5970186 0.0000001 0.1134323 0.0718939 0.0000059
72 ASPARAGINE N LINKED GLYCOSYLATION 285 0.0026449 0.1084099 -0.0002835 0.0016699 0.9934421 0.1084103 0.0768579 0.0195458
199 CYTOKINE SIGNALING IN IMMUNE SYSTEM 539 0.0001108 -0.0682286 0.0485029 0.0069394 0.0549704 0.0837119 0.0825417 0.0015502
878 RNA POLYMERASE II TRANSCRIPTION 1087 0.0000543 -0.0795033 -0.0226566 0.0000112 0.2107206 0.0826686 0.0401967 0.0008732
547 METABOLISM OF LIPIDS 613 0.0028834 0.0090432 0.0774132 0.7034241 0.0011162 0.0779396 0.0483449 0.0208948
1162 VESICLE MEDIATED TRANSPORT 611 0.0064496 0.0293378 -0.0516475 0.2175177 0.0299313 0.0593984 0.0572653 0.0394702
# heatmap
mr1 <- head(subset(mres1$enrichment_result,p.adjustMANOVA<0.05),30)
mr1 <- as.matrix(mr1[,4:5])
rownames(mr1) <- head(mres1$enrichment_result,30)$set

colfunc <- colorRampPalette(c("blue", "white", "red"))

par(mar=c(2,2,2,2))
heatmap.2(mr1,trace="none",col=colfunc(25),scale="none", margins = c(10,28), cexRow=0.7,
  main="Top ranked pathways in hypothalamus" , cexCol=0.9 )

pdf("plot22_mitch1_heatmap01.pdf")
heatmap.2(mr1,trace="none",col=colfunc(25),scale="none", margins = c(10,28), cexRow=0.7,
  main="Top ranked pathways in hypothalamus" , cexCol=0.9 )
dev.off()
## X11cairo 
##        2

Two dimensional mitch analysis in hyp with focus on discordant pathways

mres1 <- mitch_calc(m1, genesets, priority="SD")
## Note: Prioritisation by SD after selecting sets with 
##             p.adjustMANOVA<=0.05.
head(mres1$enrichment_result,20) %>%
  kbl(caption = "Top gene pathway discordant differences in hypothalamus for LPS and OVA") %>%
  kable_paper("hover", full_width = F)
Top gene pathway discordant differences in hypothalamus for LPS and OVA
set setSize pMANOVA s.LPS s.OVA p.LPS p.OVA s.dist SD p.adjustMANOVA
283 ENDOSOMAL VACUOLAR PATHWAY 11 0.0001919 -0.2757209 0.4955551 0.1133476 0.0044279 0.5670952 0.5453745 0.0023985
724 POST CHAPERONIN TUBULIN FOLDING PATHWAY 17 0.0000053 0.6289245 -0.0037748 0.0000071 0.9785061 0.6289359 0.4473860 0.0001302
657 NUCLEOTIDE LIKE PURINERGIC RECEPTORS 13 0.0027340 -0.3141983 0.2847330 0.0498345 0.0754980 0.4240206 0.4235084 0.0199533
797 REGULATION OF GLYCOLYSIS BY FRUCTOSE 2 6 BISPHOSPHATE METABOLISM 11 0.0086111 0.2012983 -0.3727085 0.2477085 0.0323273 0.4235949 0.4058841 0.0494811
112 CARBOXYTERMINAL POST TRANSLATIONAL MODIFICATIONS OF TUBULIN 36 0.0000011 0.3966476 -0.1229249 0.0000381 0.2019370 0.4152588 0.3673932 0.0000372
204 CYTOSOLIC TRNA AMINOACYLATION 24 0.0004582 0.3516074 -0.1311225 0.0028680 0.2662404 0.3752611 0.3413416 0.0050314
1172 YAP1 AND WWTR1 TAZ STIMULATED GENE EXPRESSION 11 0.0015116 0.1440006 0.6164919 0.4082939 0.0003990 0.6330864 0.3341017 0.0126863
1135 TRANSPORT OF CONNEXONS TO THE PLASMA MEMBRANE 13 0.0007834 0.5915627 0.1217340 0.0002213 0.4473220 0.6039582 0.3322191 0.0078672
304 EUKARYOTIC TRANSLATION ELONGATION 87 0.0000000 0.3005016 0.7571632 0.0000013 0.0000000 0.8146148 0.3229085 0.0000000
352 G BETA GAMMA SIGNALLING THROUGH CDC42 18 0.0073887 -0.1377442 0.3126369 0.3117235 0.0216649 0.3416362 0.3184676 0.0440697
837 RESPONSE OF EIF2AK4 GCN2 TO AMINO ACID DEFICIENCY 95 0.0000000 0.2223137 0.6530942 0.0001818 0.0000000 0.6898952 0.3046078 0.0000000
305 EUKARYOTIC TRANSLATION INITIATION 114 0.0000000 0.2044179 0.6309008 0.0001645 0.0000000 0.6631912 0.3015689 0.0000000
28 ACTIVATION OF THE MRNA UPON BINDING OF THE CAP BINDING COMPLEX AND EIFS AND SUBSEQUENT BINDING TO 43S 59 0.0000000 0.1620035 0.5870293 0.0314327 0.0000000 0.6089733 0.3005386 0.0000000
1008 SRP DEPENDENT COTRANSLATIONAL PROTEIN TARGETING TO MEMBRANE 106 0.0000000 0.2541257 0.6771379 0.0000062 0.0000000 0.7232535 0.2991148 0.0000000
1170 WNT5A DEPENDENT INTERNALIZATION OF FZD2 FZD5 AND ROR2 13 0.0083226 0.4713315 0.0516256 0.0032558 0.7472597 0.4741504 0.2967769 0.0486518
328 FORMATION OF ATP BY CHEMIOSMOTIC COUPLING 18 0.0002608 0.1250312 0.5429475 0.3584914 0.0000665 0.5571578 0.2955115 0.0030648
40 ADP SIGNALLING THROUGH P2Y PURINOCEPTOR 12 19 0.0086185 -0.0792814 0.3338471 0.5497163 0.0117646 0.3431318 0.2921260 0.0494811
437 IMMUNOREGULATORY INTERACTIONS BETWEEN A LYMPHOID AND A NON LYMPHOID CELL 48 0.0000044 -0.0622684 0.3487797 0.4555992 0.0000291 0.3542945 0.2906548 0.0001126
908 SEALING OF THE NUCLEAR ENVELOPE NE BY ESCRT III 23 0.0000754 0.5121746 0.1040597 0.0000212 0.3877283 0.5226387 0.2885808 0.0011363
390 GLYCOLYSIS 66 0.0000014 0.1209143 -0.2700827 0.0894988 0.0001485 0.2959137 0.2764766 0.0000434
m1_top <- subset(mres1$enrichment_result,p.adjustMANOVA<0.05)
mitch_report(mres1,outfile="mitch1_discord.html",overwrite=TRUE)
## Note: overwriting existing report
## Dataset saved as " /tmp/RtmpXoIrRA/mitch1_discord.rds ".
## 
## 
## processing file: mitch.Rmd
## 1/34                             
## 2/34 [checklibraries]            
## 3/34                             
## 4/34 [peek]                      
## 5/34                             
## 6/34 [metrics]                   
## 7/34                             
## 8/34 [scatterplot]
## 9/34                             
## 10/34 [contourplot]
## 11/34                             
## 12/34 [input_geneset_metrics1]    
## 13/34                             
## 14/34 [input_geneset_metrics2]
## 15/34                             
## 16/34 [input_geneset_metrics3]
## 17/34                             
## 18/34 [echart1d]                  
## 19/34 [echart2d]                  
## 20/34                             
## 21/34 [heatmap]
## 22/34                             
## 23/34 [effectsize]                
## 24/34                             
## 25/34 [results_table]             
## 26/34                             
## 27/34 [results_table_complete]    
## 28/34                             
## 29/34 [detailed_geneset_reports1d]
## 30/34                             
## 31/34 [detailed_geneset_reports2d]
## 32/34                             
## 33/34 [session_info]              
## 34/34
## output file: /home/mark.ziemann@domain.internal.burnet.edu.au/projects/lung_brain/mitch.knit.md
## /usr/bin/pandoc +RTS -K512m -RTS /home/mark.ziemann@domain.internal.burnet.edu.au/projects/lung_brain/mitch.knit.md --to html4 --from markdown+autolink_bare_uris+tex_math_single_backslash --output /tmp/RtmpXoIrRA/mitch_report.html --lua-filter /usr/local/lib/R/site-library/rmarkdown/rmarkdown/lua/pagebreak.lua --lua-filter /usr/local/lib/R/site-library/rmarkdown/rmarkdown/lua/latex-div.lua --self-contained --variable bs3=TRUE --section-divs --template /usr/local/lib/R/site-library/rmarkdown/rmd/h/default.html --no-highlight --variable highlightjs=1 --variable theme=bootstrap --mathjax --variable 'mathjax-url=https://mathjax.rstudio.com/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML' --include-in-header /tmp/RtmpXoIrRA/rmarkdown-str2d12056fcefb35.html
## 
## Output created: /tmp/RtmpXoIrRA/mitch_report.html
## [1] TRUE
write.table(mres1$enrichment_result,file="mitch1_discord.tsv",quote=FALSE,sep="\t",row.names=FALSE)

m1_top_up <- head(subset(m1_top,s.dist>0),10)[,"s.dist"]
names(m1_top_up) <- head(subset(m1_top,s.dist>0),10)[,"set"]
m1_top_dn <- head(subset(m1_top,s.dist<0),10)[,"s.dist"]
names(m1_top_dn) <- head(subset(m1_top,s.dist<0),10)[,"set"]
m1_top_updn <- c(m1_top_up,m1_top_dn)
m1_top_updn <- m1_top_updn[order(m1_top_updn)]

Paper 1 (the hypothalamus, referred as mitch 1 in our analysis):

Thanks for sending the MDS plots and the discordant Mitch1. Criag and I are interested in the following gene sets: Neuronal System gene sets: directly related to mental health, very interesting) (Appeared in the old original JOINT mitch 1 heatmap), which are:

  • Highly calcium permeable postsynaptic nicotinic acetylcholine receptors

  • Acetylcholine binding and downstream events

  • Serotonin Neurotransmitter Release Cycle

  • CREB1 phosphorylation through the activation of Adenylate Cyclase

  • Voltage gated Potassium channels

mres1 <- mitch_calc(m1, genesets, priority="effect")
## Note: Enrichments with large effect sizes may not be 
##             statistically significant.
## Neuronal sets
mysets2 <- c("HIGHLY CALCIUM PERMEABLE POSTSYNAPTIC NICOTINIC ACETYLCHOLINE RECEPTORS",
"ACETYLCHOLINE BINDING AND DOWNSTREAM EVENTS",
"SEROTONIN NEUROTRANSMITTER RELEASE CYCLE",
"CREB1 PHOSPHORYLATION THROUGH THE ACTIVATION OF ADENYLATE CYCLASE",
"VOLTAGE GATED POTASSIUM CHANNELS")

mres1_bespoke <- mres1$enrichment_result[which(mres1$enrichment_result$set %in% mysets2),]
rownames(mres1_bespoke) <- mres1_bespoke$set

mres1_bespoke %>%
  kbl(caption = "Selected neuronal pathways in hypothalamus for LPS and OVA") %>%
  kable_paper("hover", full_width = F)
Selected neuronal pathways in hypothalamus for LPS and OVA
set setSize pMANOVA s.LPS s.OVA p.LPS p.OVA s.dist SD p.adjustMANOVA
VOLTAGE GATED POTASSIUM CHANNELS VOLTAGE GATED POTASSIUM CHANNELS 39 0.0000057 -0.3994268 -0.3608675 0.0000159 0.0000964 0.5383002 0.0272655 0.0001377
SEROTONIN NEUROTRANSMITTER RELEASE CYCLE SEROTONIN NEUROTRANSMITTER RELEASE CYCLE 18 0.0009568 -0.1551803 -0.5046378 0.2544237 0.0002099 0.5279586 0.2471038 0.0090228
ACETYLCHOLINE BINDING AND DOWNSTREAM EVENTS ACETYLCHOLINE BINDING AND DOWNSTREAM EVENTS 10 0.0185517 -0.0817184 -0.4983477 0.6545672 0.0063554 0.5050033 0.2946014 0.0871932
HIGHLY CALCIUM PERMEABLE POSTSYNAPTIC NICOTINIC ACETYLCHOLINE RECEPTORS HIGHLY CALCIUM PERMEABLE POSTSYNAPTIC NICOTINIC ACETYLCHOLINE RECEPTORS 10 0.0185517 -0.0817184 -0.4983477 0.6545672 0.0063554 0.5050033 0.2946014 0.0871932
CREB1 PHOSPHORYLATION THROUGH THE ACTIVATION OF ADENYLATE CYCLASE CREB1 PHOSPHORYLATION THROUGH THE ACTIVATION OF ADENYLATE CYCLASE 11 0.0588469 -0.3803911 -0.3052389 0.0289281 0.0796286 0.4877173 0.0531407 0.1951552
mres1mx <- as.matrix(mres1_bespoke[,c("s.LPS","s.OVA")])

heatmap.2(mres1mx,trace="none",col=colfunc(25),scale="none", margins = c(15,28), cexRow=0.7,
  main="Neuronal pathways in hypothalamus" , cexCol=0.9 )

lapply(1:length(mysets2), function(i) {
  myset=mysets2[i]
  mygenes <- genesets[[which(names(genesets) == myset)]]
  allnames <- rownames(rpm1)
  allnames <- sapply(strsplit(allnames," "),"[[",2)
  mymx <- rpm1[which(allnames %in% mygenes),]
  mymx <- mymx[,colnames(mymx) %in% rownames(ss1)] # filter for those present in ss1
  mycols <- gsub("OVA","purple",gsub("LPS","orange",gsub("Control","green",ss1$Treatment)))

  heatmap.2(mymx,trace="none",col=colfunc(25),scale="row", margins = c(10,15), cexRow=0.7,
    ColSideColors=mycols,main=myset)
  mtext("Ctrl=green,LPS=orange,OVA=purple")
})

## [[1]]
## NULL
## 
## [[2]]
## NULL
## 
## [[3]]
## NULL
## 
## [[4]]
## NULL
## 
## [[5]]
## NULL
pdf("mitch1_bespoke_heatmap01.pdf")
heatmap.2(mres1mx,trace="none",col=colfunc(25),scale="none", margins = c(10,28), cexRow=0.7,
  main="Neuronal pathways in hypothalamus" , cexCol=0.9 )

lapply(1:length(mysets2), function(i) {
  myset=mysets2[i]
  mygenes <- genesets[[which(names(genesets) == myset)]]
  allnames <- rownames(rpm1)
  allnames <- sapply(strsplit(allnames," "),"[[",2)
  mymx <- rpm1[which(allnames %in% mygenes),]
  mymx <- mymx[,colnames(mymx) %in% rownames(ss1)] # filter for those present in ss1
  mycols <- gsub("OVA","purple",gsub("LPS","orange",gsub("Control","green",ss1$Treatment)))

  heatmap.2(mymx,trace="none",col=colfunc(25),scale="row", margins = c(10,15), cexRow=0.7,
    ColSideColors=mycols,main=myset)
  mtext("Ctrl=green,LPS=orange,OVA=purple")
})
## [[1]]
## NULL
## 
## [[2]]
## NULL
## 
## [[3]]
## NULL
## 
## [[4]]
## NULL
## 
## [[5]]
## NULL
dev.off()
## X11cairo 
##        2
mysets2 <- genesets[names(genesets) %in% mysets2]
mres1b1 <- mitch_calc(m1, mysets2, priority="effect")
## Note: Enrichments with large effect sizes may not be 
##             statistically significant.
mitch_plots(res=mres1b1,outfile="mitch1_bespoke_charts.pdf")
## X11cairo 
##        2
## Immuno sets
mysets3 <- c("IMMUNOREGULATORY INTERACTIONS BETWEEN A LYMPHOID AND A NON LYMPHOID CELL",
"INTERFERON GAMMA SIGNALING",
"ENDOSOMAL VACUOLAR PATHWAY",
"INTERFERON ALPHA BETA SIGNALING")

mres1_bespoke <- mres1$enrichment_result[which(mres1$enrichment_result$set %in% mysets3),]
rownames(mres1_bespoke) <- mres1_bespoke$set

mres1_bespoke %>%
  kbl(caption = "Selected immune pathways in hypothalamus for LPS and OVA") %>%
  kable_paper("hover", full_width = F)
Selected immune pathways in hypothalamus for LPS and OVA
set setSize pMANOVA s.LPS s.OVA p.LPS p.OVA s.dist SD p.adjustMANOVA
ENDOSOMAL VACUOLAR PATHWAY ENDOSOMAL VACUOLAR PATHWAY 11 0.0001919 -0.2757209 0.4955551 0.1133476 0.0044279 0.5670952 0.5453745 0.0023985
IMMUNOREGULATORY INTERACTIONS BETWEEN A LYMPHOID AND A NON LYMPHOID CELL IMMUNOREGULATORY INTERACTIONS BETWEEN A LYMPHOID AND A NON LYMPHOID CELL 48 0.0000044 -0.0622684 0.3487797 0.4555992 0.0000291 0.3542945 0.2906548 0.0001126
INTERFERON ALPHA BETA SIGNALING INTERFERON ALPHA BETA SIGNALING 55 0.0001042 -0.1834910 0.1800378 0.0186137 0.0209500 0.2570653 0.2570537 0.0014892
INTERFERON GAMMA SIGNALING INTERFERON GAMMA SIGNALING 77 0.0000357 -0.2175923 0.0978846 0.0009672 0.1377361 0.2385955 0.2230759 0.0005991
mres1mx <- as.matrix(mres1_bespoke[,c("s.LPS","s.OVA")])

heatmap.2(mres1mx,trace="none",col=colfunc(25),scale="none", margins = c(15,28), cexRow=0.7,
  main="Immune pathways in hypothalamus" , cexCol=0.9 )

lapply(1:length(mysets3), function(i) {
  myset=mysets3[i]
  mygenes <- genesets[[which(names(genesets) == myset)]]
  allnames <- rownames(rpm1)
  allnames <- sapply(strsplit(allnames," "),"[[",2)
  mymx <- rpm1[which(allnames %in% mygenes),]
  mymx <- mymx[,colnames(mymx) %in% rownames(ss1)] # filter for those present in ss1
  mycols <- gsub("OVA","purple",gsub("LPS","orange",gsub("Control","green",ss1$Treatment)))

  heatmap.2(mymx,trace="none",col=colfunc(25),scale="row", margins = c(10,15), cexRow=0.7,
    ColSideColors=mycols,main=myset)
  mtext("Ctrl=green,LPS=orange,OVA=purple")
})

## [[1]]
## NULL
## 
## [[2]]
## NULL
## 
## [[3]]
## NULL
## 
## [[4]]
## NULL
pdf("mitch1_bespoke_heatmap02.pdf")
heatmap.2(mres1mx,trace="none",col=colfunc(25),scale="none", margins = c(10,28), cexRow=0.7,
  main="Immune pathways in hypothalamus" , cexCol=0.9 )

lapply(1:length(mysets3), function(i) {
  myset=mysets3[i]
  mygenes <- genesets[[which(names(genesets) == myset)]]
  allnames <- rownames(rpm1)
  allnames <- sapply(strsplit(allnames," "),"[[",2)
  mymx <- rpm1[which(allnames %in% mygenes),]
  mymx <- mymx[,colnames(mymx) %in% rownames(ss1)] # filter for those present in ss1
  mycols <- gsub("OVA","purple",gsub("LPS","orange",gsub("Control","green",ss1$Treatment)))

  heatmap.2(mymx,trace="none",col=colfunc(25),scale="row", margins = c(10,15), cexRow=0.7,
    ColSideColors=mycols,main=myset)
  mtext("Ctrl=green,LPS=orange,OVA=purple")
})
## [[1]]
## NULL
## 
## [[2]]
## NULL
## 
## [[3]]
## NULL
## 
## [[4]]
## NULL
dev.off()
## X11cairo 
##        2
mysets3 <- genesets[names(genesets) %in% mysets3]

mres1b2 <- mitch_calc(m1, mysets3, priority="effect")
## Note: Enrichments with large effect sizes may not be 
##             statistically significant.
mitch_plots(res=mres1b2,outfile="mitch1_bespoke_charts2.pdf")
## X11cairo 
##        2

Mitch pathway analysis in amygdala

Mitch for LPS in amy

m2_l <- mitch_import(dge2_l, DEtype="deseq2",geneTable=gt)
## The input is a single dataframe; one contrast only. Converting
##         it to a list for you.
## Note: Mean no. genes in input = 16818
## Note: no. genes in output = 16805
## Note: estimated proportion of input genes in output = 0.999
mres2_l <- mitch_calc(m2_l, genesets, priority="effect")
## Note: Enrichments with large effect sizes may not be
##             statistically significant.
head(mres2_l$enrichment_result,20) %>%
  kbl(caption = "Top gene pathway differences in amy for LPS") %>%
  kable_paper("hover", full_width = F)
Top gene pathway differences in amy for LPS
set setSize pANOVA s.dist p.adjustANOVA
534 MET ACTIVATES RAP1 AND RAC1 11 0.0010360 -0.5712105 0.0294883
1039 SYNTHESIS OF PIPS AT THE LATE ENDOSOME MEMBRANE 11 0.0021395 -0.5345849 0.0509548
24 ACTIVATION OF RAC1 13 0.0017581 -0.5010903 0.0446019
443 INITIAL TRIGGERING OF COMPLEMENT 10 0.0100199 0.4702828 0.1538585
301 EUKARYOTIC TRANSLATION ELONGATION 87 0.0000000 0.4370016 0.0000000
185 CREB1 PHOSPHORYLATION THROUGH THE ACTIVATION OF ADENYLATE CYCLASE 11 0.0121708 -0.4365737 0.1711250
621 NF KB IS ACTIVATED AND SIGNALS SURVIVAL 13 0.0067949 0.4335764 0.1239016
20 ACTIVATION OF IRF3 IRF7 MEDIATED BY TBK1 IKK EPSILON 16 0.0027697 0.4320686 0.0633763
909 SEMA4D INDUCED CELL MIGRATION AND GROWTH CONE COLLAPSE 20 0.0009077 0.4285255 0.0264831
199 CYTOSOLIC IRON SULFUR CLUSTER ASSEMBLY 13 0.0092131 0.4171309 0.1472838
901 SCAVENGING BY CLASS A RECEPTORS 14 0.0075363 0.4124829 0.1305423
917 SEROTONIN RECEPTORS 10 0.0291373 -0.3984281 0.2951866
164 COLLAGEN CHAIN TRIMERIZATION 40 0.0000146 0.3961378 0.0008093
1037 SYNTHESIS OF PIPS AT THE EARLY ENDOSOME MEMBRANE 16 0.0061311 -0.3957576 0.1135714
798 REGULATION OF INNATE IMMUNE RESPONSES TO CYTOSOLIC DNA 13 0.0188315 0.3762598 0.2265600
833 RESPONSE OF EIF2AK4 GCN2 TO AMINO ACID DEFICIENCY 94 0.0000000 0.3739962 0.0000001
45 ALPHA LINOLENIC OMEGA3 AND LINOLEIC OMEGA6 ACID METABOLISM 12 0.0277052 0.3670379 0.2912789
163 COLLAGEN BIOSYNTHESIS AND MODIFYING ENZYMES 63 0.0000010 0.3569447 0.0000701
629 NONSENSE MEDIATED DECAY NMD 109 0.0000000 0.3467072 0.0000001
42 AGGREPHAGY 35 0.0005188 0.3390374 0.0163640
m2_l_top <- subset(mres2_l$enrichment_result,p.adjustANOVA<0.05)
m2_l_up <- subset(m2_l_top,s.dist>0)$set
m2_l_dn <- subset(m2_l_top,s.dist<0)$set
mitch_report(mres2_l,outfile="mitch2_l.html",overwrite=TRUE)
## Note: overwriting existing report
## Dataset saved as " /tmp/RtmpXoIrRA/mitch2_l.rds ".
## 
## 
## processing file: mitch.Rmd
## 1/34                             
## 2/34 [checklibraries]            
## 3/34                             
## 4/34 [peek]                      
## 5/34                             
## 6/34 [metrics]                   
## 7/34                             
## 8/34 [scatterplot]
## 9/34                             
## 10/34 [contourplot]               
## 11/34                             
## 12/34 [input_geneset_metrics1]    
## 13/34                             
## 14/34 [input_geneset_metrics2]
## 15/34                             
## 16/34 [input_geneset_metrics3]
## 17/34                             
## 18/34 [echart1d]                  
## 19/34 [echart2d]                  
## 20/34                             
## 21/34 [heatmap]                   
## 22/34                             
## 23/34 [effectsize]                
## 24/34                             
## 25/34 [results_table]             
## 26/34                             
## 27/34 [results_table_complete]    
## 28/34                             
## 29/34 [detailed_geneset_reports1d]
## 30/34                             
## 31/34 [detailed_geneset_reports2d]
## 32/34                             
## 33/34 [session_info]              
## 34/34
## output file: /home/mark.ziemann@domain.internal.burnet.edu.au/projects/lung_brain/mitch.knit.md
## /usr/bin/pandoc +RTS -K512m -RTS /home/mark.ziemann@domain.internal.burnet.edu.au/projects/lung_brain/mitch.knit.md --to html4 --from markdown+autolink_bare_uris+tex_math_single_backslash --output /tmp/RtmpXoIrRA/mitch_report.html --lua-filter /usr/local/lib/R/site-library/rmarkdown/rmarkdown/lua/pagebreak.lua --lua-filter /usr/local/lib/R/site-library/rmarkdown/rmarkdown/lua/latex-div.lua --self-contained --variable bs3=TRUE --section-divs --template /usr/local/lib/R/site-library/rmarkdown/rmd/h/default.html --no-highlight --variable highlightjs=1 --variable theme=bootstrap --mathjax --variable 'mathjax-url=https://mathjax.rstudio.com/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML' --include-in-header /tmp/RtmpXoIrRA/rmarkdown-str2d12052fd0e6ef.html
## 
## Output created: /tmp/RtmpXoIrRA/mitch_report.html
## [1] TRUE
write.table(mres2_l$enrichment_result,file="mitch2_l.tsv",quote=FALSE,sep="\t",row.names=FALSE)

m2_l_top_up <- head(subset(m2_l_top,s.dist>0),10)[,"s.dist"]
names(m2_l_top_up) <- head(subset(m2_l_top,s.dist>0),10)[,"set"]
m2_l_top_dn <- head(subset(m2_l_top,s.dist<0),10)[,"s.dist"]
names(m2_l_top_dn) <- head(subset(m2_l_top,s.dist<0),10)[,"set"]
m2_l_top_updn <- c(m2_l_top_up,m2_l_top_dn)
m2_l_top_updn <- m2_l_top_updn[order(m2_l_top_updn)]

par(mar=c(5,25,3,1))
barplot(m2_l_top_updn,horiz=TRUE,las=1,col="darkgray",
  xlab="Enrichment score",cex.names=0.8,xlim=c(-1,1),
  main="Effect of LPS in amy")
grid()

pdf("plot23_mitch2lps01.pdf")
par(mar=c(5,25,3,1))
barplot(m2_l_top_updn,horiz=TRUE,las=1,col="darkgray",
  xlab="Enrichment score",cex.names=0.8,xlim=c(-1,1),
  main="Effect of LPS in amy")
grid()
dev.off()
## X11cairo 
##        2

Mitch for OVA in amy

m2_o <- mitch_import(dge2_o, DEtype="deseq2",geneTable=gt)
## The input is a single dataframe; one contrast only. Converting
##         it to a list for you.
## Note: Mean no. genes in input = 16624
## Note: no. genes in output = 16611
## Note: estimated proportion of input genes in output = 0.999
mres2_o <- mitch_calc(m2_o, genesets, priority="effect")
## Note: Enrichments with large effect sizes may not be
##             statistically significant.
head(mres2_o$enrichment_result,20) %>%
  kbl(caption = "Top gene pathway differences in amy for OVA") %>%
  kable_paper("hover", full_width = F)
Top gene pathway differences in amy for OVA
set setSize pANOVA s.dist p.adjustANOVA
1096 TRAFFICKING AND PROCESSING OF ENDOSOMAL TLR 11 0.0001756 0.6532311 0.0016524
656 NUCLEOTIDE LIKE PURINERGIC RECEPTORS 13 0.0005322 0.5548398 0.0043435
39 ADP SIGNALLING THROUGH P2Y PURINOCEPTOR 12 19 0.0000405 0.5439146 0.0005132
72 ASPARTATE AND ASPARAGINE METABOLISM 10 0.0030160 0.5416662 0.0171690
170 COMPLEX I BIOGENESIS 56 0.0000000 0.5353777 0.0000000
1045 SYNTHESIS OF VERY LONG CHAIN FATTY ACYL COAS 20 0.0000349 0.5345187 0.0004577
1137 TRIGLYCERIDE CATABOLISM 14 0.0006660 0.5252929 0.0052667
704 PINK1 PRKN MEDIATED MITOPHAGY 22 0.0000243 0.5198954 0.0003329
344 FRS MEDIATED FGFR4 SIGNALING 12 0.0019086 0.5175011 0.0121050
921 SHC MEDIATED CASCADE FGFR4 10 0.0047228 0.5159689 0.0242800
302 EUKARYOTIC TRANSLATION ELONGATION 87 0.0000000 0.5146676 0.0000000
188 CRMPS IN SEMA3A SIGNALING 16 0.0003855 -0.5125565 0.0033082
831 RESPIRATORY ELECTRON TRANSPORT 102 0.0000000 0.5112886 0.0000000
700 PI 3K CASCADE FGFR4 10 0.0053282 0.5088730 0.0264558
832 RESPIRATORY ELECTRON TRANSPORT ATP SYNTHESIS BY CHEMIOSMOTIC COUPLING AND HEAT PRODUCTION BY UNCOUPLING PROTEINS 125 0.0000000 0.5040543 0.0000000
718 PLATELET SENSITIZATION BY LDL 15 0.0007634 0.5019121 0.0057444
343 FRS MEDIATED FGFR3 SIGNALING 14 0.0012001 0.4999354 0.0081902
950 SIGNALING BY FGFR3 FUSIONS IN CANCER 10 0.0062690 0.4991747 0.0302309
920 SHC MEDIATED CASCADE FGFR3 12 0.0029455 0.4957126 0.0168498
153 CITRIC ACID CYCLE TCA CYCLE 22 0.0000573 0.4955255 0.0006620
m2_o_top <- subset(mres2_o$enrichment_result,p.adjustANOVA<0.05)
m2_o_up <- subset(m2_o_top,s.dist>0)$set
m2_o_dn <- subset(m2_o_top,s.dist<0)$set
mitch_report(mres2_o,outfile="mitch2_o.html",overwrite=TRUE)
## Note: overwriting existing report
## Dataset saved as " /tmp/RtmpXoIrRA/mitch2_o.rds ".
## 
## 
## processing file: mitch.Rmd
## 1/34                             
## 2/34 [checklibraries]            
## 3/34                             
## 4/34 [peek]                      
## 5/34                             
## 6/34 [metrics]                   
## 7/34                             
## 8/34 [scatterplot]
## 9/34                             
## 10/34 [contourplot]               
## 11/34                             
## 12/34 [input_geneset_metrics1]    
## 13/34                             
## 14/34 [input_geneset_metrics2]
## 15/34                             
## 16/34 [input_geneset_metrics3]
## 17/34                             
## 18/34 [echart1d]                  
## 19/34 [echart2d]                  
## 20/34                             
## 21/34 [heatmap]                   
## 22/34                             
## 23/34 [effectsize]                
## 24/34                             
## 25/34 [results_table]             
## 26/34                             
## 27/34 [results_table_complete]    
## 28/34                             
## 29/34 [detailed_geneset_reports1d]
## 30/34                             
## 31/34 [detailed_geneset_reports2d]
## 32/34                             
## 33/34 [session_info]              
## 34/34
## output file: /home/mark.ziemann@domain.internal.burnet.edu.au/projects/lung_brain/mitch.knit.md
## /usr/bin/pandoc +RTS -K512m -RTS /home/mark.ziemann@domain.internal.burnet.edu.au/projects/lung_brain/mitch.knit.md --to html4 --from markdown+autolink_bare_uris+tex_math_single_backslash --output /tmp/RtmpXoIrRA/mitch_report.html --lua-filter /usr/local/lib/R/site-library/rmarkdown/rmarkdown/lua/pagebreak.lua --lua-filter /usr/local/lib/R/site-library/rmarkdown/rmarkdown/lua/latex-div.lua --self-contained --variable bs3=TRUE --section-divs --template /usr/local/lib/R/site-library/rmarkdown/rmd/h/default.html --no-highlight --variable highlightjs=1 --variable theme=bootstrap --mathjax --variable 'mathjax-url=https://mathjax.rstudio.com/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML' --include-in-header /tmp/RtmpXoIrRA/rmarkdown-str2d1205466f887f.html
## 
## Output created: /tmp/RtmpXoIrRA/mitch_report.html
## [1] TRUE
write.table(mres2_o$enrichment_result,file="mitch2_o.tsv",quote=FALSE,sep="\t",row.names=FALSE)

m2_o_top_up <- head(subset(m2_o_top,s.dist>0),10)[,"s.dist"]
names(m2_o_top_up) <- head(subset(m2_o_top,s.dist>0),10)[,"set"]
m2_o_top_dn <- head(subset(m2_o_top,s.dist<0),10)[,"s.dist"]
names(m2_o_top_dn) <- head(subset(m2_o_top,s.dist<0),10)[,"set"]
m2_o_top_updn <- c(m2_o_top_up,m2_o_top_dn)
m2_o_top_updn <- m2_o_top_updn[order(m2_o_top_updn)]

par(mar=c(5,25,3,1))
barplot(m2_o_top_updn,horiz=TRUE,las=1,col="darkgray",
  xlab="Enrichment score",cex.names=0.8,xlim=c(-1,1),
  main="Effect of LPS in amy")
grid()

pdf("plot24_mitch2ova01.pdf")
par(mar=c(5,25,3,1))
barplot(m2_o_top_updn,horiz=TRUE,las=1,col="darkgray",
  xlab="Enrichment score",cex.names=0.8,xlim=c(-1,1),
  main="Effect of LPS in amy")
grid()
dev.off()
## X11cairo 
##        2

Mitch 2 euler.

m2_l_up <- subset(m2_l_top,s.dist>0)$set
m2_l_dn <- subset(m2_l_top,s.dist<0)$set
m2_o_up <- subset(m2_o_top,s.dist>0)$set
m2_o_dn <- subset(m2_o_top,s.dist<0)$set

par(mar=c(2,2,2,2))

v0 <- list("LPS up"=m2_l_up,
  "LPS dn"=m2_l_dn,
  "OVA up"=m2_o_up,
  "OVA dn"=m2_o_dn)
plot(euler(v0),quantities = TRUE, edges = "gray", main="effect of treatments on amy")

pdf("plot25_mitch2lpsovaeuler01.pdf")
plot(euler(v0),quantities = TRUE, edges = "gray", main="effect of treatments on amy")
dev.off()
## X11cairo 
##        2

Two dimensional mitch analysis in amy.

ml <- list("LPS"=dge2_l,"OVA"=dge2_o)
m2 <- mitch_import(ml, DEtype="deseq2",geneTable=gt)
## Note: Mean no. genes in input = 16721
## Note: no. genes in output = 16550
## Note: estimated proportion of input genes in output = 0.99
head(m2)
##                      LPS          OVA
## 0610009B22Rik  0.2684894  1.831236577
## 0610009E02Rik -0.7521235 -0.103702849
## 0610009L18Rik -1.1838923 -0.075637695
## 0610010K14Rik -0.0433030  0.417670579
## 0610012G03Rik -0.1930476  0.008709563
## 0610030E20Rik  1.0496464 -1.609523779
mres2 <- mitch_calc(m2, genesets, priority="effect")
## Note: Enrichments with large effect sizes may not be 
##             statistically significant.
head(mres2$enrichment_result,20) %>%
  kbl(caption = "Top gene pathway differences in amy for LPS and OVA") %>%
  kable_paper("hover", full_width = F)
Top gene pathway differences in amy for LPS and OVA
set setSize pMANOVA s.LPS s.OVA p.LPS p.OVA s.dist SD p.adjustMANOVA
301 EUKARYOTIC TRANSLATION ELONGATION 87 0.0000000 0.4430297 0.5156244 0.0000000 0.0000000 0.6798116 0.0513322 0.0000000
1095 TRAFFICKING AND PROCESSING OF ENDOSOMAL TLR 11 0.0008503 0.0789264 0.6538650 0.6503946 0.0001730 0.6586112 0.4065430 0.0063961
534 MET ACTIVATES RAP1 AND RAC1 11 0.0012900 -0.5676115 0.2448043 0.0011146 0.1597948 0.6181521 0.5744647 0.0087961
169 COMPLEX I BIOGENESIS 56 0.0000000 0.2952502 0.5362275 0.0001329 0.0000000 0.6121377 0.1703966 0.0000000
833 RESPONSE OF EIF2AK4 GCN2 TO AMINO ACID DEFICIENCY 94 0.0000000 0.3800903 0.4681898 0.0000000 0.0000000 0.6030509 0.0622958 0.0000000
45 ALPHA LINOLENIC OMEGA3 AND LINOLEIC OMEGA6 ACID METABOLISM 12 0.0022675 0.3721127 0.4720139 0.0256238 0.0046376 0.6010533 0.0706408 0.0142145
1004 SRP DEPENDENT COTRANSLATIONAL PROTEIN TARGETING TO MEMBRANE 106 0.0000000 0.3243576 0.4911983 0.0000000 0.0000000 0.5886285 0.1179742 0.0000000
39 ADP SIGNALLING THROUGH P2Y PURINOCEPTOR 12 19 0.0000306 -0.2223605 0.5448806 0.0933928 0.0000392 0.5885058 0.5425214 0.0004249
443 INITIAL TRIGGERING OF COMPLEMENT 10 0.0085049 0.4743047 0.3372189 0.0093999 0.0648311 0.5819635 0.0969343 0.0395086
123 CD28 DEPENDENT VAV1 PATHWAY 10 0.0045592 -0.4094075 0.4085490 0.0249781 0.0252838 0.5783829 0.5783826 0.0243853
302 EUKARYOTIC TRANSLATION INITIATION 114 0.0000000 0.3057271 0.4748925 0.0000000 0.0000000 0.5647937 0.1196180 0.0000000
655 NUCLEOTIDE LIKE PURINERGIC RECEPTORS 13 0.0024330 0.0355520 0.5557189 0.8243775 0.0005215 0.5568549 0.3678135 0.0148530
703 PINK1 PRKN MEDIATED MITOPHAGY 22 0.0000610 0.1878355 0.5208297 0.1272824 0.0000234 0.5536657 0.2354624 0.0007331
830 RESPIRATORY ELECTRON TRANSPORT 102 0.0000000 0.2102216 0.5121571 0.0002459 0.0000000 0.5536227 0.2135006 0.0000000
1029 SYNTHESIS OF BILE ACIDS AND BILE SALTS VIA 7ALPHA HYDROXYCHOLESTEROL 12 0.0057157 0.3196174 0.4512335 0.0552416 0.0067994 0.5529620 0.0930666 0.0282393
27 ACTIVATION OF THE MRNA UPON BINDING OF THE CAP BINDING COMPLEX AND EIFS AND SUBSEQUENT BINDING TO 43S 59 0.0000000 0.2703241 0.4804130 0.0003301 0.0000000 0.5512457 0.1485553 0.0000000
185 CREB1 PHOSPHORYLATION THROUGH THE ACTIVATION OF ADENYLATE CYCLASE 11 0.0046348 -0.4323170 0.3418202 0.0130394 0.0496554 0.5511252 0.5473976 0.0244530
831 RESPIRATORY ELECTRON TRANSPORT ATP SYNTHESIS BY CHEMIOSMOTIC COUPLING AND HEAT PRODUCTION BY UNCOUPLING PROTEINS 125 0.0000000 0.2156727 0.5049507 0.0000316 0.0000000 0.5490810 0.2045505 0.0000000
164 COLLAGEN CHAIN TRIMERIZATION 39 0.0000000 0.4232656 -0.3400608 0.0000048 0.0002384 0.5429504 0.5397533 0.0000003
71 ASPARTATE AND ASPARAGINE METABOLISM 10 0.0120499 0.0136880 0.5423579 0.9402592 0.0029791 0.5425306 0.3738261 0.0522310
m2_top <- subset(mres2$enrichment_result,p.adjustMANOVA<0.05)
m2_up <- subset(m2_top,s.dist>0)$set
m2_dn <- subset(m2_top,s.dist<0)$set
mitch_report(mres2,outfile="mitch2.html",overwrite=TRUE)
## Note: overwriting existing report
## Dataset saved as " /tmp/RtmpXoIrRA/mitch2.rds ".
## 
## 
## processing file: mitch.Rmd
## 1/34                             
## 2/34 [checklibraries]            
## 3/34                             
## 4/34 [peek]                      
## 5/34                             
## 6/34 [metrics]                   
## 7/34                             
## 8/34 [scatterplot]
## 9/34                             
## 10/34 [contourplot]
## 11/34                             
## 12/34 [input_geneset_metrics1]    
## 13/34                             
## 14/34 [input_geneset_metrics2]
## 15/34                             
## 16/34 [input_geneset_metrics3]
## 17/34                             
## 18/34 [echart1d]                  
## 19/34 [echart2d]                  
## 20/34                             
## 21/34 [heatmap]
## 22/34                             
## 23/34 [effectsize]                
## 24/34                             
## 25/34 [results_table]             
## 26/34                             
## 27/34 [results_table_complete]    
## 28/34                             
## 29/34 [detailed_geneset_reports1d]
## 30/34                             
## 31/34 [detailed_geneset_reports2d]
## 32/34                             
## 33/34 [session_info]              
## 34/34
## output file: /home/mark.ziemann@domain.internal.burnet.edu.au/projects/lung_brain/mitch.knit.md
## /usr/bin/pandoc +RTS -K512m -RTS /home/mark.ziemann@domain.internal.burnet.edu.au/projects/lung_brain/mitch.knit.md --to html4 --from markdown+autolink_bare_uris+tex_math_single_backslash --output /tmp/RtmpXoIrRA/mitch_report.html --lua-filter /usr/local/lib/R/site-library/rmarkdown/rmarkdown/lua/pagebreak.lua --lua-filter /usr/local/lib/R/site-library/rmarkdown/rmarkdown/lua/latex-div.lua --self-contained --variable bs3=TRUE --section-divs --template /usr/local/lib/R/site-library/rmarkdown/rmd/h/default.html --no-highlight --variable highlightjs=1 --variable theme=bootstrap --mathjax --variable 'mathjax-url=https://mathjax.rstudio.com/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML' --include-in-header /tmp/RtmpXoIrRA/rmarkdown-str2d12057ceebb87.html
## 
## Output created: /tmp/RtmpXoIrRA/mitch_report.html
## [1] TRUE
write.table(mres2$enrichment_result,file="mitch2.tsv",quote=FALSE,sep="\t",row.names=FALSE)

m2_top_up <- head(subset(m2_top,s.dist>0),10)[,"s.dist"]
names(m2_top_up) <- head(subset(m2_top,s.dist>0),10)[,"set"]
m2_top_dn <- head(subset(m2_top,s.dist<0),10)[,"s.dist"]
names(m2_top_dn) <- head(subset(m2_top,s.dist<0),10)[,"set"]
m2_top_updn <- c(m2_top_up,m2_top_dn)
m2_top_updn <- m2_top_updn[order(m2_top_updn)]

# heatmap
mr2 <- head(subset(mres2$enrichment_result,p.adjustMANOVA<0.05),30)
mr2 <- as.matrix(mr2[,4:5])
rownames(mr2) <- head(mres2$enrichment_result,30)$set

colfunc <- colorRampPalette(c("blue", "white", "red"))

heatmap.2(mr2,trace="none",col=colfunc(25),scale="none", margins = c(10,28), cexRow=0.7,
  main="Top ranked pathways in amy" , cexCol=0.9 )

pdf("plot26_mitch2_heatmap01.pdf")
heatmap.2(mr2,trace="none",col=colfunc(25),scale="none", margins = c(10,28), cexRow=0.7,
  main="Top ranked pathways in amy" , cexCol=0.9 )
dev.off()
## X11cairo 
##        2

Need to make a scatterplot to highlight the following:

  • Serotonin Neurotransmitter Release Cycle (DN)
  • Class C3 metabotropic glutamate pheromone receptors (DN)
  • Regulation of commissural axon pathfinding by SLIT AND robo (DN)
  • Reduction of Cytosolic Ca (DN)
  • YAP1 and WWTR1 TAZ STIMULATED GENE EXPRESSION (UP)
  • Activation of the mRNA upon binding (UP)
  • Regulation of expression of slits and robs (UP)
par(mar=c(4,4,2,1))

a <- mres2$enrichment_result
plot(a$s.LPS , a$s.OVA,pch=19,col="gray")
abline(h=0,lty=2)
abline(v=0,lty=2)
as <- subset(a,p.adjustMANOVA<0.05)
points(as$s.LPS , as$s.OVA,pch=19,col="red")

abline(h=0.2,lty=2,col="red")
abline(v=0.2,lty=2,col="red")
abline(h=-0.2,lty=2,col="red")
abline(v=-0.2,lty=2,col="red")

mysets <- c("SEROTONIN NEUROTRANSMITTER RELEASE CYCLE",
  "CLASS C 3 METABOTROPIC GLUTAMATE PHEROMONE RECEPTORS",
  "REGULATION OF COMMISSURAL AXON PATHFINDING BY SLIT AND ROBO",
  "REDUCTION OF CYTOSOLIC CA LEVELS",
  "YAP1 AND WWTR1 TAZ STIMULATED GENE EXPRESSION",
  "ACTIVATION OF THE MRNA UPON BINDING OF THE CAP BINDING COMPLEX AND EIFS AND SUBSEQUENT BINDING TO 43S",
  "REGULATION OF EXPRESSION OF SLITS AND ROBOS")

a2 <- a[which(a$set %in% mysets),]

points(a2$s.LPS , a2$s.OVA+0.025,pch=25,col="red")

pdf("plot26b_mitch2_scatter01.pdf")

a <- mres2$enrichment_result
plot(a$s.LPS , a$s.OVA,pch=19,col="gray")
abline(h=0,lty=2)
abline(v=0,lty=2)
as <- subset(a,p.adjustMANOVA<0.05)
points(as$s.LPS , as$s.OVA,pch=19,col="red")

abline(h=0.2,lty=2,col="red")
abline(v=0.2,lty=2,col="red")
abline(h=-0.2,lty=2,col="red")
abline(v=-0.2,lty=2,col="red")

mysets <- c("SEROTONIN NEUROTRANSMITTER RELEASE CYCLE",
  "CLASS C 3 METABOTROPIC GLUTAMATE PHEROMONE RECEPTORS",
  "REGULATION OF COMMISSURAL AXON PATHFINDING BY SLIT AND ROBO",
  "REDUCTION OF CYTOSOLIC CA LEVELS",
  "YAP1 AND WWTR1 TAZ STIMULATED GENE EXPRESSION",
  "ACTIVATION OF THE MRNA UPON BINDING OF THE CAP BINDING COMPLEX AND EIFS AND SUBSEQUENT BINDING TO 43S",
  "REGULATION OF EXPRESSION OF SLITS AND ROBOS")

a2 <- a[which(a$set %in% mysets),]

points(a2$s.LPS , a2$s.OVA+0.025,pch=25,col="red")

dev.off()
## X11cairo 
##        2

Mitch pathway analysis in hippocampus

Mitch for LPS in hip

m3_l <- mitch_import(dge3_l, DEtype="deseq2",geneTable=gt)
## The input is a single dataframe; one contrast only. Converting
##         it to a list for you.
## Note: Mean no. genes in input = 16927
## Note: no. genes in output = 16911
## Note: estimated proportion of input genes in output = 0.999
mres3_l <- mitch_calc(m3_l, genesets, priority="effect")
## Note: Enrichments with large effect sizes may not be
##             statistically significant.
head(mres3_l$enrichment_result,20) %>%
  kbl(caption = "Top gene pathway differences in hip for LPS") %>%
  kable_paper("hover", full_width = F)
Top gene pathway differences in hip for LPS
set setSize pANOVA s.dist p.adjustANOVA
164 COHESIN LOADING ONTO CHROMATIN 10 0.0035266 -0.5328205 0.0606784
1048 SYNTHESIS SECRETION AND INACTIVATION OF GLUCAGON LIKE PEPTIDE 1 GLP 1 12 0.0013981 -0.5326548 0.0382180
438 INCRETIN SYNTHESIS SECRETION AND INACTIVATION 13 0.0011772 -0.5196701 0.0369519
725 POST CHAPERONIN TUBULIN FOLDING PATHWAY 17 0.0002637 0.5110969 0.0172683
191 CROSSLINKING OF COLLAGEN FIBRILS 15 0.0009332 0.4935922 0.0369412
1057 TERMINATION OF O GLYCAN BIOSYNTHESIS 11 0.0051884 0.4867025 0.0775088
737 PROCESSING AND ACTIVATION OF SUMO 10 0.0082053 -0.4827643 0.1012285
66 APOPTOSIS INDUCED DNA FRAGMENTATION 10 0.0082194 -0.4826578 0.1012285
35 ADENYLATE CYCLASE ACTIVATING PATHWAY 10 0.0105880 0.4667889 0.1103673
1131 TRANSPORT OF CONNEXONS TO THE PLASMA MEMBRANE 13 0.0043999 0.4561942 0.0686391
1047 SYNTHESIS SECRETION AND DEACYLATION OF GHRELIN 12 0.0062757 -0.4556483 0.0863827
201 CYTOSOLIC IRON SULFUR CLUSTER ASSEMBLY 13 0.0053223 0.4464069 0.0778381
125 CD28 DEPENDENT VAV1 PATHWAY 11 0.0113946 -0.4406132 0.1128154
26 ACTIVATION OF SMO 16 0.0027889 0.4317624 0.0553052
579 MITOTIC TELOPHASE CYTOKINESIS 13 0.0111915 -0.4063385 0.1119152
1029 SYNTHESIS OF ACTIVE UBIQUITIN ROLES OF E1 AND E2 ENZYMES 29 0.0001730 -0.4029184 0.0144601
537 MET ACTIVATES RAP1 AND RAC1 11 0.0226168 -0.3969984 0.1653851
826 REPRESSION OF WNT TARGET GENES 14 0.0116359 0.3894605 0.1134499
187 CREB1 PHOSPHORYLATION THROUGH THE ACTIVATION OF ADENYLATE CYCLASE 11 0.0266524 -0.3859817 0.1812980
146 CHK1 CHK2 CDS1 MEDIATED INACTIVATION OF CYCLIN B CDK1 COMPLEX 10 0.0352390 -0.3845453 0.2193068
m3_l_top <- subset(mres3_l$enrichment_result,p.adjustANOVA<0.05)
m3_l_up <- subset(m3_l_top,s.dist>0)$set
m3_l_dn <- subset(m3_l_top,s.dist<0)$set
mitch_report(mres3_l,outfile="mitch3_l.html",overwrite=TRUE)
## Note: overwriting existing report
## Dataset saved as " /tmp/RtmpXoIrRA/mitch3_l.rds ".
## 
## 
## processing file: mitch.Rmd
## 1/34                             
## 2/34 [checklibraries]            
## 3/34                             
## 4/34 [peek]                      
## 5/34                             
## 6/34 [metrics]                   
## 7/34                             
## 8/34 [scatterplot]
## 9/34                             
## 10/34 [contourplot]               
## 11/34                             
## 12/34 [input_geneset_metrics1]    
## 13/34                             
## 14/34 [input_geneset_metrics2]
## 15/34                             
## 16/34 [input_geneset_metrics3]
## 17/34                             
## 18/34 [echart1d]                  
## 19/34 [echart2d]                  
## 20/34                             
## 21/34 [heatmap]                   
## 22/34                             
## 23/34 [effectsize]                
## 24/34                             
## 25/34 [results_table]             
## 26/34                             
## 27/34 [results_table_complete]    
## 28/34                             
## 29/34 [detailed_geneset_reports1d]
## 30/34                             
## 31/34 [detailed_geneset_reports2d]
## 32/34                             
## 33/34 [session_info]              
## 34/34
## output file: /home/mark.ziemann@domain.internal.burnet.edu.au/projects/lung_brain/mitch.knit.md
## /usr/bin/pandoc +RTS -K512m -RTS /home/mark.ziemann@domain.internal.burnet.edu.au/projects/lung_brain/mitch.knit.md --to html4 --from markdown+autolink_bare_uris+tex_math_single_backslash --output /tmp/RtmpXoIrRA/mitch_report.html --lua-filter /usr/local/lib/R/site-library/rmarkdown/rmarkdown/lua/pagebreak.lua --lua-filter /usr/local/lib/R/site-library/rmarkdown/rmarkdown/lua/latex-div.lua --self-contained --variable bs3=TRUE --section-divs --template /usr/local/lib/R/site-library/rmarkdown/rmd/h/default.html --no-highlight --variable highlightjs=1 --variable theme=bootstrap --mathjax --variable 'mathjax-url=https://mathjax.rstudio.com/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML' --include-in-header /tmp/RtmpXoIrRA/rmarkdown-str2d12056e6fca29.html
## 
## Output created: /tmp/RtmpXoIrRA/mitch_report.html
## [1] TRUE
write.table(mres3_l$enrichment_result,file="mitch3_l.tsv",quote=FALSE,sep="\t",row.names=FALSE)

m3_l_top_up <- head(subset(m3_l_top,s.dist>0),10)[,"s.dist"]
names(m3_l_top_up) <- head(subset(m3_l_top,s.dist>0),10)[,"set"]
m3_l_top_dn <- head(subset(m3_l_top,s.dist<0),10)[,"s.dist"]
names(m3_l_top_dn) <- head(subset(m3_l_top,s.dist<0),10)[,"set"]
m3_l_top_updn <- c(m3_l_top_up,m3_l_top_dn)
m3_l_top_updn <- m3_l_top_updn[order(m3_l_top_updn)]

par(mar=c(5,25,3,1))
barplot(m3_l_top_updn,horiz=TRUE,las=1,col="darkgray",
  xlab="Enrichment score",cex.names=0.8,xlim=c(-1,1),
  main="Effect of LPS in hip")
grid()

pdf("plot27_mitch3lps01.pdf")
par(mar=c(5,25,3,1))
barplot(m3_l_top_updn,horiz=TRUE,las=1,col="darkgray",
  xlab="Enrichment score",cex.names=0.8,xlim=c(-1,1),
  main="Effect of LPS in hip")
grid()
dev.off()
## X11cairo 
##        2

Mitch for OVA in hip

m3_o <- mitch_import(dge3_o, DEtype="deseq2",geneTable=gt)
## The input is a single dataframe; one contrast only. Converting
##         it to a list for you.
## Note: Mean no. genes in input = 16953
## Note: no. genes in output = 16937
## Note: estimated proportion of input genes in output = 0.999
mres3_o <- mitch_calc(m3_o, genesets, priority="effect")
## Note: Enrichments with large effect sizes may not be
##             statistically significant.
head(mres3_o$enrichment_result,20) %>%
  kbl(caption = "Top gene pathway differences in hip for OVA") %>%
  kable_paper("hover", full_width = F)
Top gene pathway differences in hip for OVA
set setSize pANOVA s.dist p.adjustANOVA
1049 SYNTHESIS SECRETION AND INACTIVATION OF GLUCAGON LIKE PEPTIDE 1 GLP 1 12 0.0000870 -0.6541605 0.0009584
438 INCRETIN SYNTHESIS SECRETION AND INACTIVATION 13 0.0000524 -0.6477738 0.0006203
303 EUKARYOTIC TRANSLATION ELONGATION 87 0.0000000 -0.5747427 0.0000000
371 GENE AND PROTEIN EXPRESSION BY JAK STAT SIGNALING AFTER INTERLEUKIN 12 STIMULATION 31 0.0000001 -0.5550043 0.0000025
28 ACTIVATION OF THE MRNA UPON BINDING OF THE CAP BINDING COMPLEX AND EIFS AND SUBSEQUENT BINDING TO 43S 59 0.0000000 -0.5534213 0.0000000
304 EUKARYOTIC TRANSLATION INITIATION 114 0.0000000 -0.5495588 0.0000000
1007 SRP DEPENDENT COTRANSLATIONAL PROTEIN TARGETING TO MEMBRANE 106 0.0000000 -0.5424032 0.0000000
837 RESPONSE OF EIF2AK4 GCN2 TO AMINO ACID DEFICIENCY 94 0.0000000 -0.5368238 0.0000000
1048 SYNTHESIS SECRETION AND DEACYLATION OF GHRELIN 12 0.0015460 -0.5277991 0.0119103
35 ADENYLATE CYCLASE ACTIVATING PATHWAY 10 0.0048893 0.5139363 0.0301338
1030 SYNTHESIS OF ACTIVE UBIQUITIN ROLES OF E1 AND E2 ENZYMES 29 0.0000034 -0.4984011 0.0000583
171 COMPLEX I BIOGENESIS 56 0.0000000 -0.4948844 0.0000000
125 CD28 DEPENDENT VAV1 PATHWAY 11 0.0049343 -0.4895212 0.0302516
189 CRMPS IN SEMA3A SIGNALING 16 0.0007160 0.4885350 0.0063037
909 SELENOAMINO ACID METABOLISM 109 0.0000000 -0.4832302 0.0000000
66 APOPTOSIS INDUCED DNA FRAGMENTATION 10 0.0090302 -0.4768122 0.0487300
751 PROTEIN METHYLATION 17 0.0007841 -0.4704561 0.0068012
1099 TRAFFICKING AND PROCESSING OF ENDOSOMAL TLR 11 0.0083861 -0.4590248 0.0462996
834 RESPIRATORY ELECTRON TRANSPORT 102 0.0000000 -0.4579034 0.0000000
1058 TERMINATION OF O GLYCAN BIOSYNTHESIS 10 0.0125175 0.4560525 0.0637303
m3_o_top <- subset(mres3_o$enrichment_result,p.adjustANOVA<0.05)
m3_o_up <- subset(m3_o_top,s.dist>0)$set
m3_o_dn <- subset(m3_o_top,s.dist<0)$set
mitch_report(mres3_o,outfile="mitch3_o.html",overwrite=TRUE)
## Note: overwriting existing report
## Dataset saved as " /tmp/RtmpXoIrRA/mitch3_o.rds ".
## 
## 
## processing file: mitch.Rmd
## 1/34                             
## 2/34 [checklibraries]            
## 3/34                             
## 4/34 [peek]                      
## 5/34                             
## 6/34 [metrics]                   
## 7/34                             
## 8/34 [scatterplot]
## 9/34                             
## 10/34 [contourplot]               
## 11/34                             
## 12/34 [input_geneset_metrics1]    
## 13/34                             
## 14/34 [input_geneset_metrics2]
## 15/34                             
## 16/34 [input_geneset_metrics3]
## 17/34                             
## 18/34 [echart1d]                  
## 19/34 [echart2d]                  
## 20/34                             
## 21/34 [heatmap]                   
## 22/34                             
## 23/34 [effectsize]                
## 24/34                             
## 25/34 [results_table]             
## 26/34                             
## 27/34 [results_table_complete]    
## 28/34                             
## 29/34 [detailed_geneset_reports1d]
## 30/34                             
## 31/34 [detailed_geneset_reports2d]
## 32/34                             
## 33/34 [session_info]              
## 34/34
## output file: /home/mark.ziemann@domain.internal.burnet.edu.au/projects/lung_brain/mitch.knit.md
## /usr/bin/pandoc +RTS -K512m -RTS /home/mark.ziemann@domain.internal.burnet.edu.au/projects/lung_brain/mitch.knit.md --to html4 --from markdown+autolink_bare_uris+tex_math_single_backslash --output /tmp/RtmpXoIrRA/mitch_report.html --lua-filter /usr/local/lib/R/site-library/rmarkdown/rmarkdown/lua/pagebreak.lua --lua-filter /usr/local/lib/R/site-library/rmarkdown/rmarkdown/lua/latex-div.lua --self-contained --variable bs3=TRUE --section-divs --template /usr/local/lib/R/site-library/rmarkdown/rmd/h/default.html --no-highlight --variable highlightjs=1 --variable theme=bootstrap --mathjax --variable 'mathjax-url=https://mathjax.rstudio.com/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML' --include-in-header /tmp/RtmpXoIrRA/rmarkdown-str2d120563cf734.html
## 
## Output created: /tmp/RtmpXoIrRA/mitch_report.html
## [1] TRUE
write.table(mres3_o$enrichment_result,file="mitch3_o.tsv",quote=FALSE,sep="\t",row.names=FALSE)

m3_o_top_up <- head(subset(m3_o_top,s.dist>0),10)[,"s.dist"]
names(m3_o_top_up) <- head(subset(m3_o_top,s.dist>0),10)[,"set"]
m3_o_top_dn <- head(subset(m3_o_top,s.dist<0),10)[,"s.dist"]
names(m3_o_top_dn) <- head(subset(m3_o_top,s.dist<0),10)[,"set"]
m3_o_top_updn <- c(m3_o_top_up,m3_o_top_dn)
m3_o_top_updn <- m3_o_top_updn[order(m3_o_top_updn)]

par(mar=c(5,25,3,1))
barplot(m3_o_top_updn,horiz=TRUE,las=1,col="darkgray",
  xlab="Enrichment score",cex.names=0.8,xlim=c(-1,1),
  main="Effect of LPS in hip")
grid()

pdf("plot28_mitch3ova01.pdf")
par(mar=c(5,25,3,1))
barplot(m3_o_top_updn,horiz=TRUE,las=1,col="darkgray",
  xlab="Enrichment score",cex.names=0.8,xlim=c(-1,1),
  main="Effect of LPS in hip")
grid()
dev.off()
## X11cairo 
##        2

Mitch 3 euler.

m3_l_up <- subset(m3_l_top,s.dist>0)$set
m3_l_dn <- subset(m3_l_top,s.dist<0)$set
m3_o_up <- subset(m3_o_top,s.dist>0)$set
m3_o_dn <- subset(m3_o_top,s.dist<0)$set

par(mar=c(2,2,2,2))

v0 <- list("LPS up"=m3_l_up,
  "LPS dn"=m3_l_dn,
  "OVA up"=m3_o_up,
  "OVA dn"=m3_o_dn)
plot(euler(v0),quantities = TRUE, edges = "gray", main="effect of treatments on hip")

pdf("plot29_mitch3lpsovaeuler01.pdf")
plot(euler(v0),quantities = TRUE, edges = "gray", main="effect of treatments on hip")
dev.off()
## X11cairo 
##        2

Two dimensional mitch analysis in hip.

ml <- list("LPS"=dge3_l,"OVA"=dge3_o)
m3 <- mitch_import(ml, DEtype="deseq2",geneTable=gt)
## Note: Mean no. genes in input = 16940
## Note: no. genes in output = 16806
## Note: estimated proportion of input genes in output = 0.992
head(m3)
##                      LPS        OVA
## 0610009B22Rik -3.3814425 -2.2697336
## 0610009E02Rik -0.3557659 -0.3519839
## 0610009L18Rik -0.8507498 -0.9139963
## 0610010K14Rik  1.2510787 -0.1751685
## 0610012G03Rik  3.9729326  0.5678859
## 0610030E20Rik  0.1581737  1.4359134
mres3 <- mitch_calc(m3, genesets, priority="effect")
## Note: Enrichments with large effect sizes may not be 
##             statistically significant.
head(mres3$enrichment_result,20) %>%
  kbl(caption = "Top gene pathway differences in hip for LPS and OVA") %>%
  kable_paper("hover", full_width = F)
Top gene pathway differences in hip for LPS and OVA
set setSize pMANOVA s.LPS s.OVA p.LPS p.OVA s.dist SD p.adjustMANOVA
1048 SYNTHESIS SECRETION AND INACTIVATION OF GLUCAGON LIKE PEPTIDE 1 GLP 1 12 0.0004711 -0.5305962 -0.6525049 0.0014592 0.0000907 0.8410083 0.0862024 0.0034450
438 INCRETIN SYNTHESIS SECRETION AND INACTIVATION 13 0.0002917 -0.5175096 -0.6460613 0.0012342 0.0000549 0.8277750 0.0908998 0.0022450
1047 SYNTHESIS SECRETION AND DEACYLATION OF GHRELIN 12 0.0065634 -0.4546763 -0.5267457 0.0063878 0.0015800 0.6958387 0.0509608 0.0309644
35 ADENYLATE CYCLASE ACTIVATING PATHWAY 10 0.0171862 0.4671231 0.5138724 0.0105326 0.0048948 0.6944558 0.0330567 0.0652851
66 APOPTOSIS INDUCED DNA FRAGMENTATION 10 0.0224696 -0.4819124 -0.4765182 0.0083192 0.0090730 0.6777235 0.0038142 0.0806425
1057 TERMINATION OF O GLYCAN BIOSYNTHESIS 10 0.0215017 0.4988092 0.4559300 0.0063070 0.0125414 0.6757831 0.0303202 0.0781274
125 CD28 DEPENDENT VAV1 PATHWAY 11 0.0181225 -0.4389564 -0.4879645 0.0117076 0.0050733 0.6563475 0.0346540 0.0681779
191 CROSSLINKING OF COLLAGEN FIBRILS 15 0.0041689 0.4936494 0.4063486 0.0009319 0.0064350 0.6393817 0.0617309 0.0213323
1029 SYNTHESIS OF ACTIVE UBIQUITIN ROLES OF E1 AND E2 ENZYMES 29 0.0000216 -0.4019070 -0.4972633 0.0001797 0.0000036 0.6393747 0.0674271 0.0002274
371 GENE AND PROTEIN EXPRESSION BY JAK STAT SIGNALING AFTER INTERLEUKIN 12 STIMULATION 31 0.0000000 -0.2950993 -0.5535638 0.0044644 0.0000001 0.6273089 0.1827620 0.0000005
737 PROCESSING AND ACTIVATION OF SUMO 10 0.0295199 -0.4807692 -0.3557395 0.0084741 0.0514328 0.5980716 0.0884094 0.1001110
26 ACTIVATION OF SMO 16 0.0090898 0.4320057 0.4081596 0.0027736 0.0047046 0.5943258 0.0168617 0.0398317
28 ACTIVATION OF THE MRNA UPON BINDING OF THE CAP BINDING COMPLEX AND EIFS AND SUBSEQUENT BINDING TO 43S 59 0.0000000 -0.2071881 -0.5519440 0.0059283 0.0000000 0.5895499 0.2437792 0.0000000
303 EUKARYOTIC TRANSLATION ELONGATION 87 0.0000000 -0.1277733 -0.5730908 0.0395070 0.0000000 0.5871619 0.3148871 0.0000000
189 CRMPS IN SEMA3A SIGNALING 16 0.0021195 0.3210616 0.4888699 0.0261943 0.0007100 0.5848712 0.1186583 0.0125242
201 CYTOSOLIC IRON SULFUR CLUSTER ASSEMBLY 13 0.0204852 0.4462070 0.3755457 0.0053429 0.0190581 0.5832111 0.0499651 0.0756080
910 SEMA3A PLEXIN REPULSION SIGNALING BY INHIBITING INTEGRIN ADHESION 14 0.0150385 0.3653696 0.4472283 0.0179378 0.0037638 0.5775016 0.0578828 0.0592426
304 EUKARYOTIC TRANSLATION INITIATION 114 0.0000000 -0.1675348 -0.5480796 0.0020155 0.0000000 0.5731135 0.2690858 0.0000000
1006 SRP DEPENDENT COTRANSLATIONAL PROTEIN TARGETING TO MEMBRANE 106 0.0000000 -0.1731850 -0.5408361 0.0020785 0.0000000 0.5678879 0.2599686 0.0000000
146 CHK1 CHK2 CDS1 MEDIATED INACTIVATION OF CYCLIN B CDK1 COMPLEX 10 0.0707565 -0.3833055 -0.4123005 0.0358339 0.0239710 0.5629519 0.0205026 0.1911896
m3_top <- subset(mres3$enrichment_result,p.adjustMANOVA<0.05)
m3_up <- subset(m3_top,s.dist>0)$set
m3_dn <- subset(m3_top,s.dist<0)$set
mitch_report(mres3,outfile="mitch3.html",overwrite=TRUE)
## Note: overwriting existing report
## Dataset saved as " /tmp/RtmpXoIrRA/mitch3.rds ".
## 
## 
## processing file: mitch.Rmd
## 1/34                             
## 2/34 [checklibraries]            
## 3/34                             
## 4/34 [peek]                      
## 5/34                             
## 6/34 [metrics]                   
## 7/34                             
## 8/34 [scatterplot]
## 9/34                             
## 10/34 [contourplot]
## 11/34                             
## 12/34 [input_geneset_metrics1]    
## 13/34                             
## 14/34 [input_geneset_metrics2]
## 15/34                             
## 16/34 [input_geneset_metrics3]
## 17/34                             
## 18/34 [echart1d]                  
## 19/34 [echart2d]                  
## 20/34                             
## 21/34 [heatmap]
## 22/34                             
## 23/34 [effectsize]                
## 24/34                             
## 25/34 [results_table]             
## 26/34                             
## 27/34 [results_table_complete]    
## 28/34                             
## 29/34 [detailed_geneset_reports1d]
## 30/34                             
## 31/34 [detailed_geneset_reports2d]
## 32/34                             
## 33/34 [session_info]              
## 34/34
## output file: /home/mark.ziemann@domain.internal.burnet.edu.au/projects/lung_brain/mitch.knit.md
## /usr/bin/pandoc +RTS -K512m -RTS /home/mark.ziemann@domain.internal.burnet.edu.au/projects/lung_brain/mitch.knit.md --to html4 --from markdown+autolink_bare_uris+tex_math_single_backslash --output /tmp/RtmpXoIrRA/mitch_report.html --lua-filter /usr/local/lib/R/site-library/rmarkdown/rmarkdown/lua/pagebreak.lua --lua-filter /usr/local/lib/R/site-library/rmarkdown/rmarkdown/lua/latex-div.lua --self-contained --variable bs3=TRUE --section-divs --template /usr/local/lib/R/site-library/rmarkdown/rmd/h/default.html --no-highlight --variable highlightjs=1 --variable theme=bootstrap --mathjax --variable 'mathjax-url=https://mathjax.rstudio.com/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML' --include-in-header /tmp/RtmpXoIrRA/rmarkdown-str2d1205d1ea015.html
## 
## Output created: /tmp/RtmpXoIrRA/mitch_report.html
## [1] TRUE
write.table(mres3$enrichment_result,file="mitch3.tsv",quote=FALSE,sep="\t",row.names=FALSE)

m3_top_up <- head(subset(m3_top,s.dist>0),10)[,"s.dist"]
names(m3_top_up) <- head(subset(m3_top,s.dist>0),10)[,"set"]
m3_top_dn <- head(subset(m3_top,s.dist<0),10)[,"s.dist"]
names(m3_top_dn) <- head(subset(m3_top,s.dist<0),10)[,"set"]
m3_top_updn <- c(m3_top_up,m3_top_dn)
m3_top_updn <- m3_top_updn[order(m3_top_updn)]

# heatmap
mr3 <- head(subset(mres3$enrichment_result,p.adjustMANOVA<0.05),30)
mr3 <- as.matrix(mr3[,4:5])
rownames(mr3) <- head(mres3$enrichment_result,30)$set

colfunc <- colorRampPalette(c("blue", "white", "red"))

heatmap.2(mr3,trace="none",col=colfunc(25),scale="none", margins = c(10,28), cexRow=0.7,
  main="Top ranked pathways in hip" , cexCol=0.9 )

pdf("plot30_mitch3_heatmap01.pdf")
heatmap.2(mr3,trace="none",col=colfunc(25),scale="none", margins = c(10,28), cexRow=0.7,
  main="Top ranked pathways in hip" , cexCol=0.9 )
dev.off()
## X11cairo 
##        2

Need to make a scatterplot to highlight the following:

  • Serotonin Neurotransmitter Release Cycle (DN)
  • Class C3 metabotropic glutamate pheromone receptors (DN)
  • Regulation of commissural axon pathfinding by SLIT AND robo (DN)
  • Reduction of Cytosolic Ca (DN)
  • YAP1 and WWTR1 TAZ STIMULATED GENE EXPRESSION (UP)
  • Activation of the mRNA upon binding (UP)
  • Regulation of expression of slits and robs (UP)
par(mar=c(4,4,2,1))

a <- mres3$enrichment_result
plot(a$s.LPS , a$s.OVA,pch=19,col="gray")
abline(h=0,lty=2)
abline(v=0,lty=2)
as <- subset(a,p.adjustMANOVA<0.05)
points(as$s.LPS , as$s.OVA,pch=19,col="red")

abline(h=0.2,lty=2,col="red")
abline(v=0.2,lty=2,col="red")
abline(h=-0.2,lty=2,col="red")
abline(v=-0.2,lty=2,col="red")

mysets <- c("SEROTONIN NEUROTRANSMITTER RELEASE CYCLE",
  "CLASS C 3 METABOTROPIC GLUTAMATE PHEROMONE RECEPTORS",
  "REGULATION OF COMMISSURAL AXON PATHFINDING BY SLIT AND ROBO",
  "REDUCTION OF CYTOSOLIC CA LEVELS",
  "YAP1 AND WWTR1 TAZ STIMULATED GENE EXPRESSION",
  "ACTIVATION OF THE MRNA UPON BINDING OF THE CAP BINDING COMPLEX AND EIFS AND SUBSEQUENT BINDING TO 43S",
  "REGULATION OF EXPRESSION OF SLITS AND ROBOS")

a2 <- a[which(a$set %in% mysets),]

points(a2$s.LPS , a2$s.OVA+0.025,pch=25,col="red")

pdf("plot30b_mitch3_scatter01.pdf")

a <- mres3$enrichment_result
plot(a$s.LPS , a$s.OVA,pch=19,col="gray")
abline(h=0,lty=2)
abline(v=0,lty=2)
as <- subset(a,p.adjustMANOVA<0.05)
points(as$s.LPS , as$s.OVA,pch=19,col="red")

abline(h=0.2,lty=2,col="red")
abline(v=0.2,lty=2,col="red")
abline(h=-0.2,lty=2,col="red")
abline(v=-0.2,lty=2,col="red")

mysets <- c("SEROTONIN NEUROTRANSMITTER RELEASE CYCLE",
  "CLASS C 3 METABOTROPIC GLUTAMATE PHEROMONE RECEPTORS",
  "REGULATION OF COMMISSURAL AXON PATHFINDING BY SLIT AND ROBO",
  "REDUCTION OF CYTOSOLIC CA LEVELS",
  "YAP1 AND WWTR1 TAZ STIMULATED GENE EXPRESSION",
  "ACTIVATION OF THE MRNA UPON BINDING OF THE CAP BINDING COMPLEX AND EIFS AND SUBSEQUENT BINDING TO 43S",
  "REGULATION OF EXPRESSION OF SLITS AND ROBOS")

a2 <- a[which(a$set %in% mysets),]

points(a2$s.LPS , a2$s.OVA+0.025,pch=25,col="red")

dev.off()
## X11cairo 
##        2

Bespoke analysis

As discussed before, could you please generate a Combined Heatmap with total 4 columns (Amygdala and Hippocampus): (common gene sets between these 2 brain regions; these will be (Figure 2A in the paper showing similar directionality); (Figure 2B in the paper showing opposite directionality) (in PDF format).

ml <- list( "amy LPS"=dge2_l,"amy OVA"=dge2_o ,"hip LPS"=dge3_l,"hip OVA"=dge3_o)
m23 <- mitch_import(ml, DEtype="deseq2",geneTable=gt)
## Note: Mean no. genes in input = 16830.5
## Note: no. genes in output = 16173
## Note: estimated proportion of input genes in output = 0.961
head(m23)
##                  amy LPS      amy OVA    hip LPS    hip OVA
## 0610009B22Rik  0.2684894  1.831236577 -3.3814425 -2.2697336
## 0610009E02Rik -0.7521235 -0.103702849 -0.3557659 -0.3519839
## 0610009L18Rik -1.1838923 -0.075637695 -0.8507498 -0.9139963
## 0610010K14Rik -0.0433030  0.417670579  1.2510787 -0.1751685
## 0610012G03Rik -0.1930476  0.008709563  3.9729326  0.5678859
## 0610030E20Rik  1.0496464 -1.609523779  0.1581737  1.4359134
mres23 <- mitch_calc(m23, genesets, priority="effect")
## Note: Enrichments with large effect sizes may not be 
##             statistically significant.
head(mres23$enrichment_result,20) %>%
  kbl(caption = "Top gene pathway differences in amy and hip for LPS and OVA") %>%
  kable_paper("hover", full_width = F)
Top gene pathway differences in amy and hip for LPS and OVA
set setSize pMANOVA s.amy.LPS s.amy.OVA s.hip.LPS s.hip.OVA p.amy.LPS p.amy.OVA p.hip.LPS p.hip.OVA s.dist SD p.adjustMANOVA
301 EUKARYOTIC TRANSLATION ELONGATION 87 0.0000000 0.4431211 0.5128712 -0.1299424 -0.5709998 0.0000000 0.0000000 0.0362948 0.0000000 0.8957226 0.5118777 0.0000000
123 CD28 DEPENDENT VAV1 PATHWAY 10 0.0183799 -0.4087113 0.4065829 -0.4448184 -0.5007115 0.0252268 0.0259970 0.0148650 0.0061109 0.8837024 0.4306646 0.0538435
435 INCRETIN SYNTHESIS SECRETION AND INACTIVATION 13 0.0025031 -0.1326447 0.2766946 -0.5146230 -0.6433264 0.4076831 0.0841302 0.0013145 0.0000590 0.8791246 0.4146734 0.0110268
1043 SYNTHESIS SECRETION AND INACTIVATION OF GLUCAGON LIKE PEPTIDE 1 GLP 1 12 0.0032397 -0.1456902 0.2194274 -0.5278036 -0.6498257 0.3822490 0.1881708 0.0015461 0.0000969 0.8776241 0.3939457 0.0135532
189 CROSSLINKING OF COLLAGEN FIBRILS 13 0.0061351 0.4078065 -0.2607483 0.5699067 0.4334158 0.0109032 0.1035973 0.0003736 0.0068163 0.8642562 0.3724222 0.0237839
1042 SYNTHESIS SECRETION AND DEACYLATION OF GHRELIN 12 0.0124633 -0.0397871 0.4719489 -0.4530660 -0.5257719 0.8114033 0.0046435 0.0065780 0.0016121 0.8402522 0.4587338 0.0394954
1024 SYNTHESIS OF ACTIVE UBIQUITIN ROLES OF E1 AND E2 ENZYMES 29 0.0000035 -0.2155770 0.4927890 -0.4020582 -0.4970738 0.0445440 0.0000044 0.0001787 0.0000036 0.8354924 0.4477170 0.0000344
1092 TRAFFICKING AND PROCESSING OF ENDOSOMAL TLR 11 0.0018248 0.0791981 0.6517983 -0.1981303 -0.4591128 0.6492746 0.0001814 0.2552376 0.0083745 0.8253203 0.4760230 0.0083883
831 RESPONSE OF EIF2AK4 GCN2 TO AMINO ACID DEFICIENCY 94 0.0000000 0.3802462 0.4655696 -0.1529020 -0.5333533 0.0000000 0.0000000 0.0104597 0.0000000 0.8180385 0.4700433 0.0000000
1001 SRP DEPENDENT COTRANSLATIONAL PROTEIN TARGETING TO MEMBRANE 106 0.0000000 0.3245231 0.4885403 -0.1749103 -0.5390799 0.0000000 0.0000000 0.0018767 0.0000000 0.8155903 0.4700120 0.0000000
27 ACTIVATION OF THE MRNA UPON BINDING OF THE CAP BINDING COMPLEX AND EIFS AND SUBSEQUENT BINDING TO 43S 59 0.0000000 0.2704523 0.4778769 -0.2096777 -0.5503983 0.0003281 0.0000000 0.0053593 0.0000000 0.8052415 0.4648940 0.0000000
39 ADP SIGNALLING THROUGH P2Y PURINOCEPTOR 12 19 0.0001492 -0.2219688 0.5421111 -0.3139258 -0.4527736 0.0939762 0.0000429 0.0178499 0.0006338 0.8041816 0.4460399 0.0009968
302 EUKARYOTIC TRANSLATION INITIATION 114 0.0000000 0.3058939 0.4722334 -0.1698681 -0.5466301 0.0000000 0.0000000 0.0017448 0.0000000 0.8026426 0.4630643 0.0000000
169 COMPLEX I BIOGENESIS 56 0.0000000 0.2955575 0.5340767 -0.1501387 -0.4925123 0.0001309 0.0000000 0.0520631 0.0000000 0.7985626 0.4578797 0.0000000
187 CRMPS IN SEMA3A SIGNALING 16 0.0015607 -0.0763291 -0.5108622 0.3177957 0.4846584 0.5971360 0.0004031 0.0277602 0.0007894 0.7763338 0.4438880 0.0073013
533 MET ACTIVATES RAP1 AND RAC1 11 0.0065347 -0.5671890 0.2437480 -0.3921657 -0.2327120 0.0011243 0.1616082 0.0243187 0.1814488 0.7675059 0.3484433 0.0248363
903 SELENOAMINO ACID METABOLISM 107 0.0000000 0.3320346 0.4161793 -0.1438808 -0.4953213 0.0000000 0.0000000 0.0101887 0.0000000 0.7412807 0.4268201 0.0000000
1133 TRIGLYCERIDE CATABOLISM 14 0.0061623 -0.0518950 0.5240512 -0.2593247 -0.4388178 0.7367599 0.0006860 0.0929899 0.0044724 0.7328937 0.4180772 0.0238098
34 ADENYLATE CYCLASE ACTIVATING PATHWAY 10 0.0797587 0.2150096 -0.1373136 0.4596671 0.5097074 0.2391053 0.4521632 0.0118368 0.0052539 0.7322429 0.2955732 0.1573679
1041 SYNTHESIS OF VERY LONG CHAIN FATTY ACYL COAS 20 0.0007316 -0.0064941 0.5334922 -0.3433913 -0.3620813 0.9599084 0.0000362 0.0078527 0.0050620 0.7305317 0.4186141 0.0038325
#mitch_report(mres23,outfile="mitch23.html",overwrite=TRUE)
write.table(mres23$enrichment_result,file="mitch23.tsv",quote=FALSE,sep="\t",row.names=FALSE)

# heatmap
mr23 <- head(subset(mres23$enrichment_result,p.adjustMANOVA<0.05),30)
mr23 <- as.matrix(mr23[,4:7])
rownames(mr23) <- head(mres23$enrichment_result,30)$set

colfunc <- colorRampPalette(c("blue", "white", "red"))

heatmap.2(mr23,trace="none",col=colfunc(25),scale="none", margins = c(10,25), cexRow=0.65,
  main="Top ranked pathways in amy/hip" , cexCol=0.9 )

pdf("plot40_mitch23_heatmap01.pdf")
heatmap.2(mr23,trace="none",col=colfunc(25),scale="none", margins = c(10,25), cexRow=0.65,
  main="Top ranked pathways in amy/hip" , cexCol=0.9 )
dev.off()
## X11cairo 
##        2
# now select 30 sets from mres2 and mres3
n=17
mysets <- union( head(mres2$enrichment_result,n)$set , head(mres3$enrichment_result,n)$set )
mr23 <- mres23$enrichment_result[which(mres23$enrichment_result$set %in% mysets),]
rownames(mr23) <- mr23$set
mr23 <- as.matrix(mr23[,4:7])

heatmap.2(mr23,trace="none",col=colfunc(25),scale="none", margins = c(10,25), cexRow=0.65,
  main="Top ranked pathways in amy/hip" , cexCol=0.9 )

pdf("plot41_mitch23_heatmap01.pdf")
heatmap.2(mr23,trace="none",col=colfunc(25),scale="none", margins = c(10,25), cexRow=0.65,
  main="Top ranked pathways in amy/hip" , cexCol=0.9 )
dev.off()
## X11cairo 
##        2

Discordant analysis.

mres23d <- mitch_calc(m23, genesets, priority="SD")
## Note: Prioritisation by SD after selecting sets with 
##             p.adjustMANOVA<=0.05.
head(mres23d$enrichment_result,20) %>%
  kbl(caption = "Top gene pathway differences in amy and hip for LPS and OVA (discordant)") %>%
  kable_paper("hover", full_width = F)
Top gene pathway differences in amy and hip for LPS and OVA (discordant)
set setSize pMANOVA s.amy.LPS s.amy.OVA s.hip.LPS s.hip.OVA p.amy.LPS p.amy.OVA p.hip.LPS p.hip.OVA s.dist SD p.adjustMANOVA
301 EUKARYOTIC TRANSLATION ELONGATION 87 0.0000000 0.4431211 0.5128712 -0.1299424 -0.5709998 0.0000000 0.0000000 0.0362948 0.0000000 0.8957226 0.5118777 0.0000000
1092 TRAFFICKING AND PROCESSING OF ENDOSOMAL TLR 11 0.0018248 0.0791981 0.6517983 -0.1981303 -0.4591128 0.6492746 0.0001814 0.2552376 0.0083745 0.8253203 0.4760230 0.0083883
831 RESPONSE OF EIF2AK4 GCN2 TO AMINO ACID DEFICIENCY 94 0.0000000 0.3802462 0.4655696 -0.1529020 -0.5333533 0.0000000 0.0000000 0.0104597 0.0000000 0.8180385 0.4700433 0.0000000
1001 SRP DEPENDENT COTRANSLATIONAL PROTEIN TARGETING TO MEMBRANE 106 0.0000000 0.3245231 0.4885403 -0.1749103 -0.5390799 0.0000000 0.0000000 0.0018767 0.0000000 0.8155903 0.4700120 0.0000000
27 ACTIVATION OF THE MRNA UPON BINDING OF THE CAP BINDING COMPLEX AND EIFS AND SUBSEQUENT BINDING TO 43S 59 0.0000000 0.2704523 0.4778769 -0.2096777 -0.5503983 0.0003281 0.0000000 0.0053593 0.0000000 0.8052415 0.4648940 0.0000000
302 EUKARYOTIC TRANSLATION INITIATION 114 0.0000000 0.3058939 0.4722334 -0.1698681 -0.5466301 0.0000000 0.0000000 0.0017448 0.0000000 0.8026426 0.4630643 0.0000000
1042 SYNTHESIS SECRETION AND DEACYLATION OF GHRELIN 12 0.0124633 -0.0397871 0.4719489 -0.4530660 -0.5257719 0.8114033 0.0046435 0.0065780 0.0016121 0.8402522 0.4587338 0.0394954
169 COMPLEX I BIOGENESIS 56 0.0000000 0.2955575 0.5340767 -0.1501387 -0.4925123 0.0001309 0.0000000 0.0520631 0.0000000 0.7985626 0.4578797 0.0000000
1024 SYNTHESIS OF ACTIVE UBIQUITIN ROLES OF E1 AND E2 ENZYMES 29 0.0000035 -0.2155770 0.4927890 -0.4020582 -0.4970738 0.0445440 0.0000044 0.0001787 0.0000036 0.8354924 0.4477170 0.0000344
39 ADP SIGNALLING THROUGH P2Y PURINOCEPTOR 12 19 0.0001492 -0.2219688 0.5421111 -0.3139258 -0.4527736 0.0939762 0.0000429 0.0178499 0.0006338 0.8041816 0.4460399 0.0009968
187 CRMPS IN SEMA3A SIGNALING 16 0.0015607 -0.0763291 -0.5108622 0.3177957 0.4846584 0.5971360 0.0004031 0.0277602 0.0007894 0.7763338 0.4438880 0.0073013
903 SELENOAMINO ACID METABOLISM 107 0.0000000 0.3320346 0.4161793 -0.1438808 -0.4953213 0.0000000 0.0000000 0.0101887 0.0000000 0.7412807 0.4268201 0.0000000
1041 SYNTHESIS OF VERY LONG CHAIN FATTY ACYL COAS 20 0.0007316 -0.0064941 0.5334922 -0.3433913 -0.3620813 0.9599084 0.0000362 0.0078527 0.0050620 0.7305317 0.4186141 0.0038325
1133 TRIGLYCERIDE CATABOLISM 14 0.0061623 -0.0518950 0.5240512 -0.2593247 -0.4388178 0.7367599 0.0006860 0.0929899 0.0044724 0.7328937 0.4180772 0.0238098
828 RESPIRATORY ELECTRON TRANSPORT 102 0.0000000 0.2105839 0.5099833 -0.1124922 -0.4557265 0.0002401 0.0000000 0.0498137 0.0000000 0.7244099 0.4159195 0.0000000
435 INCRETIN SYNTHESIS SECRETION AND INACTIVATION 13 0.0025031 -0.1326447 0.2766946 -0.5146230 -0.6433264 0.4076831 0.0841302 0.0013145 0.0000590 0.8791246 0.4146734 0.0110268
829 RESPIRATORY ELECTRON TRANSPORT ATP SYNTHESIS BY CHEMIOSMOTIC COUPLING AND HEAT PRODUCTION BY UNCOUPLING PROTEINS 125 0.0000000 0.2160100 0.5027657 -0.1003250 -0.4358933 0.0000308 0.0000000 0.0529626 0.0000000 0.7067544 0.4046274 0.0000000
746 PROTEIN METHYLATION 17 0.0027758 0.0034516 0.4506648 -0.2672983 -0.4688406 0.9803463 0.0012955 0.0564109 0.0008176 0.7031149 0.3976960 0.0119567
628 NONSENSE MEDIATED DECAY NMD 109 0.0000000 0.3529506 0.3701638 -0.1350470 -0.4432968 0.0000000 0.0000000 0.0149386 0.0000000 0.6901776 0.3962766 0.0000000
1043 SYNTHESIS SECRETION AND INACTIVATION OF GLUCAGON LIKE PEPTIDE 1 GLP 1 12 0.0032397 -0.1456902 0.2194274 -0.5278036 -0.6498257 0.3822490 0.1881708 0.0015461 0.0000969 0.8776241 0.3939457 0.0135532
# heatmap
mr23d <- head(subset(mres23d$enrichment_result,p.adjustMANOVA<0.05),30)
rownames(mr23d) <- mr23d$set
mr23d <- as.matrix(mr23d[,4:7])

heatmap.2(mr23d,trace="none",col=colfunc(25),scale="none", margins = c(10,25), cexRow=0.65,
  main="Top ranked pathways in amy/hip (discordant)" , cexCol=0.9 )

pdf("plot42_mitch23d_heatmap01.pdf")
heatmap.2(mr23d,trace="none",col=colfunc(25),scale="none", margins = c(10,25), cexRow=0.65,
  main="Top ranked pathways in amy/hip (discordant)" , cexCol=0.9 )
dev.off()
## X11cairo 
##        2
ml2d <- list("LPS"=dge2_l,"OVA"=dge2_o)
m2d <- mitch_import(ml2d, DEtype="deseq2",geneTable=gt)
## Note: Mean no. genes in input = 16721
## Note: no. genes in output = 16550
## Note: estimated proportion of input genes in output = 0.99
mres2d <- mitch_calc(m2d, genesets, priority="SD")
## Note: Prioritisation by SD after selecting sets with 
##             p.adjustMANOVA<=0.05.
head(mres2d$enrichment_result)
##                                                                    set setSize
## 123                                        CD28 DEPENDENT VAV1 PATHWAY      10
## 534                                        MET ACTIVATES RAP1 AND RAC1      11
## 185  CREB1 PHOSPHORYLATION THROUGH THE ACTIVATION OF ADENYLATE CYCLASE      11
## 39                          ADP SIGNALLING THROUGH P2Y PURINOCEPTOR 12      19
## 164                                       COLLAGEN CHAIN TRIMERIZATION      39
## 1027          SYNTHESIS OF ACTIVE UBIQUITIN ROLES OF E1 AND E2 ENZYMES      29
##           pMANOVA      s.LPS      s.OVA        p.LPS        p.OVA    s.dist
## 123  4.559178e-03 -0.4094075  0.4085490 2.497815e-02 2.528380e-02 0.5783829
## 534  1.289999e-03 -0.5676115  0.2448043 1.114620e-03 1.597948e-01 0.6181521
## 185  4.634753e-03 -0.4323170  0.3418202 1.303944e-02 4.965539e-02 0.5511252
## 39   3.061078e-05 -0.2223605  0.5448806 9.339280e-02 3.920153e-05 0.5885058
## 164  9.420970e-09  0.4232656 -0.3400608 4.784541e-06 2.383575e-04 0.5429504
## 1027 1.507292e-06 -0.2160197  0.4954426 4.410379e-02 3.869540e-06 0.5404886
##             SD p.adjustMANOVA
## 123  0.5783826   2.438533e-02
## 534  0.5744647   8.796134e-03
## 185  0.5473976   2.445304e-02
## 39   0.5425214   4.249067e-04
## 164  0.5397533   3.328743e-07
## 1027 0.5030798   3.586739e-05
ml3d <- list("LPS"=dge3_l,"OVA"=dge3_o)
m3d <- mitch_import(ml3d, DEtype="deseq2",geneTable=gt)
## Note: Mean no. genes in input = 16940
## Note: no. genes in output = 16806
## Note: estimated proportion of input genes in output = 0.992
mres3d <- mitch_calc(m3d, genesets, priority="SD")
## Note: Prioritisation by SD after selecting sets with 
##             p.adjustMANOVA<=0.05.
head(mres3d$enrichment_result)
##                                                                     set setSize
## 1131                      TRANSPORT OF CONNEXONS TO THE PLASMA MEMBRANE      13
## 725                             POST CHAPERONIN TUBULIN FOLDING PATHWAY      17
## 367                                               GAP JUNCTION ASSEMBLY      22
## 336              FORMATION OF TUBULIN FOLDING INTERMEDIATES BY CCT TRIC      19
## 303                                   EUKARYOTIC TRANSLATION ELONGATION      87
## 180  COOPERATION OF PREFOLDIN AND TRIC CCT IN ACTIN AND TUBULIN FOLDING      26
##           pMANOVA      s.LPS       s.OVA        p.LPS        p.OVA    s.dist
## 1131 7.127689e-08  0.4559180 -0.09106816 0.0044239280 5.697220e-01 0.4649243
## 725  2.780070e-10  0.5110664 -0.03343576 0.0002639311 8.113842e-01 0.5121590
## 367  1.220899e-10  0.2929142 -0.21280549 0.0174015517 8.404988e-02 0.3620565
## 336  8.405634e-09  0.1601584 -0.32868479 0.2268849761 1.313252e-02 0.3656288
## 303  1.028286e-38 -0.1277733 -0.57309084 0.0395069625 2.338602e-20 0.5871619
## 180  2.520725e-10  0.0277299 -0.41375722 0.8066915685 2.603783e-04 0.4146854
##             SD p.adjustMANOVA
## 1131 0.3867776   1.323714e-06
## 725  0.3850212   9.035226e-09
## 367  0.3575979   4.607908e-09
## 336  0.3456643   2.092466e-07
## 303  0.3148871   4.010316e-36
## 180  0.3121785   8.426423e-09
mysets <- union(head(mres2d$enrichment_result,15)$set , head(mres3d$enrichment_result,15)$set)
mr23d <- mres23d$enrichment_result[mres23d$enrichment_result$set %in% mysets,]
rownames(mr23d) <- mr23d$set
mr23d <- as.matrix(mr23d[,4:7])

heatmap.2(mr23d,trace="none",col=colfunc(25),scale="none", margins = c(10,25), cexRow=0.65,
  main="Top ranked pathways in amy/hip (discordant)" , cexCol=0.9 )

pdf("plot43_mitch23d_heatmap01.pdf")
heatmap.2(mr23d,trace="none",col=colfunc(25),scale="none", margins = c(10,25), cexRow=0.65,
  main="Top ranked pathways in amy/hip (discordant)" , cexCol=0.9 )
dev.off()
## X11cairo 
##        2

Mitch pathway analysis in PAG

Mitch for LPS in pag

m4_l <- mitch_import(dge4_l, DEtype="deseq2",geneTable=gt)
## The input is a single dataframe; one contrast only. Converting
##         it to a list for you.
## Note: Mean no. genes in input = 17612
## Note: no. genes in output = 17595
## Note: estimated proportion of input genes in output = 0.999
mres4_l <- mitch_calc(m4_l, genesets, priority="effect")
## Note: Enrichments with large effect sizes may not be
##             statistically significant.
head(mres4_l$enrichment_result,20) %>%
  kbl(caption = "Top gene pathway differences in pag for LPS") %>%
  kable_paper("hover", full_width = F)
Top gene pathway differences in pag for LPS
set setSize pANOVA s.dist p.adjustANOVA
340 FORMATION OF TUBULIN FOLDING INTERMEDIATES BY CCT TRIC 19 0.0000001 0.7074360 0.0000055
47 ALPHA LINOLENIC OMEGA3 AND LINOLEIC OMEGA6 ACID METABOLISM 12 0.0002635 0.6082675 0.0039925
398 GOLGI CISTERNAE PERICENTRIOLAR STACK REORGANIZATION 12 0.0005667 0.5746554 0.0070265
757 PURINE RIBONUCLEOSIDE MONOPHOSPHATE BIOSYNTHESIS 12 0.0007868 0.5597073 0.0090868
860 RHOBTB3 ATPASE CYCLE 10 0.0024395 0.5534603 0.0211304
1138 TRANSPORT OF CONNEXONS TO THE PLASMA MEMBRANE 13 0.0008345 0.5351540 0.0093622
92 BBSOME MEDIATED CARGO TARGETING TO CILIUM 23 0.0000093 0.5340116 0.0002796
154 CITRIC ACID CYCLE TCA CYCLE 22 0.0000336 0.5107474 0.0008172
655 NUCLEOBASE BIOSYNTHESIS 15 0.0006664 0.5074630 0.0080107
505 KERATAN SULFATE BIOSYNTHESIS 24 0.0000253 0.4966469 0.0006480
182 COPI INDEPENDENT GOLGI TO ER RETROGRADE TRAFFIC 44 0.0000000 0.4935409 0.0000012
180 COOPERATION OF PREFOLDIN AND TRIC CCT IN ACTIN AND TUBULIN FOLDING 26 0.0000252 0.4773268 0.0006480
435 HSP90 CHAPERONE CYCLE FOR STEROID HORMONE RECEPTORS SHR 48 0.0000000 0.4652030 0.0000017
507 KERATAN SULFATE KERATIN METABOLISM 30 0.0000145 0.4573489 0.0004071
110 CALNEXIN CALRETICULIN CYCLE 26 0.0000588 0.4551548 0.0012132
391 GLYCOGEN STORAGE DISEASES 12 0.0064228 0.4543688 0.0422685
371 GAP JUNCTION ASSEMBLY 21 0.0003129 0.4543292 0.0046074
284 ENDOSOMAL VACUOLAR PATHWAY 10 0.0130917 -0.4531362 0.0679385
842 RETROGRADE NEUROTROPHIN SIGNALLING 13 0.0047622 0.4521407 0.0338362
392 GLYCOGEN SYNTHESIS 14 0.0036211 0.4490887 0.0273438
m4_l_top <- subset(mres4_l$enrichment_result,p.adjustANOVA<0.05)
m4_l_up <- subset(m4_l_top,s.dist>0)$set
m4_l_dn <- subset(m4_l_top,s.dist<0)$set
mitch_report(mres4_l,outfile="mitch4_l.html",overwrite=TRUE)
## Note: overwriting existing report
## Dataset saved as " /tmp/RtmpXoIrRA/mitch4_l.rds ".
## 
## 
## processing file: mitch.Rmd
## 1/34                             
## 2/34 [checklibraries]            
## 3/34                             
## 4/34 [peek]                      
## 5/34                             
## 6/34 [metrics]                   
## 7/34                             
## 8/34 [scatterplot]
## 9/34                             
## 10/34 [contourplot]               
## 11/34                             
## 12/34 [input_geneset_metrics1]    
## 13/34                             
## 14/34 [input_geneset_metrics2]
## 15/34                             
## 16/34 [input_geneset_metrics3]
## 17/34                             
## 18/34 [echart1d]                  
## 19/34 [echart2d]                  
## 20/34                             
## 21/34 [heatmap]                   
## 22/34                             
## 23/34 [effectsize]                
## 24/34                             
## 25/34 [results_table]             
## 26/34                             
## 27/34 [results_table_complete]    
## 28/34                             
## 29/34 [detailed_geneset_reports1d]
## 30/34                             
## 31/34 [detailed_geneset_reports2d]
## 32/34                             
## 33/34 [session_info]              
## 34/34
## output file: /home/mark.ziemann@domain.internal.burnet.edu.au/projects/lung_brain/mitch.knit.md
## /usr/bin/pandoc +RTS -K512m -RTS /home/mark.ziemann@domain.internal.burnet.edu.au/projects/lung_brain/mitch.knit.md --to html4 --from markdown+autolink_bare_uris+tex_math_single_backslash --output /tmp/RtmpXoIrRA/mitch_report.html --lua-filter /usr/local/lib/R/site-library/rmarkdown/rmarkdown/lua/pagebreak.lua --lua-filter /usr/local/lib/R/site-library/rmarkdown/rmarkdown/lua/latex-div.lua --self-contained --variable bs3=TRUE --section-divs --template /usr/local/lib/R/site-library/rmarkdown/rmd/h/default.html --no-highlight --variable highlightjs=1 --variable theme=bootstrap --mathjax --variable 'mathjax-url=https://mathjax.rstudio.com/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML' --include-in-header /tmp/RtmpXoIrRA/rmarkdown-str2d12057395eba5.html
## 
## Output created: /tmp/RtmpXoIrRA/mitch_report.html
## [1] TRUE
write.table(mres4_l$enrichment_result,file="mitch4_l.tsv",quote=FALSE,sep="\t",row.names=FALSE)

m4_l_top_up <- head(subset(m4_l_top,s.dist>0),10)[,"s.dist"]
names(m4_l_top_up) <- head(subset(m4_l_top,s.dist>0),10)[,"set"]
m4_l_top_dn <- head(subset(m4_l_top,s.dist<0),10)[,"s.dist"]
names(m4_l_top_dn) <- head(subset(m4_l_top,s.dist<0),10)[,"set"]
m4_l_top_updn <- c(m4_l_top_up,m4_l_top_dn)
m4_l_top_updn <- m4_l_top_updn[order(m4_l_top_updn)]

par(mar=c(5,25,3,1))
barplot(m4_l_top_updn,horiz=TRUE,las=1,col="darkgray",
  xlab="Enrichment score",cex.names=0.8,xlim=c(-1,1),
  main="Effect of LPS in pag")
grid()

pdf("plot31_mitch4lps01.pdf")
par(mar=c(5,25,3,1))
barplot(m4_l_top_updn,horiz=TRUE,las=1,col="darkgray",
  xlab="Enrichment score",cex.names=0.8,xlim=c(-1,1),
  main="Effect of LPS in pag")
grid()
dev.off()
## X11cairo 
##        2

Mitch for OVA in pag

m4_o <- mitch_import(dge4_o, DEtype="deseq2",geneTable=gt)
## The input is a single dataframe; one contrast only. Converting
##         it to a list for you.
## Note: Mean no. genes in input = 17662
## Note: no. genes in output = 17643
## Note: estimated proportion of input genes in output = 0.999
mres4_o <- mitch_calc(m4_o, genesets, priority="effect")
## Note: Enrichments with large effect sizes may not be
##             statistically significant.
head(mres4_o$enrichment_result,20) %>%
  kbl(caption = "Top gene pathway differences in pag for OVA") %>%
  kable_paper("hover", full_width = F)
Top gene pathway differences in pag for OVA
set setSize pANOVA s.dist p.adjustANOVA
154 CITRIC ACID CYCLE TCA CYCLE 22 0.0000462 0.5016845 0.0012106
663 OLFACTORY SIGNALING PATHWAY 37 0.0000001 -0.4989945 0.0000110
1046 SYNTHESIS OF PIPS AT THE LATE ENDOSOME MEMBRANE 11 0.0041951 0.4985357 0.0329455
47 ALPHA LINOLENIC OMEGA3 AND LINOLEIC OMEGA6 ACID METABOLISM 12 0.0030441 0.4940162 0.0257983
757 PURINE RIBONUCLEOSIDE MONOPHOSPHATE BIOSYNTHESIS 12 0.0036144 0.4851398 0.0295722
110 CALNEXIN CALRETICULIN CYCLE 26 0.0000234 0.4791744 0.0007879
293 ER QUALITY CONTROL COMPARTMENT ERQC 21 0.0001581 0.4762121 0.0029771
860 RHOBTB3 ATPASE CYCLE 10 0.0093462 0.4746555 0.0583746
104 BRANCHED CHAIN AMINO ACID CATABOLISM 21 0.0001917 0.4701266 0.0033698
1044 SYNTHESIS OF PIPS AT THE EARLY ENDOSOME MEMBRANE 16 0.0011386 0.4698261 0.0126839
448 INHIBITION OF REPLICATION INITIATION OF DAMAGED DNA BY RB1 E2F1 13 0.0039779 0.4613028 0.0316620
74 ASPARTATE AND ASPARAGINE METABOLISM 10 0.0124484 0.4564056 0.0711801
539 MET ACTIVATES RAP1 AND RAC1 10 0.0132401 0.4524017 0.0732248
92 BBSOME MEDIATED CARGO TARGETING TO CILIUM 23 0.0001740 0.4521640 0.0032034
842 RETROGRADE NEUROTROPHIN SIGNALLING 14 0.0048064 0.4352487 0.0362942
111 CAMK IV MEDIATED PHOSPHORYLATION OF CREB 10 0.0186908 0.4294675 0.0898684
907 SCAVENGING OF HEME FROM PLASMA 11 0.0143530 -0.4263220 0.0758201
1051 SYNTHESIS OF VERY LONG CHAIN FATTY ACYL COAS 20 0.0009820 0.4256710 0.0114298
594 N GLYCAN TRIMMING IN THE ER AND CALNEXIN CALRETICULIN CYCLE 35 0.0000156 0.4219640 0.0005974
1073 THE ROLE OF NEF IN HIV 1 REPLICATION AND DISEASE PATHOGENESIS 27 0.0001875 0.4152959 0.0033468
m4_o_top <- subset(mres4_o$enrichment_result,p.adjustANOVA<0.05)
m4_o_up <- subset(m4_o_top,s.dist>0)$set
m4_o_dn <- subset(m4_o_top,s.dist<0)$set
mitch_report(mres4_o,outfile="mitch4_o.html",overwrite=TRUE)
## Note: overwriting existing report
## Dataset saved as " /tmp/RtmpXoIrRA/mitch4_o.rds ".
## 
## 
## processing file: mitch.Rmd
## 1/34                             
## 2/34 [checklibraries]            
## 3/34                             
## 4/34 [peek]                      
## 5/34                             
## 6/34 [metrics]                   
## 7/34                             
## 8/34 [scatterplot]
## 9/34                             
## 10/34 [contourplot]               
## 11/34                             
## 12/34 [input_geneset_metrics1]    
## 13/34                             
## 14/34 [input_geneset_metrics2]
## 15/34                             
## 16/34 [input_geneset_metrics3]
## 17/34                             
## 18/34 [echart1d]                  
## 19/34 [echart2d]                  
## 20/34                             
## 21/34 [heatmap]                   
## 22/34                             
## 23/34 [effectsize]                
## 24/34                             
## 25/34 [results_table]             
## 26/34                             
## 27/34 [results_table_complete]    
## 28/34                             
## 29/34 [detailed_geneset_reports1d]
## 30/34                             
## 31/34 [detailed_geneset_reports2d]
## 32/34                             
## 33/34 [session_info]              
## 34/34
## output file: /home/mark.ziemann@domain.internal.burnet.edu.au/projects/lung_brain/mitch.knit.md
## /usr/bin/pandoc +RTS -K512m -RTS /home/mark.ziemann@domain.internal.burnet.edu.au/projects/lung_brain/mitch.knit.md --to html4 --from markdown+autolink_bare_uris+tex_math_single_backslash --output /tmp/RtmpXoIrRA/mitch_report.html --lua-filter /usr/local/lib/R/site-library/rmarkdown/rmarkdown/lua/pagebreak.lua --lua-filter /usr/local/lib/R/site-library/rmarkdown/rmarkdown/lua/latex-div.lua --self-contained --variable bs3=TRUE --section-divs --template /usr/local/lib/R/site-library/rmarkdown/rmd/h/default.html --no-highlight --variable highlightjs=1 --variable theme=bootstrap --mathjax --variable 'mathjax-url=https://mathjax.rstudio.com/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML' --include-in-header /tmp/RtmpXoIrRA/rmarkdown-str2d12054998aaf8.html
## 
## Output created: /tmp/RtmpXoIrRA/mitch_report.html
## [1] TRUE
write.table(mres4_o$enrichment_result,file="mitch4_o.tsv",quote=FALSE,sep="\t",row.names=FALSE)

m4_o_top_up <- head(subset(m4_o_top,s.dist>0),10)[,"s.dist"]
names(m4_o_top_up) <- head(subset(m4_o_top,s.dist>0),10)[,"set"]
m4_o_top_dn <- head(subset(m4_o_top,s.dist<0),10)[,"s.dist"]
names(m4_o_top_dn) <- head(subset(m4_o_top,s.dist<0),10)[,"set"]
m4_o_top_updn <- c(m4_o_top_up,m4_o_top_dn)
m4_o_top_updn <- m4_o_top_updn[order(m4_o_top_updn)]

par(mar=c(5,25,3,1))
barplot(m4_o_top_updn,horiz=TRUE,las=1,col="darkgray",
  xlab="Enrichment score",cex.names=0.8,xlim=c(-1,1),
  main="Effect of LPS in pag")
grid()

pdf("plot32_mitch4ova01.pdf")
par(mar=c(5,25,3,1))
barplot(m4_o_top_updn,horiz=TRUE,las=1,col="darkgray",
  xlab="Enrichment score",cex.names=0.8,xlim=c(-1,1),
  main="Effect of LPS in pag")
grid()
dev.off()
## X11cairo 
##        2

Mitch 4 euler.

m4_l_up <- subset(m4_l_top,s.dist>0)$set
m4_l_dn <- subset(m4_l_top,s.dist<0)$set
m4_o_up <- subset(m4_o_top,s.dist>0)$set
m4_o_dn <- subset(m4_o_top,s.dist<0)$set

par(mar=c(2,2,2,2))

v0 <- list("LPS up"=m4_l_up,
  "LPS dn"=m4_l_dn,
  "OVA up"=m4_o_up,
  "OVA dn"=m4_o_dn)
plot(euler(v0),quantities = TRUE, edges = "gray", main="effect of treatments on pag")

pdf("plot33_mitch4lpsovaeuler01.pdf")
plot(euler(v0),quantities = TRUE, edges = "gray", main="effect of treatments on pag")
dev.off()
## X11cairo 
##        2

Two dimensional mitch analysis in pag.

ml <- list("LPS"=dge4_l,"OVA"=dge4_o)
m4 <- mitch_import(ml, DEtype="deseq2",geneTable=gt)
## Note: Mean no. genes in input = 17637
## Note: no. genes in output = 17476
## Note: estimated proportion of input genes in output = 0.991
head(m4)
##                       LPS         OVA
## 0610009B22Rik  0.02592933  0.45655760
## 0610009E02Rik  0.75195906 -0.40699076
## 0610009L18Rik -1.06444668 -0.18691102
## 0610010K14Rik  0.44760852 -0.37114848
## 0610012G03Rik -0.16331991 -0.34216334
## 0610030E20Rik -0.62496606  0.08425395
mres4 <- mitch_calc(m4, genesets, priority="effect")
## Note: Enrichments with large effect sizes may not be 
##             statistically significant.
head(mres4$enrichment_result,20) %>%
  kbl(caption = "Top gene pathway differences in pag for LPS and OVA") %>%
  kable_paper("hover", full_width = F)
Top gene pathway differences in pag for LPS and OVA
set setSize pMANOVA s.LPS s.OVA p.LPS p.OVA s.dist SD p.adjustMANOVA
47 ALPHA LINOLENIC OMEGA3 AND LINOLEIC OMEGA6 ACID METABOLISM 12 0.0009549 0.6081940 0.4942358 0.0002639 0.0030312 0.7836893 0.0805806 0.0082038
340 FORMATION OF TUBULIN FOLDING INTERMEDIATES BY CCT TRIC 19 0.0000002 0.7073410 0.3204717 0.0000001 0.0155966 0.7765523 0.2735580 0.0000098
756 PURINE RIBONUCLEOSIDE MONOPHOSPHATE BIOSYNTHESIS 12 0.0022659 0.5595320 0.4856848 0.0007898 0.0035768 0.7409223 0.0522178 0.0149831
859 RHOBTB3 ATPASE CYCLE 10 0.0072254 0.5533379 0.4748655 0.0024450 0.0093151 0.7291639 0.0554884 0.0333503
154 CITRIC ACID CYCLE TCA CYCLE 22 0.0000358 0.5105941 0.5020834 0.0000338 0.0000456 0.7160964 0.0060180 0.0006567
92 BBSOME MEDIATED CARGO TARGETING TO CILIUM 23 0.0000281 0.5339234 0.4525072 0.0000093 0.0001721 0.6998836 0.0575699 0.0005334
663 OLFACTORY SIGNALING PATHWAY 37 0.0000001 -0.4716936 -0.4985300 0.0000007 0.0000002 0.6863141 0.0189762 0.0000059
110 CALNEXIN CALRETICULIN CYCLE 26 0.0000325 0.4551333 0.4795283 0.0000589 0.0000231 0.6611307 0.0172499 0.0006072
398 GOLGI CISTERNAE PERICENTRIOLAR STACK REORGANIZATION 12 0.0021558 0.5746202 0.2948446 0.0005671 0.0769919 0.6458496 0.1978312 0.0145829
654 NUCLEOBASE BIOSYNTHESIS 15 0.0027383 0.5073287 0.3845942 0.0006686 0.0099118 0.6366280 0.0867864 0.0171302
841 RETROGRADE NEUROTROPHIN SIGNALLING 13 0.0103209 0.4521428 0.4266912 0.0047621 0.0077269 0.6216900 0.0179970 0.0441735
594 N GLYCAN TRIMMING IN THE ER AND CALNEXIN CALRETICULIN CYCLE 35 0.0000130 0.4196925 0.4223595 0.0000173 0.0000153 0.5954237 0.0018858 0.0002888
104 BRANCHED CHAIN AMINO ACID CATABOLISM 21 0.0008159 0.3589175 0.4703387 0.0044101 0.0001904 0.5916420 0.0787867 0.0073827
293 ER QUALITY CONTROL COMPARTMENT ERQC 21 0.0007274 0.3488672 0.4765315 0.0056490 0.0001565 0.5905849 0.0902723 0.0068493
1050 SYNTHESIS OF VERY LONG CHAIN FATTY ACYL COAS 20 0.0020634 0.3972560 0.4259853 0.0021010 0.0009736 0.5824739 0.0203147 0.0142024
516 LDL CLEARANCE 16 0.0078137 0.4372208 0.3651704 0.0024622 0.0114431 0.5696590 0.0509473 0.0351019
182 COPI INDEPENDENT GOLGI TO ER RETROGRADE TRAFFIC 44 0.0000001 0.4935125 0.2800466 0.0000000 0.0013104 0.5674334 0.1509431 0.0000045
395 GLYCOSPHINGOLIPID METABOLISM 38 0.0000156 0.4066286 0.3945376 0.0000144 0.0000257 0.5665746 0.0085496 0.0003227
776 RECEPTOR MEDIATED MITOPHAGY 11 0.0427402 0.4240637 0.3572808 0.0148784 0.0401937 0.5545084 0.0472227 0.1260783
1048 SYNTHESIS OF PYROPHOSPHATES IN THE CYTOSOL 10 0.0622144 0.4138555 0.3594641 0.0234431 0.0490369 0.5481704 0.0384605 0.1607035
m4_top <- subset(mres4$enrichment_result,p.adjustMANOVA<0.05)
m4_up <- subset(m4_top,s.dist>0)$set
m4_dn <- subset(m4_top,s.dist<0)$set
mitch_report(mres4,outfile="mitch4.html",overwrite=TRUE)
## Note: overwriting existing report
## Dataset saved as " /tmp/RtmpXoIrRA/mitch4.rds ".
## 
## 
## processing file: mitch.Rmd
## 1/34                             
## 2/34 [checklibraries]            
## 3/34                             
## 4/34 [peek]                      
## 5/34                             
## 6/34 [metrics]                   
## 7/34                             
## 8/34 [scatterplot]
## 9/34                             
## 10/34 [contourplot]
## 11/34                             
## 12/34 [input_geneset_metrics1]    
## 13/34                             
## 14/34 [input_geneset_metrics2]
## 15/34                             
## 16/34 [input_geneset_metrics3]
## 17/34                             
## 18/34 [echart1d]                  
## 19/34 [echart2d]                  
## 20/34                             
## 21/34 [heatmap]
## 22/34                             
## 23/34 [effectsize]                
## 24/34                             
## 25/34 [results_table]             
## 26/34                             
## 27/34 [results_table_complete]    
## 28/34                             
## 29/34 [detailed_geneset_reports1d]
## 30/34                             
## 31/34 [detailed_geneset_reports2d]
## 32/34                             
## 33/34 [session_info]              
## 34/34
## output file: /home/mark.ziemann@domain.internal.burnet.edu.au/projects/lung_brain/mitch.knit.md
## /usr/bin/pandoc +RTS -K512m -RTS /home/mark.ziemann@domain.internal.burnet.edu.au/projects/lung_brain/mitch.knit.md --to html4 --from markdown+autolink_bare_uris+tex_math_single_backslash --output /tmp/RtmpXoIrRA/mitch_report.html --lua-filter /usr/local/lib/R/site-library/rmarkdown/rmarkdown/lua/pagebreak.lua --lua-filter /usr/local/lib/R/site-library/rmarkdown/rmarkdown/lua/latex-div.lua --self-contained --variable bs3=TRUE --section-divs --template /usr/local/lib/R/site-library/rmarkdown/rmd/h/default.html --no-highlight --variable highlightjs=1 --variable theme=bootstrap --mathjax --variable 'mathjax-url=https://mathjax.rstudio.com/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML' --include-in-header /tmp/RtmpXoIrRA/rmarkdown-str2d1205e09b664.html
## 
## Output created: /tmp/RtmpXoIrRA/mitch_report.html
## [1] TRUE
write.table(mres4$enrichment_result,file="mitch4.tsv",quote=FALSE,sep="\t",row.names=FALSE)

m4_top_up <- head(subset(m4_top,s.dist>0),10)[,"s.dist"]
names(m4_top_up) <- head(subset(m4_top,s.dist>0),10)[,"set"]
m4_top_dn <- head(subset(m4_top,s.dist<0),10)[,"s.dist"]
names(m4_top_dn) <- head(subset(m4_top,s.dist<0),10)[,"set"]
m4_top_updn <- c(m4_top_up,m4_top_dn)
m4_top_updn <- m4_top_updn[order(m4_top_updn)]

# heatmap
mr4 <- head(subset(mres4$enrichment_result,p.adjustMANOVA<0.05),30)
mr4 <- as.matrix(mr4[,4:5])
rownames(mr4) <- head(mres4$enrichment_result,30)$set

colfunc <- colorRampPalette(c("blue", "white", "red"))

heatmap.2(mr4,trace="none",col=colfunc(25),scale="none", margins = c(10,28), cexRow=0.7,
  main="Top ranked pathways in pag" , cexCol=0.9 )

pdf("plot34_mitch4_heatmap01.pdf")
heatmap.2(mr4,trace="none",col=colfunc(25),scale="none", margins = c(10,28), cexRow=0.7,
  main="Top ranked pathways in pag" , cexCol=0.9 )
dev.off()
## X11cairo 
##        2

Need to make a scatterplot to highlight the following:

  • Serotonin Neurotransmitter Release Cycle (DN)
  • Class C3 metabotropic glutamate pheromone receptors (DN)
  • Regulation of commissural axon pathfinding by SLIT AND robo (DN)
  • Reduction of Cytosolic Ca (DN)
  • YAP1 and WWTR1 TAZ STIMULATED GENE EXPRESSION (UP)
  • Activation of the mRNA upon binding (UP)
  • Regulation of expression of slits and robs (UP)
par(mar=c(4,4,2,1))

a <- mres4$enrichment_result
plot(a$s.LPS , a$s.OVA,pch=19,col="gray")
abline(h=0,lty=2)
abline(v=0,lty=2)
as <- subset(a,p.adjustMANOVA<0.05)
points(as$s.LPS , as$s.OVA,pch=19,col="red")

abline(h=0.2,lty=2,col="red")
abline(v=0.2,lty=2,col="red")
abline(h=-0.2,lty=2,col="red")
abline(v=-0.2,lty=2,col="red")

mysets <- c("SEROTONIN NEUROTRANSMITTER RELEASE CYCLE",
  "CLASS C 3 METABOTROPIC GLUTAMATE PHEROMONE RECEPTORS",
  "REGULATION OF COMMISSURAL AXON PATHFINDING BY SLIT AND ROBO",
  "REDUCTION OF CYTOSOLIC CA LEVELS",
  "YAP1 AND WWTR1 TAZ STIMULATED GENE EXPRESSION",
  "ACTIVATION OF THE MRNA UPON BINDING OF THE CAP BINDING COMPLEX AND EIFS AND SUBSEQUENT BINDING TO 43S",
  "REGULATION OF EXPRESSION OF SLITS AND ROBOS")

a2 <- a[which(a$set %in% mysets),]

points(a2$s.LPS , a2$s.OVA+0.025,pch=25,col="red")

pdf("plot34b_mitch4_scatter01.pdf")

a <- mres4$enrichment_result
plot(a$s.LPS , a$s.OVA,pch=19,col="gray")
abline(h=0,lty=2)
abline(v=0,lty=2)
as <- subset(a,p.adjustMANOVA<0.05)
points(as$s.LPS , as$s.OVA,pch=19,col="red")

abline(h=0.2,lty=2,col="red")
abline(v=0.2,lty=2,col="red")
abline(h=-0.2,lty=2,col="red")
abline(v=-0.2,lty=2,col="red")

mysets <- c("SEROTONIN NEUROTRANSMITTER RELEASE CYCLE",
  "CLASS C 3 METABOTROPIC GLUTAMATE PHEROMONE RECEPTORS",
  "REGULATION OF COMMISSURAL AXON PATHFINDING BY SLIT AND ROBO",
  "REDUCTION OF CYTOSOLIC CA LEVELS",
  "YAP1 AND WWTR1 TAZ STIMULATED GENE EXPRESSION",
  "ACTIVATION OF THE MRNA UPON BINDING OF THE CAP BINDING COMPLEX AND EIFS AND SUBSEQUENT BINDING TO 43S",
  "REGULATION OF EXPRESSION OF SLITS AND ROBOS")

a2 <- a[which(a$set %in% mysets),]

points(a2$s.LPS , a2$s.OVA+0.025,pch=25,col="red")

dev.off()
## X11cairo 
##        2

Mitch pathway analysis in NI

Mitch for LPS in NI

m5_l <- mitch_import(dge5_l, DEtype="deseq2",geneTable=gt)
## The input is a single dataframe; one contrast only. Converting
##         it to a list for you.
## Note: Mean no. genes in input = 17490
## Note: no. genes in output = 17472
## Note: estimated proportion of input genes in output = 0.999
mres5_l <- mitch_calc(m5_l, genesets, priority="effect")
## Note: Enrichments with large effect sizes may not be
##             statistically significant.
head(mres5_l$enrichment_result,20) %>%
  kbl(caption = "Top gene pathway differences in NI for LPS") %>%
  kable_paper("hover", full_width = F)
Top gene pathway differences in NI for LPS
set setSize pANOVA s.dist p.adjustANOVA
299 ERYTHROCYTES TAKE UP CARBON DIOXIDE AND RELEASE OXYGEN 10 0.0001404 -0.6952468 0.0015328
35 ADENYLATE CYCLASE ACTIVATING PATHWAY 10 0.0001934 0.6806437 0.0020182
817 REGULATION OF RUNX1 EXPRESSION AND ACTIVITY 17 0.0000628 0.5605911 0.0008046
283 ENDOSOMAL VACUOLAR PATHWAY 10 0.0038749 -0.5274310 0.0255224
1106 TRAFFICKING AND PROCESSING OF ENDOSOMAL TLR 11 0.0028201 -0.5200525 0.0196736
461 INTERACTION BETWEEN L1 AND ANKYRINS 27 0.0000043 0.5109158 0.0000847
843 RETINOID CYCLE DISEASE EVENTS 10 0.0073713 -0.4893483 0.0420834
1035 SYNTHESIS OF ACTIVE UBIQUITIN ROLES OF E1 AND E2 ENZYMES 29 0.0000064 -0.4842354 0.0001120
518 LGI ADAM INTERACTIONS 14 0.0027591 0.4620477 0.0194786
1176 YAP1 AND WWTR1 TAZ STIMULATED GENE EXPRESSION 11 0.0099376 0.4489017 0.0534997
158 CLASS I PEROXISOMAL MEMBRANE PROTEIN IMPORT 20 0.0005149 -0.4485560 0.0048015
679 P75NTR REGULATES AXONOGENESIS 10 0.0152093 -0.4432940 0.0734907
736 PRESYNAPTIC DEPOLARIZATION AND CALCIUM CHANNEL OPENING 11 0.0115089 0.4399988 0.0603067
1069 THE CANONICAL RETINOID CYCLE IN RODS TWILIGHT VISION 15 0.0031735 -0.4399878 0.0213800
216 DEFECTIVE B4GALT7 CAUSES EDS PROGEROID TYPE 20 0.0011205 0.4208629 0.0091739
124 CD28 DEPENDENT VAV1 PATHWAY 11 0.0174696 -0.4138522 0.0814095
893 RORA ACTIVATES GENE EXPRESSION 18 0.0025722 0.4104376 0.0184919
571 MITOCHONDRIAL TRANSLATION 93 0.0000000 -0.4060710 0.0000000
778 RECEPTOR MEDIATED MITOPHAGY 11 0.0200050 -0.4050742 0.0886686
187 CRISTAE FORMATION 31 0.0001034 -0.4028827 0.0012196
m5_l_top <- subset(mres5_l$enrichment_result,p.adjustANOVA<0.05)
m5_l_up <- subset(m5_l_top,s.dist>0)$set
m5_l_dn <- subset(m5_l_top,s.dist<0)$set
mitch_report(mres5_l,outfile="mitch5_l.html",overwrite=TRUE)
## Note: overwriting existing report
## Dataset saved as " /tmp/RtmpXoIrRA/mitch5_l.rds ".
## 
## 
## processing file: mitch.Rmd
## 1/34                             
## 2/34 [checklibraries]            
## 3/34                             
## 4/34 [peek]                      
## 5/34                             
## 6/34 [metrics]                   
## 7/34                             
## 8/34 [scatterplot]
## 9/34                             
## 10/34 [contourplot]               
## 11/34                             
## 12/34 [input_geneset_metrics1]    
## 13/34                             
## 14/34 [input_geneset_metrics2]
## 15/34                             
## 16/34 [input_geneset_metrics3]
## 17/34                             
## 18/34 [echart1d]                  
## 19/34 [echart2d]                  
## 20/34                             
## 21/34 [heatmap]                   
## 22/34                             
## 23/34 [effectsize]                
## 24/34                             
## 25/34 [results_table]             
## 26/34                             
## 27/34 [results_table_complete]    
## 28/34                             
## 29/34 [detailed_geneset_reports1d]
## 30/34                             
## 31/34 [detailed_geneset_reports2d]
## 32/34                             
## 33/34 [session_info]              
## 34/34
## output file: /home/mark.ziemann@domain.internal.burnet.edu.au/projects/lung_brain/mitch.knit.md
## /usr/bin/pandoc +RTS -K512m -RTS /home/mark.ziemann@domain.internal.burnet.edu.au/projects/lung_brain/mitch.knit.md --to html4 --from markdown+autolink_bare_uris+tex_math_single_backslash --output /tmp/RtmpXoIrRA/mitch_report.html --lua-filter /usr/local/lib/R/site-library/rmarkdown/rmarkdown/lua/pagebreak.lua --lua-filter /usr/local/lib/R/site-library/rmarkdown/rmarkdown/lua/latex-div.lua --self-contained --variable bs3=TRUE --section-divs --template /usr/local/lib/R/site-library/rmarkdown/rmd/h/default.html --no-highlight --variable highlightjs=1 --variable theme=bootstrap --mathjax --variable 'mathjax-url=https://mathjax.rstudio.com/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML' --include-in-header /tmp/RtmpXoIrRA/rmarkdown-str2d12055b0e3141.html
## 
## Output created: /tmp/RtmpXoIrRA/mitch_report.html
## [1] TRUE
write.table(mres5_l$enrichment_result,file="mitch5_l.tsv",quote=FALSE,sep="\t",row.names=FALSE)

m5_l_top_up <- head(subset(m5_l_top,s.dist>0),10)[,"s.dist"]
names(m5_l_top_up) <- head(subset(m5_l_top,s.dist>0),10)[,"set"]
m5_l_top_dn <- head(subset(m5_l_top,s.dist<0),10)[,"s.dist"]
names(m5_l_top_dn) <- head(subset(m5_l_top,s.dist<0),10)[,"set"]
m5_l_top_updn <- c(m5_l_top_up,m5_l_top_dn)
m5_l_top_updn <- m5_l_top_updn[order(m5_l_top_updn)]

par(mar=c(5,25,3,1))
barplot(m5_l_top_updn,horiz=TRUE,las=1,col="darkgray",
  xlab="Enrichment score",cex.names=0.8,xlim=c(-1,1),
  main="Effect of LPS in NI")
grid()

pdf("plot35_mitch5lps01.pdf")
par(mar=c(5,25,3,1))
barplot(m5_l_top_updn,horiz=TRUE,las=1,col="darkgray",
  xlab="Enrichment score",cex.names=0.8,xlim=c(-1,1),
  main="Effect of LPS in NI")
grid()
dev.off()
## X11cairo 
##        2

Mitch for OVA in NI

m5_o <- mitch_import(dge5_o, DEtype="deseq2",geneTable=gt)
## The input is a single dataframe; one contrast only. Converting
##         it to a list for you.
## Note: Mean no. genes in input = 17391
## Note: no. genes in output = 17372
## Note: estimated proportion of input genes in output = 0.999
mres5_o <- mitch_calc(m5_o, genesets, priority="effect")
## Note: Enrichments with large effect sizes may not be
##             statistically significant.
head(mres5_o$enrichment_result,20) %>%
  kbl(caption = "Top gene pathway differences in NI for OVA") %>%
  kable_paper("hover", full_width = F)
Top gene pathway differences in NI for OVA
set setSize pANOVA s.dist p.adjustANOVA
818 REGULATION OF RUNX1 EXPRESSION AND ACTIVITY 17 0.0000127 0.6115105 0.0005531
299 ERYTHROCYTES TAKE UP CARBON DIOXIDE AND RELEASE OXYGEN 10 0.0019792 -0.5648888 0.0218082
638 NOTCH2 INTRACELLULAR DOMAIN REGULATES TRANSCRIPTION 11 0.0039453 0.5019139 0.0375124
1106 TRAFFICKING AND PROCESSING OF ENDOSOMAL TLR 11 0.0046893 -0.4923627 0.0428763
36 ADENYLATE CYCLASE ACTIVATING PATHWAY 10 0.0079067 0.4850478 0.0621463
642 NOTCH4 INTRACELLULAR DOMAIN REGULATES TRANSCRIPTION 20 0.0002367 0.4748213 0.0049825
10 ACETYLCHOLINE REGULATES INSULIN SECRETION 10 0.0095369 0.4733902 0.0705829
1 A TETRASACCHARIDE LINKER SEQUENCE IS REQUIRED FOR GAG SYNTHESIS 26 0.0000685 0.4510860 0.0020701
904 RUNX3 REGULATES NOTCH SIGNALING 13 0.0048671 0.4510230 0.0438037
216 DEFECTIVE B4GALT7 CAUSES EDS PROGEROID TYPE 20 0.0005585 0.4457354 0.0089821
635 NOTCH HLH TRANSCRIPTION PATHWAY 28 0.0000499 0.4428538 0.0016334
792 REGULATION OF COMMISSURAL AXON PATHFINDING BY SLIT AND ROBO 10 0.0169507 0.4360673 0.1020708
640 NOTCH3 INTRACELLULAR DOMAIN REGULATES TRANSCRIPTION 23 0.0003451 0.4310811 0.0064397
571 MITOCHONDRIAL TRANSLATION 93 0.0000000 -0.4304927 0.0000000
1036 SYNTHESIS OF ACTIVE UBIQUITIN ROLES OF E1 AND E2 ENZYMES 29 0.0000618 -0.4297411 0.0019189
679 P75NTR REGULATES AXONOGENESIS 10 0.0195647 -0.4263564 0.1125208
1126 TRANSCRIPTIONAL REGULATION OF PLURIPOTENT STEM CELLS 19 0.0013263 0.4254050 0.0162887
1176 YAP1 AND WWTR1 TAZ STIMULATED GENE EXPRESSION 12 0.0140815 0.4093318 0.0913418
188 CRISTAE FORMATION 31 0.0000817 -0.4087851 0.0023080
798 REGULATION OF GENE EXPRESSION IN LATE STAGE BRANCHING MORPHOGENESIS PANCREATIC BUD PRECURSOR CELLS 15 0.0062460 0.4078086 0.0529787
m5_o_top <- subset(mres5_o$enrichment_result,p.adjustANOVA<0.05)
m5_o_up <- subset(m5_o_top,s.dist>0)$set
m5_o_dn <- subset(m5_o_top,s.dist<0)$set
mitch_report(mres5_o,outfile="mitch5_o.html",overwrite=TRUE)
## Note: overwriting existing report
## Dataset saved as " /tmp/RtmpXoIrRA/mitch5_o.rds ".
## 
## 
## processing file: mitch.Rmd
## 1/34                             
## 2/34 [checklibraries]            
## 3/34                             
## 4/34 [peek]                      
## 5/34                             
## 6/34 [metrics]                   
## 7/34                             
## 8/34 [scatterplot]
## 9/34                             
## 10/34 [contourplot]               
## 11/34                             
## 12/34 [input_geneset_metrics1]    
## 13/34                             
## 14/34 [input_geneset_metrics2]
## 15/34                             
## 16/34 [input_geneset_metrics3]
## 17/34                             
## 18/34 [echart1d]                  
## 19/34 [echart2d]                  
## 20/34                             
## 21/34 [heatmap]                   
## 22/34                             
## 23/34 [effectsize]                
## 24/34                             
## 25/34 [results_table]             
## 26/34                             
## 27/34 [results_table_complete]    
## 28/34                             
## 29/34 [detailed_geneset_reports1d]
## 30/34                             
## 31/34 [detailed_geneset_reports2d]
## 32/34                             
## 33/34 [session_info]              
## 34/34
## output file: /home/mark.ziemann@domain.internal.burnet.edu.au/projects/lung_brain/mitch.knit.md
## /usr/bin/pandoc +RTS -K512m -RTS /home/mark.ziemann@domain.internal.burnet.edu.au/projects/lung_brain/mitch.knit.md --to html4 --from markdown+autolink_bare_uris+tex_math_single_backslash --output /tmp/RtmpXoIrRA/mitch_report.html --lua-filter /usr/local/lib/R/site-library/rmarkdown/rmarkdown/lua/pagebreak.lua --lua-filter /usr/local/lib/R/site-library/rmarkdown/rmarkdown/lua/latex-div.lua --self-contained --variable bs3=TRUE --section-divs --template /usr/local/lib/R/site-library/rmarkdown/rmd/h/default.html --no-highlight --variable highlightjs=1 --variable theme=bootstrap --mathjax --variable 'mathjax-url=https://mathjax.rstudio.com/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML' --include-in-header /tmp/RtmpXoIrRA/rmarkdown-str2d120544d4894d.html
## 
## Output created: /tmp/RtmpXoIrRA/mitch_report.html
## [1] TRUE
write.table(mres5_o$enrichment_result,file="mitch5_o.tsv",quote=FALSE,sep="\t",row.names=FALSE)

m5_o_top_up <- head(subset(m5_o_top,s.dist>0),10)[,"s.dist"]
names(m5_o_top_up) <- head(subset(m5_o_top,s.dist>0),10)[,"set"]
m5_o_top_dn <- head(subset(m5_o_top,s.dist<0),10)[,"s.dist"]
names(m5_o_top_dn) <- head(subset(m5_o_top,s.dist<0),10)[,"set"]
m5_o_top_updn <- c(m5_o_top_up,m5_o_top_dn)
m5_o_top_updn <- m5_o_top_updn[order(m5_o_top_updn)]

par(mar=c(5,25,3,1))
barplot(m5_o_top_updn,horiz=TRUE,las=1,col="darkgray",
  xlab="Enrichment score",cex.names=0.8,xlim=c(-1,1),
  main="Effect of LPS in NI")
grid()

pdf("plot36_mitch5ova01.pdf")
par(mar=c(5,25,3,1))
barplot(m5_o_top_updn,horiz=TRUE,las=1,col="darkgray",
  xlab="Enrichment score",cex.names=0.8,xlim=c(-1,1),
  main="Effect of LPS in NI")
grid()
dev.off()
## X11cairo 
##        2

Mitch 5 euler.

m5_l_up <- subset(m5_l_top,s.dist>0)$set
m5_l_dn <- subset(m5_l_top,s.dist<0)$set
m5_o_up <- subset(m5_o_top,s.dist>0)$set
m5_o_dn <- subset(m5_o_top,s.dist<0)$set

par(mar=c(2,2,2,2))

v0 <- list("LPS up"=m5_l_up,
  "LPS dn"=m5_l_dn,
  "OVA up"=m5_o_up,
  "OVA dn"=m5_o_dn)
plot(euler(v0),quantities = TRUE, edges = "gray", main="effect of treatments on NI")

pdf("plot37_mitch5lpsovaeuler01.pdf")
plot(euler(v0),quantities = TRUE, edges = "gray", main="effect of treatments on NI")
dev.off()
## X11cairo 
##        2

Two dimensional mitch analysis in NI.

ml <- list("LPS"=dge5_l,"OVA"=dge5_o)
m5 <- mitch_import(ml, DEtype="deseq2",geneTable=gt)
## Note: Mean no. genes in input = 17440.5
## Note: no. genes in output = 17243
## Note: estimated proportion of input genes in output = 0.989
head(m5)
##                      LPS        OVA
## 0610009B22Rik -2.3583781 -1.1332185
## 0610009E02Rik -0.4921631 -0.3290659
## 0610009L18Rik -1.5061599  0.1306738
## 0610010K14Rik -0.7608005 -0.3126674
## 0610012G03Rik -0.6314820 -0.2034285
## 0610030E20Rik  1.2199694 -0.5747514
mres5 <- mitch_calc(m5, genesets, priority="effect")
## Note: Enrichments with large effect sizes may not be 
##             statistically significant.
head(mres5$enrichment_result,20) %>%
  kbl(caption = "Top gene pathway differences in NI for LPS and OVA") %>%
  kable_paper("hover", full_width = F)
Top gene pathway differences in NI for LPS and OVA
set setSize pMANOVA s.LPS s.OVA p.LPS p.OVA s.dist SD p.adjustMANOVA
298 ERYTHROCYTES TAKE UP CARBON DIOXIDE AND RELEASE OXYGEN 10 0.0006912 -0.6919283 -0.5630941 0.0001511 0.0020458 0.8920985 0.0910995 0.0055982
35 ADENYLATE CYCLASE ACTIVATING PATHWAY 10 0.0008832 0.6843846 0.4864040 0.0001783 0.0077343 0.8396256 0.1399934 0.0066157
815 REGULATION OF RUNX1 EXPRESSION AND ACTIVITY 17 0.0000339 0.5644546 0.6126648 0.0000559 0.0000122 0.8330469 0.0340898 0.0005393
1103 TRAFFICKING AND PROCESSING OF ENDOSOMAL TLR 11 0.0080395 -0.5151937 -0.4900397 0.0030886 0.0048886 0.7110299 0.0177866 0.0365039
1173 YAP1 AND WWTR1 TAZ STIMULATED GENE EXPRESSION 11 0.0135233 0.4523508 0.4933211 0.0093825 0.0046094 0.6693183 0.0289704 0.0542777
1033 SYNTHESIS OF ACTIVE UBIQUITIN ROLES OF E1 AND E2 ENZYMES 29 0.0000262 -0.4800543 -0.4281399 0.0000076 0.0000659 0.6432386 0.0367091 0.0004586
460 INTERACTION BETWEEN L1 AND ANKYRINS 27 0.0000213 0.5153518 0.3664249 0.0000036 0.0009824 0.6323406 0.1053072 0.0003852
215 DEFECTIVE B4GALT7 CAUSES EDS PROGEROID TYPE 20 0.0013404 0.4260233 0.4472856 0.0009726 0.0005342 0.6177057 0.0150347 0.0092710
677 P75NTR REGULATES AXONOGENESIS 10 0.0396662 -0.4389137 -0.4244647 0.0162452 0.0201133 0.6105862 0.0102170 0.1247257
1 A TETRASACCHARIDE LINKER SEQUENCE IS REQUIRED FOR GAG SYNTHESIS 26 0.0002794 0.3813494 0.4526385 0.0007633 0.0000646 0.5918690 0.0504090 0.0028326
569 MITOCHONDRIAL TRANSLATION 93 0.0000000 -0.4005091 -0.4281100 0.0000000 0.0000000 0.5862471 0.0195168 0.0000000
517 LGI ADAM INTERACTIONS 14 0.0104332 0.4661410 0.3505220 0.0025286 0.0231636 0.5832264 0.0817550 0.0446163
633 NOTCH HLH TRANSCRIPTION PATHWAY 28 0.0002287 0.3610307 0.4441019 0.0009447 0.0000475 0.5723370 0.0587402 0.0024673
187 CRISTAE FORMATION 31 0.0001736 -0.3973822 -0.4065768 0.0001285 0.0000893 0.5685220 0.0065016 0.0019825
965 SIGNALING BY LEPTIN 10 0.0613965 0.4015552 0.4020078 0.0278946 0.0277188 0.5682049 0.0003201 0.1686969
339 FORMATION OF TUBULIN FOLDING INTERMEDIATES BY CCT TRIC 19 0.0059592 -0.3916261 -0.3982326 0.0031242 0.0026549 0.5585340 0.0046715 0.0292001
158 CLASS I PEROXISOMAL MEMBRANE PROTEIN IMPORT 20 0.0027132 -0.4439761 -0.3317250 0.0005874 0.0102258 0.5542168 0.0793735 0.0164469
901 RUNX3 REGULATES NOTCH SIGNALING 13 0.0183066 0.3161391 0.4524666 0.0484372 0.0047323 0.5519692 0.0963981 0.0701258
640 NOTCH4 INTRACELLULAR DOMAIN REGULATES TRANSCRIPTION 20 0.0006811 0.2625907 0.4762062 0.0420714 0.0002269 0.5438072 0.1510490 0.0055705
636 NOTCH2 INTRACELLULAR DOMAIN REGULATES TRANSCRIPTION 11 0.0058338 0.2055584 0.5033764 0.2378394 0.0038415 0.5437297 0.2105891 0.0288485
m5_top <- subset(mres5$enrichment_result,p.adjustMANOVA<0.05)
m5_up <- subset(m5_top,s.dist>0)$set
m5_dn <- subset(m5_top,s.dist<0)$set
mitch_report(mres5,outfile="mitch5.html",overwrite=TRUE)
## Note: overwriting existing report
## Dataset saved as " /tmp/RtmpXoIrRA/mitch5.rds ".
## 
## 
## processing file: mitch.Rmd
## 1/34                             
## 2/34 [checklibraries]            
## 3/34                             
## 4/34 [peek]                      
## 5/34                             
## 6/34 [metrics]                   
## 7/34                             
## 8/34 [scatterplot]
## 9/34                             
## 10/34 [contourplot]
## 11/34                             
## 12/34 [input_geneset_metrics1]    
## 13/34                             
## 14/34 [input_geneset_metrics2]
## 15/34                             
## 16/34 [input_geneset_metrics3]
## 17/34                             
## 18/34 [echart1d]                  
## 19/34 [echart2d]                  
## 20/34                             
## 21/34 [heatmap]
## 22/34                             
## 23/34 [effectsize]                
## 24/34                             
## 25/34 [results_table]             
## 26/34                             
## 27/34 [results_table_complete]    
## 28/34                             
## 29/34 [detailed_geneset_reports1d]
## 30/34                             
## 31/34 [detailed_geneset_reports2d]
## 32/34                             
## 33/34 [session_info]              
## 34/34
## output file: /home/mark.ziemann@domain.internal.burnet.edu.au/projects/lung_brain/mitch.knit.md
## /usr/bin/pandoc +RTS -K512m -RTS /home/mark.ziemann@domain.internal.burnet.edu.au/projects/lung_brain/mitch.knit.md --to html4 --from markdown+autolink_bare_uris+tex_math_single_backslash --output /tmp/RtmpXoIrRA/mitch_report.html --lua-filter /usr/local/lib/R/site-library/rmarkdown/rmarkdown/lua/pagebreak.lua --lua-filter /usr/local/lib/R/site-library/rmarkdown/rmarkdown/lua/latex-div.lua --self-contained --variable bs3=TRUE --section-divs --template /usr/local/lib/R/site-library/rmarkdown/rmd/h/default.html --no-highlight --variable highlightjs=1 --variable theme=bootstrap --mathjax --variable 'mathjax-url=https://mathjax.rstudio.com/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML' --include-in-header /tmp/RtmpXoIrRA/rmarkdown-str2d12055f6998fb.html
## 
## Output created: /tmp/RtmpXoIrRA/mitch_report.html
## [1] TRUE
write.table(mres5$enrichment_result,file="mitch5.tsv",quote=FALSE,sep="\t",row.names=FALSE)

m5_top_up <- head(subset(m5_top,s.dist>0),10)[,"s.dist"]
names(m5_top_up) <- head(subset(m5_top,s.dist>0),10)[,"set"]
m5_top_dn <- head(subset(m5_top,s.dist<0),10)[,"s.dist"]
names(m5_top_dn) <- head(subset(m5_top,s.dist<0),10)[,"set"]
m5_top_updn <- c(m5_top_up,m5_top_dn)
m5_top_updn <- m5_top_updn[order(m5_top_updn)]

# heatmap
mr5 <- head(subset(mres5$enrichment_result,p.adjustMANOVA<0.05),30)
mr5 <- as.matrix(mr5[,4:5])
rownames(mr5) <- head(mres5$enrichment_result,30)$set

colfunc <- colorRampPalette(c("blue", "white", "red"))

heatmap.2(mr5,trace="none",col=colfunc(25),scale="none", margins = c(10,28), cexRow=0.7,
  main="Top ranked pathways in NI" , cexCol=0.9 )

pdf("plot37_mitch5_heatmap01.pdf")
heatmap.2(mr5,trace="none",col=colfunc(25),scale="none", margins = c(10,28), cexRow=0.7,
  main="Top ranked pathways in NI" , cexCol=0.9 )
dev.off()
## X11cairo 
##        2

Need to make a scatterplot to highlight the following:

  • Serotonin Neurotransmitter Release Cycle (DN)
  • Class C3 metabotropic glutamate pheromone receptors (DN)
  • Regulation of commissural axon pathfinding by SLIT AND robo (DN)
  • Reduction of Cytosolic Ca (DN)
  • YAP1 and WWTR1 TAZ STIMULATED GENE EXPRESSION (UP)
  • Activation of the mRNA upon binding (UP)
  • Regulation of expression of slits and robs (UP)
par(mar=c(4,4,2,1))

a <- mres5$enrichment_result
plot(a$s.LPS , a$s.OVA,pch=19,col="gray")
abline(h=0,lty=2)
abline(v=0,lty=2)
as <- subset(a,p.adjustMANOVA<0.05)
points(as$s.LPS , as$s.OVA,pch=19,col="red")

abline(h=0.2,lty=2,col="red")
abline(v=0.2,lty=2,col="red")
abline(h=-0.2,lty=2,col="red")
abline(v=-0.2,lty=2,col="red")

mysets <- c("SEROTONIN NEUROTRANSMITTER RELEASE CYCLE",
  "CLASS C 3 METABOTROPIC GLUTAMATE PHEROMONE RECEPTORS",
  "REGULATION OF COMMISSURAL AXON PATHFINDING BY SLIT AND ROBO",
  "REDUCTION OF CYTOSOLIC CA LEVELS",
  "YAP1 AND WWTR1 TAZ STIMULATED GENE EXPRESSION",
  "ACTIVATION OF THE MRNA UPON BINDING OF THE CAP BINDING COMPLEX AND EIFS AND SUBSEQUENT BINDING TO 43S",
  "REGULATION OF EXPRESSION OF SLITS AND ROBOS")

a2 <- a[which(a$set %in% mysets),]

points(a2$s.LPS , a2$s.OVA+0.025,pch=25,col="red")

pdf("plot37b_mitch5_scatter01.pdf")

a <- mres5$enrichment_result
plot(a$s.LPS , a$s.OVA,pch=19,col="gray")
abline(h=0,lty=2)
abline(v=0,lty=2)
as <- subset(a,p.adjustMANOVA<0.05)
points(as$s.LPS , as$s.OVA,pch=19,col="red")

abline(h=0.2,lty=2,col="red")
abline(v=0.2,lty=2,col="red")
abline(h=-0.2,lty=2,col="red")
abline(v=-0.2,lty=2,col="red")

mysets <- c("SEROTONIN NEUROTRANSMITTER RELEASE CYCLE",
  "CLASS C 3 METABOTROPIC GLUTAMATE PHEROMONE RECEPTORS",
  "REGULATION OF COMMISSURAL AXON PATHFINDING BY SLIT AND ROBO",
  "REDUCTION OF CYTOSOLIC CA LEVELS",
  "YAP1 AND WWTR1 TAZ STIMULATED GENE EXPRESSION",
  "ACTIVATION OF THE MRNA UPON BINDING OF THE CAP BINDING COMPLEX AND EIFS AND SUBSEQUENT BINDING TO 43S",
  "REGULATION OF EXPRESSION OF SLITS AND ROBOS")

a2 <- a[which(a$set %in% mysets),]

points(a2$s.LPS , a2$s.OVA+0.025,pch=25,col="red")

dev.off()
## X11cairo 
##        2

Mitch pathway analysis - LPS all tissues

ml <- list("hyp"=dge1_l,
  "amy"=dge2_l,
  "hip"=dge3_l,
  "pag"=dge4_l,
  "ni"=dge5_l)

m6 <- mitch_import(ml, DEtype="deseq2",geneTable=gt)
## Note: Mean no. genes in input = 17188.4
## Note: no. genes in output = 15915
## Note: estimated proportion of input genes in output = 0.926
head(m6)
##                      hyp        amy        hip         pag         ni
## 0610009B22Rik -0.3304181  0.2684894 -3.3814425  0.02592933 -2.3583781
## 0610009E02Rik  0.7596333 -0.7521235 -0.3557659  0.75195906 -0.4921631
## 0610009L18Rik -1.2521412 -1.1838923 -0.8507498 -1.06444668 -1.5061599
## 0610010K14Rik  0.4193627 -0.0433030  1.2510787  0.44760852 -0.7608005
## 0610012G03Rik  1.4462155 -0.1930476  3.9729326 -0.16331991 -0.6314820
## 0610030E20Rik -0.2426628  1.0496464  0.1581737 -0.62496606  1.2199694
mres6 <- mitch_calc(m6, genesets, priority="effect")
## Note: Enrichments with large effect sizes may not be 
##             statistically significant.
head(mres6$enrichment_result,20) %>%
  kbl(caption = "Top gene pathway differences in all tissues caused by LPS") %>%
  kable_paper("hover", full_width = F)
Top gene pathway differences in all tissues caused by LPS
set setSize pMANOVA s.hyp s.amy s.hip s.pag s.ni p.hyp p.amy p.hip p.pag p.ni s.dist SD p.adjustMANOVA
332 FORMATION OF TUBULIN FOLDING INTERMEDIATES BY CCT TRIC 19 0.0000000 0.5822981 0.1560604 0.1544778 0.6954282 -0.3831086 0.0000111 0.2390119 0.2438091 0.0000002 0.0038422 1.0088022 0.4263806 0.0000000
1118 TRANSPORT OF CONNEXONS TO THE PLASMA MEMBRANE 13 0.0000172 0.5932587 0.3167091 0.4489131 0.5229821 -0.1372928 0.0002123 0.0480410 0.0050717 0.0010947 0.3914527 0.9726989 0.2904471 0.0001274
713 POST CHAPERONIN TUBULIN FOLDING PATHWAY 17 0.0000011 0.6304012 0.3165696 0.5031487 0.3588317 -0.0845537 0.0000068 0.0238489 0.0003285 0.0104292 0.5461975 0.9416422 0.2701762 0.0000103
33 ADENYLATE CYCLASE ACTIVATING PATHWAY 10 0.0001895 -0.0885130 0.2080981 0.4568626 0.1617730 0.6787300 0.6279478 0.2545465 0.0123633 0.3757629 0.0002017 0.8641225 0.2937507 0.0010897
187 CROSSLINKING OF COLLAGEN FIBRILS 13 0.0176921 0.3352167 0.4013815 0.5673500 0.0343160 0.3112526 0.0363892 0.0122225 0.0003970 0.8303920 0.0520234 0.8327179 0.1931567 0.0513870
529 MET ACTIVATES RAP1 AND RAC1 10 0.0643591 -0.3637598 -0.5405218 -0.3609557 0.1325244 -0.3218736 0.0464000 0.0030783 0.0481117 0.4680921 0.0780071 0.8221553 0.2513837 0.1385459
894 SEALING OF THE NUCLEAR ENVELOPE NE BY ESCRT III 23 0.0000005 0.5136082 0.2585605 0.3151818 0.4227229 -0.1673689 0.0000201 0.0318571 0.0088894 0.0004493 0.1647725 0.7979308 0.2627367 0.0000051
121 CD28 DEPENDENT VAV1 PATHWAY 11 0.0258854 -0.1266805 -0.3171529 -0.4384374 0.3943090 -0.3997393 0.4669677 0.0685724 0.0118086 0.0235523 0.0217020 0.7900206 0.3415149 0.0688096
197 CYTOSOLIC IRON SULFUR CLUSTER ASSEMBLY 13 0.0168848 0.4101661 0.4163192 0.4380001 -0.1403307 0.1677970 0.0104521 0.0093517 0.0062513 0.3810580 0.2949153 0.7623979 0.2487080 0.0497928
23 ACTIVATION OF RAC1 13 0.0212681 -0.2226909 -0.5011464 -0.3742829 0.2291923 -0.2883237 0.1645079 0.0017563 0.0194674 0.1525294 0.0718929 0.7592669 0.2777769 0.0595302
183 CREB1 PHOSPHORYLATION THROUGH THE ACTIVATION OF ADENYLATE CYCLASE 11 0.0165002 -0.3770464 -0.4368026 -0.3853576 0.2699721 -0.1381013 0.0303718 0.0121271 0.0269016 0.1210762 0.4277760 0.7572436 0.2939289 0.0489082
362 GAP JUNCTION ASSEMBLY 21 0.0000215 0.4383205 0.2261770 0.3196414 0.4386261 -0.1332758 0.0005068 0.0728149 0.0112300 0.0005022 0.2904745 0.7453904 0.2361410 0.0001543
1017 SYNTHESIS OF ACTIVE UBIQUITIN ROLES OF E1 AND E2 ENZYMES 29 0.0000107 -0.0487395 -0.2218696 -0.4021107 0.3229302 -0.4740934 0.6497113 0.0386822 0.0001784 0.0026164 0.0000099 0.7364395 0.3188207 0.0000838
176 COOPERATION OF PREFOLDIN AND TRIC CCT IN ACTIN AND TUBULIN FOLDING 26 0.0000000 0.3865374 0.1647584 0.0234463 0.4606525 -0.3842862 0.0006464 0.1459874 0.8360982 0.0000479 0.0006951 0.7327911 0.3362270 0.0000003
44 ALPHA LINOLENIC OMEGA3 AND LINOLEIC OMEGA6 ACID METABOLISM 12 0.0022441 0.1522040 0.3667128 0.0551468 0.5905490 0.0984091 0.3613373 0.0278466 0.7408478 0.0003965 0.5550640 0.7204984 0.2236477 0.0092648
139 CGMP EFFECTS 15 0.0036952 -0.5596059 -0.3016688 -0.2268931 -0.2410482 0.0180126 0.0001749 0.0431069 0.1281937 0.1060559 0.9038767 0.7169881 0.2062893 0.0141446
772 REDUCTION OF CYTOSOLIC CA LEVELS 11 0.0184747 -0.5541888 -0.3045317 -0.1996639 -0.2657879 0.0578014 0.0014589 0.0803353 0.2515805 0.1269492 0.7399623 0.7167389 0.2196449 0.0528678
1036 SYNTHESIS SECRETION AND INACTIVATION OF GLUCAGON LIKE PEPTIDE 1 GLP 1 12 0.0193904 -0.1096229 -0.1519944 -0.5266616 0.0253097 -0.4451676 0.5108965 0.3619990 0.0015830 0.8793534 0.0075831 0.7150571 0.2341943 0.0550744
680 PHASE 2 PLATEAU PHASE 10 0.1065986 0.1580384 0.1611443 0.3954228 -0.1847972 0.5066709 0.3868841 0.3776212 0.0303778 0.3116361 0.0055304 0.7058103 0.2661346 0.1980249
725 PROCESSING AND ACTIVATION OF SUMO 10 0.0314881 0.0185728 -0.2963722 -0.4768186 0.2293996 -0.3574348 0.9190048 0.1046478 0.0090305 0.2091121 0.0503357 0.7042167 0.2915930 0.0794765
m6_top <- subset(mres6$enrichment_result,p.adjustMANOVA<0.05)
m6_up <- subset(m6_top,s.dist>0)$set
m6_dn <- subset(m6_top,s.dist<0)$set
mitch_report(mres6,outfile="mitch6.html",overwrite=TRUE)
## Note: overwriting existing report
## Dataset saved as " /tmp/RtmpXoIrRA/mitch6.rds ".
## 
## 
## processing file: mitch.Rmd
## 1/34                             
## 2/34 [checklibraries]            
## 3/34                             
## 4/34 [peek]                      
## 5/34                             
## 6/34 [metrics]                   
## 7/34                             
## 8/34 [scatterplot]
## 9/34                             
## 10/34 [contourplot]
## 11/34                             
## 12/34 [input_geneset_metrics1]    
## 13/34                             
## 14/34 [input_geneset_metrics2]
## 15/34                             
## 16/34 [input_geneset_metrics3]    
## 17/34                             
## 18/34 [echart1d]                  
## 19/34 [echart2d]                  
## 20/34                             
## 21/34 [heatmap]
## 22/34                             
## 23/34 [effectsize]                
## 24/34                             
## 25/34 [results_table]             
## 26/34                             
## 27/34 [results_table_complete]    
## 28/34                             
## 29/34 [detailed_geneset_reports1d]
## 30/34                             
## 31/34 [detailed_geneset_reports2d]
## 32/34                             
## 33/34 [session_info]              
## 34/34
## output file: /home/mark.ziemann@domain.internal.burnet.edu.au/projects/lung_brain/mitch.knit.md
## /usr/bin/pandoc +RTS -K512m -RTS /home/mark.ziemann@domain.internal.burnet.edu.au/projects/lung_brain/mitch.knit.md --to html4 --from markdown+autolink_bare_uris+tex_math_single_backslash --output /tmp/RtmpXoIrRA/mitch_report.html --lua-filter /usr/local/lib/R/site-library/rmarkdown/rmarkdown/lua/pagebreak.lua --lua-filter /usr/local/lib/R/site-library/rmarkdown/rmarkdown/lua/latex-div.lua --self-contained --variable bs3=TRUE --section-divs --template /usr/local/lib/R/site-library/rmarkdown/rmd/h/default.html --no-highlight --variable highlightjs=1 --variable theme=bootstrap --mathjax --variable 'mathjax-url=https://mathjax.rstudio.com/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML' --include-in-header /tmp/RtmpXoIrRA/rmarkdown-str2d12057dbe2812.html
## 
## Output created: /tmp/RtmpXoIrRA/mitch_report.html
## [1] TRUE
write.table(mres6$enrichment_result,file="mitch6.tsv",quote=FALSE,sep="\t",row.names=FALSE)

m6_top_up <- head(subset(m6_top,s.dist>0),10)[,"s.dist"]
names(m6_top_up) <- head(subset(m6_top,s.dist>0),10)[,"set"]
m6_top_dn <- head(subset(m6_top,s.dist<0),10)[,"s.dist"]
names(m6_top_dn) <- head(subset(m6_top,s.dist<0),10)[,"set"]
m6_top_updn <- c(m6_top_up,m6_top_dn)
m6_top_updn <- m6_top_updn[order(m6_top_updn)]

# heatmap
mr6 <- head(subset(mres6$enrichment_result,p.adjustMANOVA<0.05),30)
mr6 <- as.matrix(mr6[,4:8])
rownames(mr6) <- head(mres6$enrichment_result,30)$set

colfunc <- colorRampPalette(c("blue", "white", "red"))

heatmap.2(mr6,trace="none",col=colfunc(25),scale="none", margins = c(10,21), cexRow=0.7,
  main="Top ranked pathways LPS all tissues" , cexCol=0.9 )

pdf("plot38_mitch6_heatmap01.pdf")
heatmap.2(mr6,trace="none",col=colfunc(25),scale="none", margins = c(10,21), cexRow=0.7,
  main="Top ranked pathways LPS all tissues" , cexCol=0.9 )
dev.off()
## X11cairo 
##        2

Mitch pathway analysis - OVA all tissues

ml <- list("hyp"=dge1_o,
  "amy"=dge2_o,
  "hip"=dge3_o,
  "pag"=dge4_o,
  "ni"=dge5_o)

m7 <- mitch_import(ml, DEtype="deseq2",geneTable=gt)
## Note: Mean no. genes in input = 17148.8
## Note: no. genes in output = 15857
## Note: estimated proportion of input genes in output = 0.925
head(m7)
##                       hyp          amy        hip         pag         ni
## 0610009B22Rik  0.09722066  1.831236577 -2.2697336  0.45655760 -1.1332185
## 0610009E02Rik  1.26326253 -0.103702849 -0.3519839 -0.40699076 -0.3290659
## 0610009L18Rik -0.66374969 -0.075637695 -0.9139963 -0.18691102  0.1306738
## 0610010K14Rik -0.45368981  0.417670579 -0.1751685 -0.37114848 -0.3126674
## 0610012G03Rik  0.12236243  0.008709563  0.5678859 -0.34216334 -0.2034285
## 0610030E20Rik -0.04562294 -1.609523779  1.4359134  0.08425395 -0.5747514
mres7 <- mitch_calc(m7, genesets, priority="effect")
## Note: Enrichments with large effect sizes may not be 
##             statistically significant.
head(mres7$enrichment_result,20) %>%
  kbl(caption = "Top gene pathway differences in all tissues caused by OVA") %>%
  kable_paper("hover", full_width = F)
Top gene pathway differences in all tissues caused by OVA
set setSize pMANOVA s.hyp s.amy s.hip s.pag s.ni p.hyp p.amy p.hip p.pag p.ni s.dist SD p.adjustMANOVA
301 EUKARYOTIC TRANSLATION ELONGATION 87 0.0000000 0.7589618 0.5066407 -0.5680187 -0.3419354 -0.0058543 0.0000000 0.0000000 0.0000000 0.0000000 0.9248618 1.1279660 0.5585329 0.0000000
998 SRP DEPENDENT COTRANSLATIONAL PROTEIN TARGETING TO MEMBRANE 106 0.0000000 0.6788859 0.4823198 -0.5362547 -0.2520128 -0.0296836 0.0000000 0.0000000 0.0000000 0.0000075 0.5978299 1.0224867 0.5054489 0.0000000
828 RESPONSE OF EIF2AK4 GCN2 TO AMINO ACID DEFICIENCY 94 0.0000000 0.6581896 0.4594290 -0.5305233 -0.3406766 -0.0378020 0.0000000 0.0000000 0.0000000 0.0000000 0.5268168 1.0213878 0.5085589 0.0000000
169 COMPLEX I BIOGENESIS 56 0.0000000 0.5241712 0.5287437 -0.4899260 -0.3224140 -0.3640163 0.0000000 0.0000000 0.0000000 0.0000301 0.0000025 1.0152889 0.5068935 0.0000000
302 EUKARYOTIC TRANSLATION INITIATION 114 0.0000000 0.6324738 0.4659147 -0.5439800 -0.2324542 -0.0823825 0.0000000 0.0000000 0.0000000 0.0000183 0.1290224 0.9868311 0.4904989 0.0000000
325 FORMATION OF ATP BY CHEMIOSMOTIC COUPLING 18 0.0000007 0.5447384 0.4759279 -0.4188887 -0.2661504 -0.3880436 0.0000630 0.0004727 0.0020933 0.0506243 0.0043713 0.9592335 0.4794735 0.0000085
27 ACTIVATION OF THE MRNA UPON BINDING OF THE CAP BINDING COMPLEX AND EIFS AND SUBSEQUENT BINDING TO 43S 59 0.0000000 0.5884482 0.4718018 -0.5477222 -0.1011756 -0.1302289 0.0000000 0.0000000 0.0000000 0.1791165 0.0837551 0.9466066 0.4691103 0.0000000
825 RESPIRATORY ELECTRON TRANSPORT 102 0.0000000 0.4633350 0.5045569 -0.4531907 -0.2711545 -0.3776604 0.0000000 0.0000000 0.0000000 0.0000023 0.0000000 0.9438172 0.4709548 0.0000000
782 REGULATION OF COMMISSURAL AXON PATHFINDING BY SLIT AND ROBO 10 0.0011474 -0.6280684 -0.3112261 0.4452199 0.0986054 0.4318925 0.0005831 0.0883696 0.0147754 0.5892841 0.0180374 0.9411729 0.4705160 0.0056398
1089 TRAFFICKING AND PROCESSING OF ENDOSOMAL TLR 11 0.0032586 0.0865030 0.6471722 -0.4574484 0.0249905 -0.4886464 0.6193918 0.0002016 0.0086139 0.8858964 0.0050127 0.9354002 0.4658185 0.0130794
826 RESPIRATORY ELECTRON TRANSPORT ATP SYNTHESIS BY CHEMIOSMOTIC COUPLING AND HEAT PRODUCTION BY UNCOUPLING PROTEINS 125 0.0000000 0.4663422 0.4972713 -0.4334727 -0.2415601 -0.3587643 0.0000000 0.0000000 0.0000000 0.0000032 0.0000000 0.9163599 0.4579111 0.0000000
72 ASPARTATE AND ASPARAGINE METABOLISM 10 0.0010490 -0.3787720 0.5353190 -0.1915694 0.4259229 -0.3954692 0.0380846 0.0033754 0.2942364 0.0196925 0.0303586 0.8969613 0.4484795 0.0052225
900 SELENOAMINO ACID METABOLISM 107 0.0000000 0.5894140 0.4100187 -0.4926794 -0.2055885 -0.0288468 0.0000000 0.0000000 0.0000000 0.0002412 0.6065202 0.8951849 0.4434311 0.0000000
806 REGULATION OF RUNX1 EXPRESSION AND ACTIVITY 17 0.0004842 0.0136289 -0.3895499 0.4433526 -0.2127748 0.6068627 0.9225118 0.0054263 0.0015523 0.1288539 0.0000147 0.8729559 0.4241025 0.0026370
1021 SYNTHESIS OF ACTIVE UBIQUITIN ROLES OF E1 AND E2 ENZYMES 29 0.0000044 0.2195237 0.4863751 -0.4949936 0.1092215 -0.4279845 0.0407878 0.0000058 0.0000040 0.3087943 0.0000664 0.8513930 0.4250128 0.0000443
1158 YAP1 AND WWTR1 TAZ STIMULATED GENE EXPRESSION 10 0.0026988 0.6409415 0.0983909 0.2452578 0.0289519 0.4780211 0.0004483 0.5900946 0.1793235 0.8740523 0.0088582 0.8426034 0.2574046 0.0113426
186 CRISTAE FORMATION 31 0.0000001 0.3865342 0.4230645 -0.4353065 -0.1600837 -0.4057105 0.0001957 0.0000457 0.0000273 0.1230208 0.0000925 0.8414938 0.4185622 0.0000007
152 CITRIC ACID CYCLE TCA CYCLE 22 0.0000386 0.0475357 0.4875621 -0.3250050 0.4738583 -0.3608462 0.6995825 0.0000753 0.0083248 0.0001193 0.0033933 0.8368729 0.4121520 0.0003108
625 NONSENSE MEDIATED DECAY NMD 109 0.0000000 0.5292345 0.3641959 -0.4407689 -0.2887520 -0.0092442 0.0000000 0.0000000 0.0000000 0.0000002 0.8677037 0.8309442 0.4140302 0.0000000
1109 TRANSCRIPTIONAL REGULATION OF PLURIPOTENT STEM CELLS 15 0.0000156 0.3655599 0.4782561 0.0412911 0.3561587 0.4263351 0.0142409 0.0013413 0.7819057 0.0169366 0.0042534 0.8201698 0.1706605 0.0001396
m7_top <- subset(mres7$enrichment_result,p.adjustMANOVA<0.05)
m7_up <- subset(m7_top,s.dist>0)$set
m7_dn <- subset(m7_top,s.dist<0)$set
mitch_report(mres7,outfile="mitch7.html",overwrite=TRUE)
## Note: overwriting existing report
## Dataset saved as " /tmp/RtmpXoIrRA/mitch7.rds ".
## 
## 
## processing file: mitch.Rmd
## 1/34                             
## 2/34 [checklibraries]            
## 3/34                             
## 4/34 [peek]                      
## 5/34                             
## 6/34 [metrics]                   
## 7/34                             
## 8/34 [scatterplot]
## 9/34                             
## 10/34 [contourplot]
## 11/34                             
## 12/34 [input_geneset_metrics1]    
## 13/34                             
## 14/34 [input_geneset_metrics2]
## 15/34                             
## 16/34 [input_geneset_metrics3]    
## 17/34                             
## 18/34 [echart1d]                  
## 19/34 [echart2d]                  
## 20/34                             
## 21/34 [heatmap]
## 22/34                             
## 23/34 [effectsize]                
## 24/34                             
## 25/34 [results_table]             
## 26/34                             
## 27/34 [results_table_complete]    
## 28/34                             
## 29/34 [detailed_geneset_reports1d]
## 30/34                             
## 31/34 [detailed_geneset_reports2d]
## 32/34                             
## 33/34 [session_info]              
## 34/34
## output file: /home/mark.ziemann@domain.internal.burnet.edu.au/projects/lung_brain/mitch.knit.md
## /usr/bin/pandoc +RTS -K512m -RTS /home/mark.ziemann@domain.internal.burnet.edu.au/projects/lung_brain/mitch.knit.md --to html4 --from markdown+autolink_bare_uris+tex_math_single_backslash --output /tmp/RtmpXoIrRA/mitch_report.html --lua-filter /usr/local/lib/R/site-library/rmarkdown/rmarkdown/lua/pagebreak.lua --lua-filter /usr/local/lib/R/site-library/rmarkdown/rmarkdown/lua/latex-div.lua --self-contained --variable bs3=TRUE --section-divs --template /usr/local/lib/R/site-library/rmarkdown/rmd/h/default.html --no-highlight --variable highlightjs=1 --variable theme=bootstrap --mathjax --variable 'mathjax-url=https://mathjax.rstudio.com/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML' --include-in-header /tmp/RtmpXoIrRA/rmarkdown-str2d120534976783.html
## 
## Output created: /tmp/RtmpXoIrRA/mitch_report.html
## [1] TRUE
write.table(mres7$enrichment_result,file="mitch7.tsv",quote=FALSE,sep="\t",row.names=FALSE)

m7_top_up <- head(subset(m7_top,s.dist>0),10)[,"s.dist"]
names(m7_top_up) <- head(subset(m7_top,s.dist>0),10)[,"set"]
m7_top_dn <- head(subset(m7_top,s.dist<0),10)[,"s.dist"]
names(m7_top_dn) <- head(subset(m7_top,s.dist<0),10)[,"set"]
m7_top_updn <- c(m7_top_up,m7_top_dn)
m7_top_updn <- m7_top_updn[order(m7_top_updn)]

# heatmap
mr7 <- head(subset(mres7$enrichment_result,p.adjustMANOVA<0.05),30)
mr7 <- as.matrix(mr7[,4:8])
rownames(mr7) <- head(mres7$enrichment_result,30)$set

colfunc <- colorRampPalette(c("blue", "white", "red"))

heatmap.2(mr7,trace="none",col=colfunc(25),scale="none", margins = c(10,21), cexRow=0.7,
  main="Top ranked pathways OVA all tissues" , cexCol=0.9 )

pdf("plot39_mitch7_heatmap01.pdf")
heatmap.2(mr7,trace="none",col=colfunc(25),scale="none", margins = c(10,21), cexRow=0.7,
  main="Top ranked pathways OVA all tissues" , cexCol=0.9 )
dev.off()
## X11cairo 
##        2

Conclusion

There was some variability among samples in the hypothalamus, in particular some OVA samples could be classified as outliers (EA9-1 and EA3-1). Further investigation would be required to understand the origin of this variability. LPS resulted in the differential expression of just 30 genes in the hypothalamus. OVA was variable, so no significant genes were identified. Analysis with mitch identified some interesting pathways as seen in the mitch heatmap (see the mitch reports for details). The mitch software can perform multi-contrast pathway analysis and will be important to contrast the effect of the treatments in different tissues.

References

Bibliography

  1.  Babraham bioinformatics - FastQC A quality control tool for high throughput sequence data. Babraham.ac.uk, https://www.bioinformatics.babraham.ac.uk/projects/fastqc/ (accessed February 23, 2022).
  2.  Frankish A, Diekhans M, Jungreis I, et al. GENCODE 2021. Nucleic Acids Res 2021; 49: D916–D923.
  3.  Jiang H, Lei R, Ding S-W, et al. Skewer: a fast and accurate adapter trimmer for next-generation sequencing paired-end reads. BMC Bioinformatics 2014; 15: 182.
  4.  Bray NL, Pimentel H, Melsted P, et al. Near-optimal probabilistic RNA-seq quantification. Nat Biotechnol 2016; 34: 525–527.
  5.  Ewels P, Magnusson M, Lundin S, et al. MultiQC: summarize analysis results for multiple tools and samples in a single report. Bioinformatics 2016; 32: 3047–3048.
  6.  Love MI, Huber W, Anders S. Moderated estimation of fold change and dispersion for RNA-seq data with DESeq2. Genome Biol 2014; 15: 550.
  7.  Liberzon A, Birger C, Thorvaldsdóttir H, et al. The Molecular Signatures Database (MSigDB) hallmark gene set collection. Cell Syst 2015; 1: 417–425.
  8.  Jassal B, Matthews L, Viteri G, et al. The reactome pathway knowledgebase. Nucleic Acids Res 2020; 48: D498–D503.
  9.  Dolgalev I. MSigDB Gene Sets for Multiple Organisms in a Tidy Data Format [R package msigdbr version 7.4.1], https://cran.r-project.org/web/packages/msigdbr/index.html (2021, accessed February 23, 2022).
  10. Kaspi A, Ziemann M. Mitch: Multi-contrast pathway enrichment for multi-omics and single-cell profiling data. BMC Genomics 2020; 21: 447.

Session information

For reproducibility.

sessionInfo()
## R version 4.4.0 (2024-04-24)
## Platform: x86_64-pc-linux-gnu
## Running under: Ubuntu 22.04.4 LTS
## 
## Matrix products: default
## BLAS:   /usr/lib/x86_64-linux-gnu/blas/libblas.so.3.10.0 
## LAPACK: /usr/lib/x86_64-linux-gnu/lapack/liblapack.so.3.10.0
## 
## locale:
##  [1] LC_CTYPE=en_US.UTF-8       LC_NUMERIC=C              
##  [3] LC_TIME=en_US.UTF-8        LC_COLLATE=en_US.UTF-8    
##  [5] LC_MONETARY=en_US.UTF-8    LC_MESSAGES=en_US.UTF-8   
##  [7] LC_PAPER=en_US.UTF-8       LC_NAME=C                 
##  [9] LC_ADDRESS=C               LC_TELEPHONE=C            
## [11] LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C       
## 
## time zone: Australia/Melbourne
## tzcode source: system (glibc)
## 
## attached base packages:
## [1] stats4    stats     graphics  grDevices utils     datasets  methods  
## [8] base     
## 
## other attached packages:
##  [1] GGally_2.2.1                ggplot2_3.5.1              
##  [3] gtools_3.9.5                tibble_3.2.1               
##  [5] dplyr_1.1.4                 echarts4r_0.4.5            
##  [7] beeswarm_0.4.0              pkgload_1.3.4              
##  [9] vioplot_0.4.0               sm_2.2-6.0                 
## [11] kableExtra_1.4.0            topconfects_1.20.0         
## [13] limma_3.60.0                eulerr_7.0.2               
## [15] mitch_1.16.0                MASS_7.3-60.2              
## [17] fgsea_1.30.0                gplots_3.1.3.1             
## [19] DESeq2_1.44.0               SummarizedExperiment_1.34.0
## [21] Biobase_2.64.0              MatrixGenerics_1.16.0      
## [23] matrixStats_1.3.0           GenomicRanges_1.56.0       
## [25] GenomeInfoDb_1.40.0         IRanges_2.38.0             
## [27] S4Vectors_0.42.0            BiocGenerics_0.50.0        
## [29] reshape2_1.4.4              zoo_1.8-12                 
## 
## loaded via a namespace (and not attached):
##  [1] bitops_1.0-7            gridExtra_2.3           rlang_1.1.3            
##  [4] magrittr_2.0.3          compiler_4.4.0          polylabelr_0.2.0       
##  [7] systemfonts_1.1.0       vctrs_0.6.5             stringr_1.5.1          
## [10] pkgconfig_2.0.3         crayon_1.5.2            fastmap_1.2.0          
## [13] XVector_0.44.0          labeling_0.4.3          caTools_1.18.2         
## [16] utf8_1.2.4              promises_1.3.0          rmarkdown_2.27         
## [19] UCSC.utils_1.0.0        purrr_1.0.2             xfun_0.44              
## [22] zlibbioc_1.50.0         cachem_1.1.0            jsonlite_1.8.8         
## [25] progress_1.2.3          highr_0.11              later_1.3.2            
## [28] DelayedArray_0.30.1     BiocParallel_1.38.0     prettyunits_1.2.0      
## [31] parallel_4.4.0          R6_2.5.1                bslib_0.7.0            
## [34] stringi_1.8.4           RColorBrewer_1.1-3      jquerylib_0.1.4        
## [37] Rcpp_1.0.12             assertthat_0.2.1        knitr_1.47             
## [40] httpuv_1.6.15           Matrix_1.7-0            tidyselect_1.2.1       
## [43] rstudioapi_0.16.0       abind_1.4-5             yaml_2.3.8             
## [46] codetools_0.2-20        lattice_0.22-6          plyr_1.8.9             
## [49] withr_3.0.0             shiny_1.8.1.1           evaluate_0.23          
## [52] polyclip_1.10-6         ggstats_0.6.0           xml2_1.3.6             
## [55] pillar_1.9.0            KernSmooth_2.23-24      generics_0.1.3         
## [58] hms_1.1.3               munsell_0.5.1           scales_1.3.0           
## [61] xtable_1.8-4            glue_1.7.0              tools_4.4.0            
## [64] data.table_1.15.4       locfit_1.5-9.9          fastmatch_1.1-4        
## [67] cowplot_1.1.3           grid_4.4.0              tidyr_1.3.1            
## [70] colorspace_2.1-0        GenomeInfoDbData_1.2.12 cli_3.6.2              
## [73] fansi_1.0.6             S4Arrays_1.4.0          viridisLite_0.4.2      
## [76] svglite_2.1.3           gtable_0.3.5            sass_0.4.9             
## [79] digest_0.6.35           SparseArray_1.4.3       farver_2.1.2           
## [82] htmlwidgets_1.6.4       htmltools_0.5.8.1       lifecycle_1.0.4        
## [85] httr_1.4.7              statmod_1.5.0           mime_0.12