Source: https://github.com/markziemann/mst1tg_mito_rna-seq

Loading packages

# to be run in R4
suppressPackageStartupMessages({
  library("tidyverse")
  library("reshape2")
  library("gplots")
  library("mitch")
})

Import profiling data

young <- read.csv("Mst1TG_young_deseq.tsv",sep="\t")
rownames(young) <- sapply((strsplit(rownames(young),"\\.")),"[[",1)
old <- read.csv("Mst1TG_old_deseq.tsv",sep="\t")
rownames(old) <- sapply((strsplit(rownames(old),"\\.")),"[[",1)
x <- list("young" = young , "old" = old)

# import these in again for heatmaps
young <- read.csv("Mst1TG_young_deseq.tsv",sep="\t")
old <- read.csv("Mst1TG_old_deseq.tsv",sep="\t")

Gene sets

gsets <- gmt_import("../ref/ReactomePathways_mouse.gmt")

# gene accession to symbol mapping
gt <- read.csv("../ref/mart_export.txt",sep="\t")
gt <- gt[,c(1,4)]

mitch

Lets begin with priority by significance.

yy <- mitch_import(x, DEtype="deseq2", geneTable=gt)
## Note: Mean no. genes in input = 17755
## Note: no. genes in output = 14877
## Note: estimated proportion of input genes in output = 0.838
res <- mitch_calc(yy, gsets, priority="significance")
## Note: When prioritising by significance (ie: small 
##             p-values), large effect sizes might be missed.
head(res$enrichment_result,20)
##                                                                                                                      set
## 1175                                                      The-citric-acid-(TCA)-cycle-and-respiratory-electron-transport
## 963  Respiratory-electron-transport,-ATP-synthesis-by-chemiosmotic-coupling,-and-heat-production-by-uncoupling-proteins.
## 962                                                                                       Respiratory-electron-transport
## 601                                                                                                           Metabolism
## 635                                                                                            Mitochondrial-translation
## 636                                                                                 Mitochondrial-translation-elongation
## 638                                                                                Mitochondrial-translation-termination
## 637                                                                                 Mitochondrial-translation-initiation
## 335                                                                                    Extracellular-matrix-organization
## 193                                                                                                 Complex-I-biogenesis
## 1215                                                                                                         Translation
## 826                                                                                                 Protein-localization
## 633                                                                                         Mitochondrial-protein-import
## 836                                                                      Pyruvate-metabolism-and-Citric-Acid-(TCA)-cycle
## 630                                                                                             Mitochondrial-biogenesis
## 186                                                                          Collagen-biosynthesis-and-modifying-enzymes
## 208                                                                                                    Cristae-formation
## 629                                                                              Mitochondrial-Fatty-Acid-Beta-Oxidation
## 189                                                                                                   Collagen-formation
## 1023                                                                                                 Signal-Transduction
##      setSize      pMANOVA    s.young       s.old      p.young        p.old
## 1175     168 2.515849e-83 -0.8361385 -0.81430465 1.230669e-78 1.234084e-74
## 963      121 9.359276e-66 -0.8833095 -0.83745735 1.258076e-63 2.530445e-57
## 962      100 4.626085e-57 -0.9035826 -0.85861000 2.801421e-55 4.761159e-50
## 601     1615 2.726231e-49 -0.2001755 -0.22456349 9.652047e-40 1.236627e-49
## 635       94 6.954962e-44 -0.8253673 -0.75822286 1.108541e-43 4.243812e-37
## 636       88 2.901428e-41 -0.8273809 -0.75794817 3.378270e-41 8.105151e-35
## 638       88 4.505778e-41 -0.8254722 -0.75609175 5.147975e-41 1.179238e-34
## 637       88 1.348162e-40 -0.8214244 -0.74964501 1.253713e-40 4.304968e-34
## 335      228 1.350544e-38  0.4991275  0.45777569 1.410377e-38 1.080239e-32
## 193       54 1.621653e-33 -0.9302161 -0.90362325 2.281589e-32 1.245806e-30
## 1215     243 6.643594e-31 -0.4108691 -0.42384188 2.925991e-28 5.659389e-30
## 826      142 7.412507e-29 -0.5118837 -0.53720327 6.064025e-26 2.039938e-28
## 633       57 8.672171e-23 -0.7619007 -0.68645027 2.285529e-23 2.947540e-19
## 836       51 4.483657e-21 -0.7249612 -0.76031508 3.153090e-19 5.373685e-21
## 630       88 1.702298e-19 -0.5304265 -0.55687581 7.776007e-18 1.670651e-19
## 186       56 1.436322e-17  0.6369799  0.65537076 1.592143e-16 2.099903e-17
## 208       29 4.274261e-17 -0.9046104 -0.86083346 3.206166e-17 9.786321e-16
## 629       31 5.132212e-17 -0.8584391 -0.84985203 1.245379e-16 2.491625e-16
## 189       75 1.224413e-16  0.5455389  0.54164212 3.060851e-16 4.962533e-16
## 1023    1718 3.251919e-14  0.1166064  0.09353717 3.255389e-15 2.628458e-10
##         s.dist          SD p.adjustMANOVA
## 1175 1.1671417 0.015438895   3.288214e-80
## 963  1.2171978 0.032422401   6.116287e-63
## 962  1.2464641 0.031800425   2.015431e-54
## 601  0.3008305 0.017244941   8.907961e-47
## 635  1.1207734 0.047478264   1.818027e-41
## 636  1.1220716 0.049096367   6.320277e-39
## 638  1.1194102 0.049059420   8.412931e-39
## 637  1.1120727 0.050755696   2.202560e-38
## 335  0.6772643 0.029240169   1.961289e-36
## 193  1.2968565 0.018803954   2.119500e-31
## 1215 0.5903011 0.009173139   7.893798e-29
## 826  0.7420325 0.017903671   8.073456e-27
## 633  1.0255275 0.053351514   8.718867e-21
## 836  1.0505464 0.024998980   4.185814e-19
## 630  0.7690663 0.018702498   1.483269e-17
## 186  0.9139224 0.013004325   1.173296e-15
## 208  1.2487411 0.030954971   3.286152e-15
## 629  1.2079595 0.006071986   3.726556e-15
## 189  0.7687580 0.002755433   8.422672e-15
## 1023 0.1494866 0.016312415   2.125129e-12
unlink("Mst1TG_young_and_old_sig_mitch.html")
# top N gene heatmap
mitch_report(res, outfile = "Mst1TG_young_and_old_sig_mitch.html")
## Dataset saved as " /tmp/Rtmp8aocg6/Mst1TG_young_and_old_sig_mitch.rds ".
## 
## 
## processing file: mitch.Rmd
## 
  |                                                                            
  |                                                                      |   0%
  |                                                                            
  |..                                                                    |   3%
##    inline R code fragments
## 
## 
  |                                                                            
  |....                                                                  |   6%
## label: checklibraries (with options) 
## List of 1
##  $ echo: logi FALSE
## 
## 
  |                                                                            
  |......                                                                |   9%
##   ordinary text without R code
## 
## 
  |                                                                            
  |........                                                              |  12%
## label: peek (with options) 
## List of 1
##  $ echo: logi FALSE
## 
## 
  |                                                                            
  |..........                                                            |  15%
##   ordinary text without R code
## 
## 
  |                                                                            
  |............                                                          |  18%
## label: metrics (with options) 
## List of 1
##  $ echo: logi FALSE
## 
## 
  |                                                                            
  |..............                                                        |  21%
##   ordinary text without R code
## 
## 
  |                                                                            
  |................                                                      |  24%
## label: scatterplot (with options) 
## List of 5
##  $ echo      : logi FALSE
##  $ fig.height: num 6
##  $ fig.width : num 6.5
##  $ message   : logi FALSE
##  $ warning   : logi FALSE
## 
  |                                                                            
  |...................                                                   |  26%
##   ordinary text without R code
## 
## 
  |                                                                            
  |.....................                                                 |  29%
## label: contourplot (with options) 
## List of 5
##  $ echo      : logi FALSE
##  $ fig.height: num 6
##  $ fig.width : num 6.5
##  $ warning   : logi FALSE
##  $ message   : logi FALSE
## 
  |                                                                            
  |.......................                                               |  32%
##   ordinary text without R code
## 
## 
  |                                                                            
  |.........................                                             |  35%
## label: input_geneset_metrics1 (with options) 
## List of 2
##  $ results: chr "asis"
##  $ echo   : logi FALSE
## 
## 
  |                                                                            
  |...........................                                           |  38%
##   ordinary text without R code
## 
## 
  |                                                                            
  |.............................                                         |  41%
## label: input_geneset_metrics2 (with options) 
## List of 5
##  $ results   : chr "asis"
##  $ echo      : logi FALSE
##  $ fig.height: num 7
##  $ fig.width : num 7
##  $ fig.show  : chr "all"
## 
  |                                                                            
  |...............................                                       |  44%
##   ordinary text without R code
## 
## 
  |                                                                            
  |.................................                                     |  47%
## label: input_geneset_metrics3 (with options) 
## List of 5
##  $ results   : chr "asis"
##  $ echo      : logi FALSE
##  $ message   : logi FALSE
##  $ fig.height: num 7
##  $ fig.width : num 7
## 
  |                                                                            
  |...................................                                   |  50%
##   ordinary text without R code
## 
## 
  |                                                                            
  |.....................................                                 |  53%
## label: echart1d (with options) 
## List of 6
##  $ results   : chr "asis"
##  $ echo      : logi FALSE
##  $ fig.height: num 7
##  $ fig.width : num 7
##  $ fig.show  : chr "all"
##  $ message   : logi FALSE
## 
## 
  |                                                                            
  |.......................................                               |  56%
## label: echart2d (with options) 
## List of 6
##  $ results   : chr "asis"
##  $ echo      : logi FALSE
##  $ fig.height: num 7
##  $ fig.width : num 7
##  $ fig.show  : chr "all"
##  $ message   : logi FALSE
## 
## 
  |                                                                            
  |.........................................                             |  59%
##   ordinary text without R code
## 
## 
  |                                                                            
  |...........................................                           |  62%
## label: heatmap (with options) 
## List of 6
##  $ results   : chr "asis"
##  $ echo      : logi FALSE
##  $ fig.height: num 10
##  $ fig.width : num 7
##  $ fig.show  : chr "all"
##  $ message   : logi FALSE
## 
  |                                                                            
  |.............................................                         |  65%
##   ordinary text without R code
## 
## 
  |                                                                            
  |...............................................                       |  68%
## label: effectsize (with options) 
## List of 6
##  $ results   : chr "asis"
##  $ echo      : logi FALSE
##  $ fig.height: num 7
##  $ fig.width : num 7
##  $ fig.show  : chr "all"
##  $ message   : logi FALSE
## 
## 
  |                                                                            
  |.................................................                     |  71%
##   ordinary text without R code
## 
## 
  |                                                                            
  |...................................................                   |  74%
## label: results_table (with options) 
## List of 2
##  $ results: chr "asis"
##  $ echo   : logi FALSE
## 
## 
  |                                                                            
  |......................................................                |  76%
##   ordinary text without R code
## 
## 
  |                                                                            
  |........................................................              |  79%
## label: results_table_complete (with options) 
## List of 2
##  $ results: chr "asis"
##  $ echo   : logi FALSE
## 
## 
  |                                                                            
  |..........................................................            |  82%
##   ordinary text without R code
## 
## 
  |                                                                            
  |............................................................          |  85%
## label: detailed_geneset_reports1d (with options) 
## List of 7
##  $ results   : chr "asis"
##  $ echo      : logi FALSE
##  $ fig.height: num 6
##  $ fig.width : num 6
##  $ out.width : chr "80%"
##  $ comment   : logi NA
##  $ message   : logi FALSE
## 
## 
  |                                                                            
  |..............................................................        |  88%
##   ordinary text without R code
## 
## 
  |                                                                            
  |................................................................      |  91%
## label: detailed_geneset_reports2d (with options) 
## List of 7
##  $ results   : chr "asis"
##  $ echo      : logi FALSE
##  $ fig.height: num 5
##  $ fig.width : num 6
##  $ out.width : chr "80%"
##  $ comment   : logi NA
##  $ message   : logi FALSE
## 
  |                                                                            
  |..................................................................    |  94%
##   ordinary text without R code
## 
## 
  |                                                                            
  |....................................................................  |  97%
## label: session_info (with options) 
## List of 3
##  $ include: logi TRUE
##  $ echo   : logi TRUE
##  $ results: chr "markup"
## 
## 
  |                                                                            
  |......................................................................| 100%
##   ordinary text without R code
## output file: /mnt/bfx6/bfx/du_xiao/young_mst1tg/integrate/mitch.knit.md
## /usr/bin/pandoc +RTS -K512m -RTS /mnt/bfx6/bfx/du_xiao/young_mst1tg/integrate/mitch.utf8.md --to html4 --from markdown+autolink_bare_uris+tex_math_single_backslash --output /tmp/Rtmp8aocg6/mitch_report.html --email-obfuscation none --self-contained --standalone --section-divs --template /usr/local/lib/R/site-library/rmarkdown/rmd/h/default.html --no-highlight --variable highlightjs=1 --variable 'theme:bootstrap' --include-in-header /tmp/Rtmp8aocg6/rmarkdown-str74174224659a.html --mathjax --variable 'mathjax-url:https://mathjax.rstudio.com/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML'
## 
## Output created: /tmp/Rtmp8aocg6/mitch_report.html
## [1] TRUE
# heatmaps of top sets by significance
# colour scheme
colfunc <- colorRampPalette(c("blue", "white", "red"))

topsets <- head(res$enrichment_result,50)$set
mytopsets <- gsets[which(names( gsets ) %in% topsets)]
yo <- young[,7:ncol(young)]
colnames(yo) <- paste("y",colnames(yo))
ol <- old[,7:ncol(old)]
colnames(ol) <- paste("o",colnames(ol))
mx <- merge(yo,ol,by=0)
rownames(mx) <- mx$Row.names
mx$Row.names = NULL

i = 1
par(mar = c(10, 8, 8, 4) + 0.2)
for ( i in seq_along(mytopsets) ) {
  g <- as.vector(unlist(mytopsets[i]))
  symbol <- sapply((strsplit(rownames(mx)," ")),"[[",2)
  z <- mx[which(symbol %in% g),]
  SETNAME=names(mytopsets[i])
  heatmap.2( as.matrix(z), col=colfunc(25),scale="row",
   trace="none",margins = c(6,20), cexRow=.4, cexCol=.8)
  mtext(SETNAME)
}

Now prioritise by effect size.

res <- mitch_calc(yy, gsets, priority = "effect")
## Note: Enrichments with large effect sizes may not be 
##             statistically significant.
head(res$enrichment_result,20)
##                                                                                                                      set
## 361                                                                            Formation-of-ATP-by-chemiosmotic-coupling
## 193                                                                                                 Complex-I-biogenesis
## 176                                                                                        Citric-acid-cycle-(TCA-cycle)
## 208                                                                                                    Cristae-formation
## 962                                                                                       Respiratory-electron-transport
## 963  Respiratory-electron-transport,-ATP-synthesis-by-chemiosmotic-coupling,-and-heat-production-by-uncoupling-proteins.
## 629                                                                              Mitochondrial-Fatty-Acid-Beta-Oxidation
## 110                                                                                 Branched-chain-amino-acid-catabolism
## 1175                                                      The-citric-acid-(TCA)-cycle-and-respiratory-electron-transport
## 1298                                                                                rRNA-processing-in-the-mitochondrion
## 1304                                                                                tRNA-processing-in-the-mitochondrion
## 636                                                                                 Mitochondrial-translation-elongation
## 635                                                                                            Mitochondrial-translation
## 638                                                                                Mitochondrial-translation-termination
## 637                                                                                 Mitochondrial-translation-initiation
## 632                                                                         Mitochondrial-iron-sulfur-cluster-biogenesis
## 440                                                                        Glyoxylate-metabolism-and-glycine-degradation
## 836                                                                      Pyruvate-metabolism-and-Citric-Acid-(TCA)-cycle
## 187                                                                                         Collagen-chain-trimerization
## 633                                                                                         Mitochondrial-protein-import
##      setSize      pMANOVA    s.young      s.old      p.young        p.old
## 361       16 1.292423e-10 -0.9329789 -0.9194031 1.017112e-10 1.887907e-10
## 193       54 1.621653e-33 -0.9302161 -0.9036232 2.281589e-32 1.245806e-30
## 176       22 2.511926e-13 -0.8942872 -0.8892751 3.711622e-13 5.015120e-13
## 208       29 4.274261e-17 -0.9046104 -0.8608335 3.206166e-17 9.786321e-16
## 962      100 4.626085e-57 -0.9035826 -0.8586100 2.801421e-55 4.761159e-50
## 963      121 9.359276e-66 -0.8833095 -0.8374574 1.258076e-63 2.530445e-57
## 629       31 5.132212e-17 -0.8584391 -0.8498520 1.245379e-16 2.491625e-16
## 110       21 2.430098e-11 -0.8328525 -0.8426674 3.838241e-11 2.259224e-11
## 1175     168 2.515849e-83 -0.8361385 -0.8143047 1.230669e-78 1.234084e-74
## 1298      22 1.564605e-11 -0.7831156 -0.8542333 2.002556e-10 3.928719e-12
## 1304      18 3.426684e-09 -0.7504019 -0.8415326 3.521252e-08 6.262141e-10
## 636       88 2.901428e-41 -0.8273809 -0.7579482 3.378270e-41 8.105151e-35
## 635       94 6.954962e-44 -0.8253673 -0.7582229 1.108541e-43 4.243812e-37
## 638       88 4.505778e-41 -0.8254722 -0.7560918 5.147975e-41 1.179238e-34
## 637       88 1.348162e-40 -0.8214244 -0.7496450 1.253713e-40 4.304968e-34
## 632       10 6.993237e-05 -0.7409968 -0.7750185 4.948957e-05 2.191278e-05
## 440       25 7.782677e-11 -0.7513547 -0.7477350 7.741915e-11 9.534951e-11
## 836       51 4.483657e-21 -0.7249612 -0.7603151 3.153090e-19 5.373685e-21
## 187       33 1.118654e-13  0.7367001  0.7402562 2.337306e-13 1.793245e-13
## 633       57 8.672171e-23 -0.7619007 -0.6864503 2.285529e-23 2.947540e-19
##        s.dist          SD p.adjustMANOVA
## 361  1.309867 0.009599542   4.826277e-09
## 193  1.296857 0.018803954   2.119500e-31
## 176  1.261174 0.003544080   1.492313e-11
## 208  1.248741 0.030954971   3.286152e-15
## 962  1.246464 0.031800425   2.015431e-54
## 963  1.217198 0.032422401   6.116287e-63
## 629  1.207960 0.006071986   3.726556e-15
## 110  1.184792 0.006940152   1.134335e-09
## 1175 1.167142 0.015438895   3.288214e-80
## 1298 1.158872 0.050287861   7.573845e-10
## 1304 1.127511 0.064439138   1.210453e-07
## 636  1.122072 0.049096367   6.320277e-39
## 635  1.120773 0.047478264   1.818027e-41
## 638  1.119410 0.049059420   8.412931e-39
## 637  1.112073 0.050755696   2.202560e-38
## 632  1.072255 0.024056946   9.451158e-04
## 440  1.060020 0.002559525   3.184758e-09
## 836  1.050546 0.024998980   4.185814e-19
## 187  1.044369 0.002514596   6.962290e-12
## 633  1.025527 0.053351514   8.718867e-21
unlink("Mst1TG_young_and_old_eff_mitch.html")
mitch_report(res, outfile = "Mst1TG_young_and_old_eff_mitch.html")
## Dataset saved as " /tmp/Rtmp8aocg6/Mst1TG_young_and_old_eff_mitch.rds ".
## 
## 
## processing file: mitch.Rmd
## 
  |                                                                            
  |                                                                      |   0%
  |                                                                            
  |..                                                                    |   3%
##    inline R code fragments
## 
## 
  |                                                                            
  |....                                                                  |   6%
## label: checklibraries (with options) 
## List of 1
##  $ echo: logi FALSE
## 
## 
  |                                                                            
  |......                                                                |   9%
##   ordinary text without R code
## 
## 
  |                                                                            
  |........                                                              |  12%
## label: peek (with options) 
## List of 1
##  $ echo: logi FALSE
## 
## 
  |                                                                            
  |..........                                                            |  15%
##   ordinary text without R code
## 
## 
  |                                                                            
  |............                                                          |  18%
## label: metrics (with options) 
## List of 1
##  $ echo: logi FALSE
## 
## 
  |                                                                            
  |..............                                                        |  21%
##   ordinary text without R code
## 
## 
  |                                                                            
  |................                                                      |  24%
## label: scatterplot (with options) 
## List of 5
##  $ echo      : logi FALSE
##  $ fig.height: num 6
##  $ fig.width : num 6.5
##  $ message   : logi FALSE
##  $ warning   : logi FALSE
## 
  |                                                                            
  |...................                                                   |  26%
##   ordinary text without R code
## 
## 
  |                                                                            
  |.....................                                                 |  29%
## label: contourplot (with options) 
## List of 5
##  $ echo      : logi FALSE
##  $ fig.height: num 6
##  $ fig.width : num 6.5
##  $ warning   : logi FALSE
##  $ message   : logi FALSE
## 
  |                                                                            
  |.......................                                               |  32%
##   ordinary text without R code
## 
## 
  |                                                                            
  |.........................                                             |  35%
## label: input_geneset_metrics1 (with options) 
## List of 2
##  $ results: chr "asis"
##  $ echo   : logi FALSE
## 
## 
  |                                                                            
  |...........................                                           |  38%
##   ordinary text without R code
## 
## 
  |                                                                            
  |.............................                                         |  41%
## label: input_geneset_metrics2 (with options) 
## List of 5
##  $ results   : chr "asis"
##  $ echo      : logi FALSE
##  $ fig.height: num 7
##  $ fig.width : num 7
##  $ fig.show  : chr "all"
## 
  |                                                                            
  |...............................                                       |  44%
##   ordinary text without R code
## 
## 
  |                                                                            
  |.................................                                     |  47%
## label: input_geneset_metrics3 (with options) 
## List of 5
##  $ results   : chr "asis"
##  $ echo      : logi FALSE
##  $ message   : logi FALSE
##  $ fig.height: num 7
##  $ fig.width : num 7
## 
  |                                                                            
  |...................................                                   |  50%
##   ordinary text without R code
## 
## 
  |                                                                            
  |.....................................                                 |  53%
## label: echart1d (with options) 
## List of 6
##  $ results   : chr "asis"
##  $ echo      : logi FALSE
##  $ fig.height: num 7
##  $ fig.width : num 7
##  $ fig.show  : chr "all"
##  $ message   : logi FALSE
## 
## 
  |                                                                            
  |.......................................                               |  56%
## label: echart2d (with options) 
## List of 6
##  $ results   : chr "asis"
##  $ echo      : logi FALSE
##  $ fig.height: num 7
##  $ fig.width : num 7
##  $ fig.show  : chr "all"
##  $ message   : logi FALSE
## 
## 
  |                                                                            
  |.........................................                             |  59%
##   ordinary text without R code
## 
## 
  |                                                                            
  |...........................................                           |  62%
## label: heatmap (with options) 
## List of 6
##  $ results   : chr "asis"
##  $ echo      : logi FALSE
##  $ fig.height: num 10
##  $ fig.width : num 7
##  $ fig.show  : chr "all"
##  $ message   : logi FALSE
## 
  |                                                                            
  |.............................................                         |  65%
##   ordinary text without R code
## 
## 
  |                                                                            
  |...............................................                       |  68%
## label: effectsize (with options) 
## List of 6
##  $ results   : chr "asis"
##  $ echo      : logi FALSE
##  $ fig.height: num 7
##  $ fig.width : num 7
##  $ fig.show  : chr "all"
##  $ message   : logi FALSE
## 
## 
  |                                                                            
  |.................................................                     |  71%
##   ordinary text without R code
## 
## 
  |                                                                            
  |...................................................                   |  74%
## label: results_table (with options) 
## List of 2
##  $ results: chr "asis"
##  $ echo   : logi FALSE
## 
## 
  |                                                                            
  |......................................................                |  76%
##   ordinary text without R code
## 
## 
  |                                                                            
  |........................................................              |  79%
## label: results_table_complete (with options) 
## List of 2
##  $ results: chr "asis"
##  $ echo   : logi FALSE
## 
## 
  |                                                                            
  |..........................................................            |  82%
##   ordinary text without R code
## 
## 
  |                                                                            
  |............................................................          |  85%
## label: detailed_geneset_reports1d (with options) 
## List of 7
##  $ results   : chr "asis"
##  $ echo      : logi FALSE
##  $ fig.height: num 6
##  $ fig.width : num 6
##  $ out.width : chr "80%"
##  $ comment   : logi NA
##  $ message   : logi FALSE
## 
## 
  |                                                                            
  |..............................................................        |  88%
##   ordinary text without R code
## 
## 
  |                                                                            
  |................................................................      |  91%
## label: detailed_geneset_reports2d (with options) 
## List of 7
##  $ results   : chr "asis"
##  $ echo      : logi FALSE
##  $ fig.height: num 5
##  $ fig.width : num 6
##  $ out.width : chr "80%"
##  $ comment   : logi NA
##  $ message   : logi FALSE
## 
  |                                                                            
  |..................................................................    |  94%
##   ordinary text without R code
## 
## 
  |                                                                            
  |....................................................................  |  97%
## label: session_info (with options) 
## List of 3
##  $ include: logi TRUE
##  $ echo   : logi TRUE
##  $ results: chr "markup"
## 
## 
  |                                                                            
  |......................................................................| 100%
##   ordinary text without R code
## output file: /mnt/bfx6/bfx/du_xiao/young_mst1tg/integrate/mitch.knit.md
## /usr/bin/pandoc +RTS -K512m -RTS /mnt/bfx6/bfx/du_xiao/young_mst1tg/integrate/mitch.utf8.md --to html4 --from markdown+autolink_bare_uris+tex_math_single_backslash --output /tmp/Rtmp8aocg6/mitch_report.html --email-obfuscation none --self-contained --standalone --section-divs --template /usr/local/lib/R/site-library/rmarkdown/rmd/h/default.html --no-highlight --variable highlightjs=1 --variable 'theme:bootstrap' --include-in-header /tmp/Rtmp8aocg6/rmarkdown-str741772d09b3d.html --mathjax --variable 'mathjax-url:https://mathjax.rstudio.com/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML'
## 
## Output created: /tmp/Rtmp8aocg6/mitch_report.html
## [1] TRUE
# heatmaps of top sets by effect size
topsets <- head(res$enrichment_result,50)$set
mytopsets <- gsets[which(names( gsets ) %in% topsets)]
i=1
par(mar = c(10, 8, 8, 4) + 0.2)
for ( i in seq_along(mytopsets) ) {
  g <- as.vector(unlist(mytopsets[i]))
  symbol <- sapply((strsplit(rownames(mx)," ")),"[[",2)
  z <- mx[which(symbol %in% g),]
  SETNAME = names(mytopsets[i])
  heatmap.2( as.matrix(z), col = colfunc(25),scale = "row",
   trace="none",margins = c(6,20), cexRow = .4, cexCol = .8)
  mtext(SETNAME)
}

Now prioritise by discordant effect size.

res <- mitch_calc(yy, gsets, priority = "SD")
## Note: Prioritisation by SD after selecting sets with 
##             p.adjustMANOVA<=0.05.
head(res$enrichment_result,20)
##                                                                                set
## 1171                                          Termination-of-O-glycan-biosynthesis
## 1111                                              Synaptic-adhesion-like-molecules
## 519                                                Interferon-alpha/beta-signaling
## 1174                        The-canonical-retinoid-cycle-in-rods-(twilight-vision)
## 658                         N-glycan-antennae-elongation-in-the-medial/trans-Golgi
## 166                                            Chemokine-receptors-bind-chemokines
## 730                                               O-linked-glycosylation-of-mucins
## 460                                                            HS-GAG-biosynthesis
## 1266                        WNT5A-dependent-internalization-of-FZD2,-FZD5-and-ROR2
## 461                                                             HS-GAG-degradation
## 350  FOXO-mediated-transcription-of-oxidative-stress,-metabolic-and-neuronal-genes
## 1022                                                        Sialic-acid-metabolism
## 285                       Downregulation-of-SMAD2/3:SMAD4-transcriptional-activity
## 1126                     Synthesis-of-active-ubiquitin:-roles-of-E1-and-E2-enzymes
## 1236                                                       Triglyceride-catabolism
## 1242                       Ubiquitin-Mediated-Degradation-of-Phosphorylated-Cdc25A
## 1290                                           p53-Independent-DNA-Damage-Response
## 1291                                    p53-Independent-G1/S-DNA-damage-checkpoint
## 86                                         Assembly-of-the-pre-replicative-complex
## 948                                    Regulation-of-ornithine-decarboxylase-(ODC)
##      setSize      pMANOVA     s.young         s.old      p.young        p.old
## 1171      10 1.115890e-03  0.39081187 -0.0052599717 0.0323685019 9.770257e-01
## 1111      15 1.732267e-03  0.28323689 -0.0347373615 0.0575633910 8.158480e-01
## 519       40 1.387142e-08  0.04785671  0.3600053919 0.6006283244 8.180409e-05
## 1174      12 4.087033e-04  0.24527413  0.5572149344 0.1412962416 8.309092e-04
## 658       20 2.410343e-04  0.35078414  0.0531197415 0.0066187051 6.809598e-01
## 166       20 2.501491e-03  0.29927980  0.0474321868 0.0205218841 7.135212e-01
## 730       32 1.254537e-05  0.38636746  0.1405776356 0.0001554919 1.688774e-01
## 460       23 1.159881e-04  0.43421476  0.1915455360 0.0003126898 1.118798e-01
## 1266      13 5.292945e-03  0.44633394  0.2064461373 0.0053319120 1.975302e-01
## 461       18 4.696817e-04  0.47066125  0.2343660034 0.0005463251 8.522719e-02
## 350       23 9.528103e-03  0.09551519 -0.1308914009 0.4279310937 2.773219e-01
## 1022      26 3.270409e-03  0.23833671  0.0168131646 0.0354594522 8.820684e-01
## 285       23 6.014951e-03  0.24809011  0.0279532376 0.0394778318 8.165394e-01
## 1126      29 3.254697e-03 -0.01472856 -0.2248485806 0.8908463045 3.615487e-02
## 1236      15 9.291510e-06 -0.50318037 -0.7077827121 0.0007405841 2.065018e-06
## 1242      48 2.720323e-05 -0.31450480 -0.1268151370 0.0001642006 1.286981e-01
## 1290      48 2.720323e-05 -0.31450480 -0.1268151370 0.0001642006 1.286981e-01
## 1291      48 2.720323e-05 -0.31450480 -0.1268151370 0.0001642006 1.286981e-01
## 86        64 6.669333e-05 -0.18632493 -0.0003354317 0.0099862346 9.962998e-01
## 948       46 3.967504e-05 -0.32015490 -0.1351077209 0.0001728409 1.130494e-01
##         s.dist        SD p.adjustMANOVA
## 1171 0.3908473 0.2800651   8.733342e-03
## 1111 0.2853591 0.2248417   1.271951e-02
## 519  0.3631723 0.2207225   4.316653e-07
## 1174 0.6088086 0.2205755   3.842987e-03
## 658  0.3547833 0.2104805   2.540579e-03
## 166  0.3030152 0.1780832   1.646570e-02
## 730  0.4111470 0.1737997   2.309409e-04
## 460  0.4745863 0.1715931   1.430155e-03
## 1266 0.4917662 0.1696263   3.158849e-02
## 461  0.5257846 0.1670860   4.292825e-03
## 350  0.1620361 0.1600936   4.845615e-02
## 1022 0.2389290 0.1566408   2.045179e-02
## 285  0.2496599 0.1556603   3.448045e-02
## 1126 0.2253305 0.1485773   2.045139e-02
## 1236 0.8684163 0.1446757   1.760001e-04
## 1242 0.3391096 0.1327166   4.389460e-04
## 1290 0.3391096 0.1327166   4.389460e-04
## 1291 0.3391096 0.1327166   4.389460e-04
## 86   0.1863252 0.1315144   9.273211e-04
## 948  0.3474957 0.1308481   6.092662e-04
unlink("Mst1TG_young_and_old_dis_mitch.html")
mitch_report(res, outfile = "Mst1TG_young_and_old_dis_mitch.html")
## Dataset saved as " /tmp/Rtmp8aocg6/Mst1TG_young_and_old_dis_mitch.rds ".
## 
## 
## processing file: mitch.Rmd
## 
  |                                                                            
  |                                                                      |   0%
  |                                                                            
  |..                                                                    |   3%
##    inline R code fragments
## 
## 
  |                                                                            
  |....                                                                  |   6%
## label: checklibraries (with options) 
## List of 1
##  $ echo: logi FALSE
## 
## 
  |                                                                            
  |......                                                                |   9%
##   ordinary text without R code
## 
## 
  |                                                                            
  |........                                                              |  12%
## label: peek (with options) 
## List of 1
##  $ echo: logi FALSE
## 
## 
  |                                                                            
  |..........                                                            |  15%
##   ordinary text without R code
## 
## 
  |                                                                            
  |............                                                          |  18%
## label: metrics (with options) 
## List of 1
##  $ echo: logi FALSE
## 
## 
  |                                                                            
  |..............                                                        |  21%
##   ordinary text without R code
## 
## 
  |                                                                            
  |................                                                      |  24%
## label: scatterplot (with options) 
## List of 5
##  $ echo      : logi FALSE
##  $ fig.height: num 6
##  $ fig.width : num 6.5
##  $ message   : logi FALSE
##  $ warning   : logi FALSE
## 
  |                                                                            
  |...................                                                   |  26%
##   ordinary text without R code
## 
## 
  |                                                                            
  |.....................                                                 |  29%
## label: contourplot (with options) 
## List of 5
##  $ echo      : logi FALSE
##  $ fig.height: num 6
##  $ fig.width : num 6.5
##  $ warning   : logi FALSE
##  $ message   : logi FALSE
## 
  |                                                                            
  |.......................                                               |  32%
##   ordinary text without R code
## 
## 
  |                                                                            
  |.........................                                             |  35%
## label: input_geneset_metrics1 (with options) 
## List of 2
##  $ results: chr "asis"
##  $ echo   : logi FALSE
## 
## 
  |                                                                            
  |...........................                                           |  38%
##   ordinary text without R code
## 
## 
  |                                                                            
  |.............................                                         |  41%
## label: input_geneset_metrics2 (with options) 
## List of 5
##  $ results   : chr "asis"
##  $ echo      : logi FALSE
##  $ fig.height: num 7
##  $ fig.width : num 7
##  $ fig.show  : chr "all"
## 
  |                                                                            
  |...............................                                       |  44%
##   ordinary text without R code
## 
## 
  |                                                                            
  |.................................                                     |  47%
## label: input_geneset_metrics3 (with options) 
## List of 5
##  $ results   : chr "asis"
##  $ echo      : logi FALSE
##  $ message   : logi FALSE
##  $ fig.height: num 7
##  $ fig.width : num 7
## 
  |                                                                            
  |...................................                                   |  50%
##   ordinary text without R code
## 
## 
  |                                                                            
  |.....................................                                 |  53%
## label: echart1d (with options) 
## List of 6
##  $ results   : chr "asis"
##  $ echo      : logi FALSE
##  $ fig.height: num 7
##  $ fig.width : num 7
##  $ fig.show  : chr "all"
##  $ message   : logi FALSE
## 
## 
  |                                                                            
  |.......................................                               |  56%
## label: echart2d (with options) 
## List of 6
##  $ results   : chr "asis"
##  $ echo      : logi FALSE
##  $ fig.height: num 7
##  $ fig.width : num 7
##  $ fig.show  : chr "all"
##  $ message   : logi FALSE
## 
## 
  |                                                                            
  |.........................................                             |  59%
##   ordinary text without R code
## 
## 
  |                                                                            
  |...........................................                           |  62%
## label: heatmap (with options) 
## List of 6
##  $ results   : chr "asis"
##  $ echo      : logi FALSE
##  $ fig.height: num 10
##  $ fig.width : num 7
##  $ fig.show  : chr "all"
##  $ message   : logi FALSE
## 
  |                                                                            
  |.............................................                         |  65%
##   ordinary text without R code
## 
## 
  |                                                                            
  |...............................................                       |  68%
## label: effectsize (with options) 
## List of 6
##  $ results   : chr "asis"
##  $ echo      : logi FALSE
##  $ fig.height: num 7
##  $ fig.width : num 7
##  $ fig.show  : chr "all"
##  $ message   : logi FALSE
## 
## 
  |                                                                            
  |.................................................                     |  71%
##   ordinary text without R code
## 
## 
  |                                                                            
  |...................................................                   |  74%
## label: results_table (with options) 
## List of 2
##  $ results: chr "asis"
##  $ echo   : logi FALSE
## 
## 
  |                                                                            
  |......................................................                |  76%
##   ordinary text without R code
## 
## 
  |                                                                            
  |........................................................              |  79%
## label: results_table_complete (with options) 
## List of 2
##  $ results: chr "asis"
##  $ echo   : logi FALSE
## 
## 
  |                                                                            
  |..........................................................            |  82%
##   ordinary text without R code
## 
## 
  |                                                                            
  |............................................................          |  85%
## label: detailed_geneset_reports1d (with options) 
## List of 7
##  $ results   : chr "asis"
##  $ echo      : logi FALSE
##  $ fig.height: num 6
##  $ fig.width : num 6
##  $ out.width : chr "80%"
##  $ comment   : logi NA
##  $ message   : logi FALSE
## 
## 
  |                                                                            
  |..............................................................        |  88%
##   ordinary text without R code
## 
## 
  |                                                                            
  |................................................................      |  91%
## label: detailed_geneset_reports2d (with options) 
## List of 7
##  $ results   : chr "asis"
##  $ echo      : logi FALSE
##  $ fig.height: num 5
##  $ fig.width : num 6
##  $ out.width : chr "80%"
##  $ comment   : logi NA
##  $ message   : logi FALSE
## 
  |                                                                            
  |..................................................................    |  94%
##   ordinary text without R code
## 
## 
  |                                                                            
  |....................................................................  |  97%
## label: session_info (with options) 
## List of 3
##  $ include: logi TRUE
##  $ echo   : logi TRUE
##  $ results: chr "markup"
## 
## 
  |                                                                            
  |......................................................................| 100%
##   ordinary text without R code
## output file: /mnt/bfx6/bfx/du_xiao/young_mst1tg/integrate/mitch.knit.md
## /usr/bin/pandoc +RTS -K512m -RTS /mnt/bfx6/bfx/du_xiao/young_mst1tg/integrate/mitch.utf8.md --to html4 --from markdown+autolink_bare_uris+tex_math_single_backslash --output /tmp/Rtmp8aocg6/mitch_report.html --email-obfuscation none --self-contained --standalone --section-divs --template /usr/local/lib/R/site-library/rmarkdown/rmd/h/default.html --no-highlight --variable highlightjs=1 --variable 'theme:bootstrap' --include-in-header /tmp/Rtmp8aocg6/rmarkdown-str74172130dcd4.html --mathjax --variable 'mathjax-url:https://mathjax.rstudio.com/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML'
## 
## Output created: /tmp/Rtmp8aocg6/mitch_report.html
## [1] TRUE
# heatmaps of top sets by discordant size
topsets <- head(res$enrichment_result,50)$set
mytopsets <- gsets[which(names( gsets ) %in% topsets)]
i=1
par(mar = c(10, 8, 8, 4) + 0.2)
for ( i in seq_along(mytopsets) ) {
  g <- as.vector(unlist(mytopsets[i]))
  symbol <- sapply((strsplit(rownames(mx)," ")),"[[",2)
  z <- mx[which(symbol %in% g),]
  SETNAME = names(mytopsets[i])
  heatmap.2( as.matrix(z), col = colfunc(25),scale = "row",
   trace="none",margins = c(6,20), cexRow = .4, cexCol = .8)
  mtext(SETNAME)
}

Custom gene set analysis

Run mitch with some hand-picked gene sets that are relevant to the Mst1 model.

# gene sets of interest
gsets <- gmt_import("../ref/pathways_of_interest_mouse.gmt")

# mitch pathways of interest
yy <- mitch_import(x, DEtype="deseq2", geneTable=gt)
## Note: Mean no. genes in input = 17755
## Note: no. genes in output = 14877
## Note: estimated proportion of input genes in output = 0.838
res <- mitch_calc(yy, gsets, priority="significance")
## Note: When prioritising by significance (ie: small 
##             p-values), large effect sizes might be missed.
head(res$enrichment_result,20)
##                                                                         set
## 24           The-citric-acid-(TCA)-cycle-and-respiratory-electron-transport
## 20                                           Respiratory-electron-transport
## 15                                                Mitochondrial-translation
## 13                                             Mitochondrial-protein-import
## 18                          Pyruvate-metabolism-and-Citric-Acid-(TCA)-cycle
## 10                                                 Mitochondrial-biogenesis
## 9                                   Mitochondrial-Fatty-Acid-Beta-Oxidation
## 5                                             Citric-acid-cycle-(TCA-cycle)
## 26                                     rRNA-processing-in-the-mitochondrion
## 2                                      Branched-chain-amino-acid-catabolism
## 14                                        Mitochondrial-tRNA-aminoacylation
## 25                   Transcriptional-activation-of-mitochondrial-biogenesis
## 12                             Mitochondrial-iron-sulfur-cluster-biogenesis
## 11                                      Mitochondrial-calcium-ion-transport
## 17 Oxygen-dependent-proline-hydroxylation-of-Hypoxia-inducible-Factor-Alpha
## 4                                              Cellular-response-to-hypoxia
## 22                                                Smooth-Muscle-Contraction
## 7                                                                Glycolysis
## 21                                                       Signaling-by-Hippo
## 16                                                       Muscle-contraction
##    setSize      pMANOVA     s.young       s.old      p.young        p.old
## 24     167 1.252333e-82 -0.83525078 -0.81311829 5.140819e-78 5.461735e-74
## 20     100 4.626085e-57 -0.90358259 -0.85861000 2.801421e-55 4.761159e-50
## 15      94 6.954962e-44 -0.82536726 -0.75822286 1.108541e-43 4.243812e-37
## 13      57 8.672171e-23 -0.76190070 -0.68645027 2.285529e-23 2.947540e-19
## 18      51 4.483657e-21 -0.72496118 -0.76031508 3.153090e-19 5.373685e-21
## 10      88 1.702298e-19 -0.53042648 -0.55687581 7.776007e-18 1.670651e-19
## 9       31 5.132212e-17 -0.85843911 -0.84985203 1.245379e-16 2.491625e-16
## 5       22 2.511926e-13 -0.89428720 -0.88927511 3.711622e-13 5.015120e-13
## 26      22 1.564605e-11 -0.78311557 -0.85423335 2.002556e-10 3.928719e-12
## 2       19 5.851091e-11 -0.85859115 -0.87076252 9.044799e-11 4.893714e-11
## 14      19 3.662479e-08 -0.75631770 -0.71231518 1.135934e-08 7.591141e-08
## 25      51 3.864014e-08 -0.41798854 -0.46831084 2.427091e-07 7.229049e-09
## 12      10 6.993237e-05 -0.74099684 -0.77501850 4.948957e-05 2.191278e-05
## 11      21 1.528545e-04 -0.49488422 -0.50940457 8.639334e-05 5.318105e-05
## 17      60 4.598722e-04 -0.27615577 -0.16661267 2.172375e-04 2.569236e-02
## 4       68 8.973591e-04 -0.24792952 -0.14957121 4.101207e-04 3.305621e-02
## 22      31 9.211060e-03  0.03144107  0.21101807 7.619922e-01 4.206934e-02
## 7       63 1.433187e-02 -0.12364966 -0.20145251 8.984079e-02 5.713843e-03
## 21      20 1.540622e-02  0.37300263  0.30910682 3.883350e-03 1.672262e-02
## 16     148 2.975029e-02 -0.04379208  0.03414573 3.585713e-01 4.740819e-01
##        s.dist          SD p.adjustMANOVA
## 24 1.16567801 0.015650031   3.256067e-81
## 20 1.24646406 0.031800425   6.013911e-56
## 15 1.12077340 0.047478264   6.027634e-43
## 13 1.02552750 0.053351514   5.636911e-22
## 18 1.05054640 0.024998980   2.331501e-20
## 10 0.76906627 0.018702498   7.376623e-19
## 9  1.20795951 0.006071986   1.906250e-16
## 5  1.26117399 0.003544080   8.163761e-13
## 26 1.15887213 0.050287861   4.519969e-11
## 2  1.22286799 0.008606453   1.521284e-10
## 14 1.03894628 0.031114482   8.372031e-08
## 25 0.62771766 0.035583240   8.372031e-08
## 12 1.07225463 0.024056946   1.398647e-04
## 11 0.71021364 0.010267436   2.838726e-04
## 17 0.32252409 0.077458663   7.971118e-04
## 4  0.28955240 0.069549829   1.458209e-03
## 22 0.21334752 0.126980108   1.408750e-02
## 7  0.23637333 0.055014923   2.070159e-02
## 21 0.48443574 0.045181158   2.108219e-02
## 16 0.05553086 0.055110351   3.867538e-02
unlink("Mst1TG_young_and_old_pathwayofinterest_mitch.html")
# top N gene heatmap
mitch_report(res, outfile = "Mst1TG_young_and_old_pathwayofinterest_mitch.html")
## Dataset saved as " /tmp/Rtmp8aocg6/Mst1TG_young_and_old_pathwayofinterest_mitch.rds ".
## 
## 
## processing file: mitch.Rmd
## 
  |                                                                            
  |                                                                      |   0%
  |                                                                            
  |..                                                                    |   3%
##    inline R code fragments
## 
## 
  |                                                                            
  |....                                                                  |   6%
## label: checklibraries (with options) 
## List of 1
##  $ echo: logi FALSE
## 
## 
  |                                                                            
  |......                                                                |   9%
##   ordinary text without R code
## 
## 
  |                                                                            
  |........                                                              |  12%
## label: peek (with options) 
## List of 1
##  $ echo: logi FALSE
## 
## 
  |                                                                            
  |..........                                                            |  15%
##   ordinary text without R code
## 
## 
  |                                                                            
  |............                                                          |  18%
## label: metrics (with options) 
## List of 1
##  $ echo: logi FALSE
## 
## 
  |                                                                            
  |..............                                                        |  21%
##   ordinary text without R code
## 
## 
  |                                                                            
  |................                                                      |  24%
## label: scatterplot (with options) 
## List of 5
##  $ echo      : logi FALSE
##  $ fig.height: num 6
##  $ fig.width : num 6.5
##  $ message   : logi FALSE
##  $ warning   : logi FALSE
## 
  |                                                                            
  |...................                                                   |  26%
##   ordinary text without R code
## 
## 
  |                                                                            
  |.....................                                                 |  29%
## label: contourplot (with options) 
## List of 5
##  $ echo      : logi FALSE
##  $ fig.height: num 6
##  $ fig.width : num 6.5
##  $ warning   : logi FALSE
##  $ message   : logi FALSE
## 
  |                                                                            
  |.......................                                               |  32%
##   ordinary text without R code
## 
## 
  |                                                                            
  |.........................                                             |  35%
## label: input_geneset_metrics1 (with options) 
## List of 2
##  $ results: chr "asis"
##  $ echo   : logi FALSE
## 
## 
  |                                                                            
  |...........................                                           |  38%
##   ordinary text without R code
## 
## 
  |                                                                            
  |.............................                                         |  41%
## label: input_geneset_metrics2 (with options) 
## List of 5
##  $ results   : chr "asis"
##  $ echo      : logi FALSE
##  $ fig.height: num 7
##  $ fig.width : num 7
##  $ fig.show  : chr "all"
## 
  |                                                                            
  |...............................                                       |  44%
##   ordinary text without R code
## 
## 
  |                                                                            
  |.................................                                     |  47%
## label: input_geneset_metrics3 (with options) 
## List of 5
##  $ results   : chr "asis"
##  $ echo      : logi FALSE
##  $ message   : logi FALSE
##  $ fig.height: num 7
##  $ fig.width : num 7
## 
  |                                                                            
  |...................................                                   |  50%
##   ordinary text without R code
## 
## 
  |                                                                            
  |.....................................                                 |  53%
## label: echart1d (with options) 
## List of 6
##  $ results   : chr "asis"
##  $ echo      : logi FALSE
##  $ fig.height: num 7
##  $ fig.width : num 7
##  $ fig.show  : chr "all"
##  $ message   : logi FALSE
## 
## 
  |                                                                            
  |.......................................                               |  56%
## label: echart2d (with options) 
## List of 6
##  $ results   : chr "asis"
##  $ echo      : logi FALSE
##  $ fig.height: num 7
##  $ fig.width : num 7
##  $ fig.show  : chr "all"
##  $ message   : logi FALSE
## 
## 
  |                                                                            
  |.........................................                             |  59%
##   ordinary text without R code
## 
## 
  |                                                                            
  |...........................................                           |  62%
## label: heatmap (with options) 
## List of 6
##  $ results   : chr "asis"
##  $ echo      : logi FALSE
##  $ fig.height: num 10
##  $ fig.width : num 7
##  $ fig.show  : chr "all"
##  $ message   : logi FALSE
## 
  |                                                                            
  |.............................................                         |  65%
##   ordinary text without R code
## 
## 
  |                                                                            
  |...............................................                       |  68%
## label: effectsize (with options) 
## List of 6
##  $ results   : chr "asis"
##  $ echo      : logi FALSE
##  $ fig.height: num 7
##  $ fig.width : num 7
##  $ fig.show  : chr "all"
##  $ message   : logi FALSE
## 
## 
  |                                                                            
  |.................................................                     |  71%
##   ordinary text without R code
## 
## 
  |                                                                            
  |...................................................                   |  74%
## label: results_table (with options) 
## List of 2
##  $ results: chr "asis"
##  $ echo   : logi FALSE
## 
## 
  |                                                                            
  |......................................................                |  76%
##   ordinary text without R code
## 
## 
  |                                                                            
  |........................................................              |  79%
## label: results_table_complete (with options) 
## List of 2
##  $ results: chr "asis"
##  $ echo   : logi FALSE
## 
## 
  |                                                                            
  |..........................................................            |  82%
##   ordinary text without R code
## 
## 
  |                                                                            
  |............................................................          |  85%
## label: detailed_geneset_reports1d (with options) 
## List of 7
##  $ results   : chr "asis"
##  $ echo      : logi FALSE
##  $ fig.height: num 6
##  $ fig.width : num 6
##  $ out.width : chr "80%"
##  $ comment   : logi NA
##  $ message   : logi FALSE
## 
## 
  |                                                                            
  |..............................................................        |  88%
##   ordinary text without R code
## 
## 
  |                                                                            
  |................................................................      |  91%
## label: detailed_geneset_reports2d (with options) 
## List of 7
##  $ results   : chr "asis"
##  $ echo      : logi FALSE
##  $ fig.height: num 5
##  $ fig.width : num 6
##  $ out.width : chr "80%"
##  $ comment   : logi NA
##  $ message   : logi FALSE
## 
  |                                                                            
  |..................................................................    |  94%
##   ordinary text without R code
## 
## 
  |                                                                            
  |....................................................................  |  97%
## label: session_info (with options) 
## List of 3
##  $ include: logi TRUE
##  $ echo   : logi TRUE
##  $ results: chr "markup"
## 
## 
  |                                                                            
  |......................................................................| 100%
##   ordinary text without R code
## output file: /mnt/bfx6/bfx/du_xiao/young_mst1tg/integrate/mitch.knit.md
## /usr/bin/pandoc +RTS -K512m -RTS /mnt/bfx6/bfx/du_xiao/young_mst1tg/integrate/mitch.utf8.md --to html4 --from markdown+autolink_bare_uris+tex_math_single_backslash --output /tmp/Rtmp8aocg6/mitch_report.html --email-obfuscation none --self-contained --standalone --section-divs --template /usr/local/lib/R/site-library/rmarkdown/rmd/h/default.html --no-highlight --variable highlightjs=1 --variable 'theme:bootstrap' --include-in-header /tmp/Rtmp8aocg6/rmarkdown-str7417210a4a39.html --mathjax --variable 'mathjax-url:https://mathjax.rstudio.com/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML'
## 
## Output created: /tmp/Rtmp8aocg6/mitch_report.html
## [1] TRUE
# heatmaps of pathways of interest
# colour scheme
colfunc <- colorRampPalette(c("blue", "white", "red"))

topsets <- head(res$enrichment_result,50)$set
mytopsets <- gsets[which(names( gsets ) %in% topsets)]
yo <- young[,7:ncol(young)]
colnames(yo) <- paste("y",colnames(yo))
ol <- old[,7:ncol(old)]
colnames(ol) <- paste("o",colnames(ol))
mx <- merge(yo,ol,by=0)
rownames(mx) <- mx$Row.names
mx$Row.names = NULL

i = 1
par(mar = c(10, 8, 8, 4) + 0.2)
for ( i in seq_along(mytopsets) ) {
  g <- as.vector(unlist(mytopsets[i]))
  symbol <- sapply((strsplit(rownames(mx)," ")),"[[",2)
  z <- mx[which(symbol %in% g),]
  SETNAME=names(mytopsets[i])
  heatmap.2( as.matrix(z), col=colfunc(25),scale="row",
   trace="none",margins = c(6,20), cexRow=.4, cexCol=.8)
  mtext(SETNAME)
}

Mitochondrial complexes

mt <- gmt_import("../ref/mt_complexes_mouse.gmt")

# have a look and check the gene names are correct
mt
## $`Complex-1`
##  [1] "1700029P11Rik" "mt-Nd1"        "mt-Nd2"        "mt-Nd3"       
##  [5] "mt-Nd4"        "mt-Nd4l"       "mt-Nd5"        "mt-Nd6"       
##  [9] "Ndufa1"        "Ndufa10"       "Ndufa11"       "Ndufa12"      
## [13] "Ndufa13"       "Ndufa2"        "Ndufa3"        "Ndufa5"       
## [17] "Ndufa6"        "Ndufa7"        "Ndufa8"        "Ndufa9"       
## [21] "Ndufab1"       "Ndufb10"       "Ndufb1-ps"     "Ndufb2"       
## [25] "Ndufb3"        "Ndufb4"        "Ndufb5"        "Ndufb6"       
## [29] "Ndufb7"        "Ndufb8"        "Ndufb9"        "Ndufc1"       
## [33] "Ndufc2"        "Ndufs1"        "Ndufs2"        "Ndufs3"       
## [37] "Ndufs4"        "Ndufs5"        "Ndufs6"        "Ndufs7"       
## [41] "Ndufs8"        "Ndufv1"        "Ndufv2"        "Ndufv3"       
## 
## $`Complex-1-Assembly-Factors`
##  [1] "Acad9"    "Ecsit"    "Foxred1"  "Ndufaf1"  "Ndufaf2"  "Ndufaf4" 
##  [7] "Ndufaf5"  "Ndufaf6"  "Ndufaf7"  "Ndufaf8"  "Nubpl"    "Timmdc1" 
## [13] "Tmem126b"
## 
## $`Complex-2`
## [1] "Sdha" "Sdhb" "Sdhc" "Sdhd"
## 
## $`Complex-2-Assembly-Factors`
## [1] "Sdhaf1" "Sdhaf2" "Sdhaf3" "Sdhaf4"
## 
## $`Complex-3`
## [1] "Cyc1"    "mt-Cytb" "Uqcr10"  "Uqcr11"  "Uqcrb"   "Uqcrc1"  "Uqcrc2" 
## [8] "Uqcrfs1" "Uqcrq"  
## 
## $`Complex-3-Assembly-Factors`
## [1] "Bcs1l" "Lyrm7" "Ptcd2" "Ttc19" "Uqcc1" "Uqcc2" "Uqcc3"
## 
## $`Complex-4`
## [1] "Cox5a"  "Cox5b"  "Cox6c"  "Cox7b"  "Cox7c"  "mt-Co1" "mt-Co2" "mt-Co3"
## 
## $`Complex-4-Assembly-Factors`
##  [1] "Apopt1"  "Cep89"   "Coa3"    "Coa4"    "Coa5"    "Coa6"    "Coa7"   
##  [8] "Cox10"   "Cox11"   "Cox14"   "Cox16"   "Cox18"   "Cox19"   "Cox20"  
## [15] "Fastkd2" "Gm21987" "Lrpprc"  "Ndufa4"  "Oxa1l"   "Pet100"  "Pet117" 
## [22] "Sco1"    "Sco2"    "Surf1"   "Taco1"  
## 
## $`Complex-5`
##  [1] "Atp5a1"  "Atp5b"   "Atp5c1"  "Atp5d"   "Atp5e"   "Atp5g3"  "Atp5h"  
##  [8] "Atp5j"   "Atp5j2"  "Atp5k"   "Atp5l"   "Atp5o"   "Atp5pb"  "mt-Atp6"
## [15] "mt-Atp8"
## 
## $`Complex-5-Assembly-Factors`
## [1] "Atpaf1" "Atpaf2" "Tmem70"
## 
## attr(,"originfile")
## [1] "../ref/mt_complexes_mouse.gmt"
# mitch pathways of interest
res <- mitch_calc(yy, mt, priority="effect",minsetsize=3)
## Note: Enrichments with large effect sizes may not be 
##             statistically significant.
head(res$enrichment_result,20)
##                           set setSize      pMANOVA    s.young      s.old
## 3                   Complex-2       4 1.630452e-03 -0.9933773 -0.9735090
## 7                   Complex-4       8 7.489554e-06 -0.9618838 -0.9204889
## 1                   Complex-1      43 5.682735e-28 -0.9484747 -0.9254259
## 5                   Complex-3       9 2.035360e-06 -0.9607360 -0.9060473
## 9                   Complex-5      15 4.962915e-10 -0.9358364 -0.9197416
## 10 Complex-5-Assembly-Factors       3 1.395221e-02 -0.9142575 -0.9381023
## 2  Complex-1-Assembly-Factors      13 2.965384e-07 -0.8456363 -0.8233419
## 4  Complex-2-Assembly-Factors       4 1.885567e-02 -0.8053184 -0.7200968
## 6  Complex-3-Assembly-Factors       7 2.810338e-03 -0.7364204 -0.6735325
## 8  Complex-4-Assembly-Factors      23 7.371441e-07 -0.6348575 -0.5616581
##         p.young        p.old    s.dist         SD p.adjustMANOVA
## 3  5.793699e-04 7.455891e-04 1.3908696 0.01404895   2.329217e-03
## 7  2.448833e-06 6.500947e-06 1.3313603 0.02927058   1.248259e-05
## 1  4.414790e-27 7.427705e-26 1.3251481 0.01629801   5.682735e-27
## 5  5.966715e-07 2.502900e-06 1.3205814 0.03867073   4.070720e-06
## 9  3.424155e-10 6.823345e-10 1.3121411 0.01138070   2.481457e-09
## 10 6.095260e-03 4.890470e-03 1.3099247 0.01686078   1.550245e-02
## 2  1.286773e-07 2.727380e-07 1.1802511 0.01576455   9.884612e-07
## 4  5.279602e-03 1.262398e-02 1.0803134 0.06026073   1.885567e-02
## 6  7.401164e-04 2.028537e-03 0.9979785 0.04446845   3.512922e-03
## 8  1.353405e-07 3.113497e-06 0.8476461 0.05175981   1.842860e-06
unlink("Mst1TG_young_and_old_mitocomplex_mitch.html")
# top N gene heatmap
mitch_report(res, outfile = "Mst1TG_young_and_old_mitocomplex_mitch.html")
## Dataset saved as " /tmp/Rtmp8aocg6/Mst1TG_young_and_old_mitocomplex_mitch.rds ".
## 
## 
## processing file: mitch.Rmd
## 
  |                                                                            
  |                                                                      |   0%
  |                                                                            
  |..                                                                    |   3%
##    inline R code fragments
## 
## 
  |                                                                            
  |....                                                                  |   6%
## label: checklibraries (with options) 
## List of 1
##  $ echo: logi FALSE
## 
## 
  |                                                                            
  |......                                                                |   9%
##   ordinary text without R code
## 
## 
  |                                                                            
  |........                                                              |  12%
## label: peek (with options) 
## List of 1
##  $ echo: logi FALSE
## 
## 
  |                                                                            
  |..........                                                            |  15%
##   ordinary text without R code
## 
## 
  |                                                                            
  |............                                                          |  18%
## label: metrics (with options) 
## List of 1
##  $ echo: logi FALSE
## 
## 
  |                                                                            
  |..............                                                        |  21%
##   ordinary text without R code
## 
## 
  |                                                                            
  |................                                                      |  24%
## label: scatterplot (with options) 
## List of 5
##  $ echo      : logi FALSE
##  $ fig.height: num 6
##  $ fig.width : num 6.5
##  $ message   : logi FALSE
##  $ warning   : logi FALSE
## 
  |                                                                            
  |...................                                                   |  26%
##   ordinary text without R code
## 
## 
  |                                                                            
  |.....................                                                 |  29%
## label: contourplot (with options) 
## List of 5
##  $ echo      : logi FALSE
##  $ fig.height: num 6
##  $ fig.width : num 6.5
##  $ warning   : logi FALSE
##  $ message   : logi FALSE
## 
  |                                                                            
  |.......................                                               |  32%
##   ordinary text without R code
## 
## 
  |                                                                            
  |.........................                                             |  35%
## label: input_geneset_metrics1 (with options) 
## List of 2
##  $ results: chr "asis"
##  $ echo   : logi FALSE
## 
## 
  |                                                                            
  |...........................                                           |  38%
##   ordinary text without R code
## 
## 
  |                                                                            
  |.............................                                         |  41%
## label: input_geneset_metrics2 (with options) 
## List of 5
##  $ results   : chr "asis"
##  $ echo      : logi FALSE
##  $ fig.height: num 7
##  $ fig.width : num 7
##  $ fig.show  : chr "all"
## 
  |                                                                            
  |...............................                                       |  44%
##   ordinary text without R code
## 
## 
  |                                                                            
  |.................................                                     |  47%
## label: input_geneset_metrics3 (with options) 
## List of 5
##  $ results   : chr "asis"
##  $ echo      : logi FALSE
##  $ message   : logi FALSE
##  $ fig.height: num 7
##  $ fig.width : num 7
## 
  |                                                                            
  |...................................                                   |  50%
##   ordinary text without R code
## 
## 
  |                                                                            
  |.....................................                                 |  53%
## label: echart1d (with options) 
## List of 6
##  $ results   : chr "asis"
##  $ echo      : logi FALSE
##  $ fig.height: num 7
##  $ fig.width : num 7
##  $ fig.show  : chr "all"
##  $ message   : logi FALSE
## 
## 
  |                                                                            
  |.......................................                               |  56%
## label: echart2d (with options) 
## List of 6
##  $ results   : chr "asis"
##  $ echo      : logi FALSE
##  $ fig.height: num 7
##  $ fig.width : num 7
##  $ fig.show  : chr "all"
##  $ message   : logi FALSE
## 
## 
  |                                                                            
  |.........................................                             |  59%
##   ordinary text without R code
## 
## 
  |                                                                            
  |...........................................                           |  62%
## label: heatmap (with options) 
## List of 6
##  $ results   : chr "asis"
##  $ echo      : logi FALSE
##  $ fig.height: num 10
##  $ fig.width : num 7
##  $ fig.show  : chr "all"
##  $ message   : logi FALSE
## 
  |                                                                            
  |.............................................                         |  65%
##   ordinary text without R code
## 
## 
  |                                                                            
  |...............................................                       |  68%
## label: effectsize (with options) 
## List of 6
##  $ results   : chr "asis"
##  $ echo      : logi FALSE
##  $ fig.height: num 7
##  $ fig.width : num 7
##  $ fig.show  : chr "all"
##  $ message   : logi FALSE
## 
## 
  |                                                                            
  |.................................................                     |  71%
##   ordinary text without R code
## 
## 
  |                                                                            
  |...................................................                   |  74%
## label: results_table (with options) 
## List of 2
##  $ results: chr "asis"
##  $ echo   : logi FALSE
## 
## 
  |                                                                            
  |......................................................                |  76%
##   ordinary text without R code
## 
## 
  |                                                                            
  |........................................................              |  79%
## label: results_table_complete (with options) 
## List of 2
##  $ results: chr "asis"
##  $ echo   : logi FALSE
## 
## 
  |                                                                            
  |..........................................................            |  82%
##   ordinary text without R code
## 
## 
  |                                                                            
  |............................................................          |  85%
## label: detailed_geneset_reports1d (with options) 
## List of 7
##  $ results   : chr "asis"
##  $ echo      : logi FALSE
##  $ fig.height: num 6
##  $ fig.width : num 6
##  $ out.width : chr "80%"
##  $ comment   : logi NA
##  $ message   : logi FALSE
## 
## 
  |                                                                            
  |..............................................................        |  88%
##   ordinary text without R code
## 
## 
  |                                                                            
  |................................................................      |  91%
## label: detailed_geneset_reports2d (with options) 
## List of 7
##  $ results   : chr "asis"
##  $ echo      : logi FALSE
##  $ fig.height: num 5
##  $ fig.width : num 6
##  $ out.width : chr "80%"
##  $ comment   : logi NA
##  $ message   : logi FALSE
## 
  |                                                                            
  |..................................................................    |  94%
##   ordinary text without R code
## 
## 
  |                                                                            
  |....................................................................  |  97%
## label: session_info (with options) 
## List of 3
##  $ include: logi TRUE
##  $ echo   : logi TRUE
##  $ results: chr "markup"
## 
## 
  |                                                                            
  |......................................................................| 100%
##   ordinary text without R code
## output file: /mnt/bfx6/bfx/du_xiao/young_mst1tg/integrate/mitch.knit.md
## /usr/bin/pandoc +RTS -K512m -RTS /mnt/bfx6/bfx/du_xiao/young_mst1tg/integrate/mitch.utf8.md --to html4 --from markdown+autolink_bare_uris+tex_math_single_backslash --output /tmp/Rtmp8aocg6/mitch_report.html --email-obfuscation none --self-contained --standalone --section-divs --template /usr/local/lib/R/site-library/rmarkdown/rmd/h/default.html --no-highlight --variable highlightjs=1 --variable 'theme:bootstrap' --include-in-header /tmp/Rtmp8aocg6/rmarkdown-str74172298d707.html --mathjax --variable 'mathjax-url:https://mathjax.rstudio.com/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML'
## 
## Output created: /tmp/Rtmp8aocg6/mitch_report.html
## [1] TRUE
mytopsets <- head(res$enrichment_result,50)$set

i = 1
par(mar = c(10, 8, 8, 4) + 0.2)

for ( i in seq_along(mt) ) {
  g <- as.vector(unlist(mt[i]))
  symbol <- sapply((strsplit(rownames(mx)," ")),"[[",2)
  z <- mx[which(symbol %in% g),]
  SETNAME=names(mt)[i]
  heatmap.2( as.matrix(z), col=colfunc(25),scale="row",
   trace="none",margins = c(6,20), cexRow=.8, cexCol=.8)
  mtext(SETNAME)
}

# now 1D mitch for young and old to create beeswarm charts
young <- yy[,1,drop=FALSE] 
res <- mitch_calc(young, mt, priority="effect",minsetsize=3)
## Note: Enrichments with large effect sizes may not be
##             statistically significant.
head(res$enrichment_result,20)
##                           set setSize       pANOVA     s.dist p.adjustANOVA
## 3                   Complex-2       4 5.793699e-04 -0.9933773  8.276713e-04
## 7                   Complex-4       8 2.448833e-06 -0.9618838  4.081389e-06
## 5                   Complex-3       9 5.966715e-07 -0.9607360  1.193343e-06
## 1                   Complex-1      43 4.414790e-27 -0.9484747  4.414790e-26
## 9                   Complex-5      15 3.424155e-10 -0.9358364  1.712077e-09
## 10 Complex-5-Assembly-Factors       3 6.095260e-03 -0.9142575  6.095260e-03
## 2  Complex-1-Assembly-Factors      13 1.286773e-07 -0.8456363  3.383513e-07
## 4  Complex-2-Assembly-Factors       4 5.279602e-03 -0.8053184  5.866225e-03
## 6  Complex-3-Assembly-Factors       7 7.401164e-04 -0.7364204  9.251456e-04
## 8  Complex-4-Assembly-Factors      23 1.353405e-07 -0.6348575  3.383513e-07
unlink("Mst1TG_young_mitocomplex_mitch.html")
mitch_report(res, outfile = "Mst1TG_young_mitocomplex_mitch.html")
## Dataset saved as " /tmp/Rtmp8aocg6/Mst1TG_young_mitocomplex_mitch.rds ".
## 
## 
## processing file: mitch.Rmd
## 
  |                                                                            
  |                                                                      |   0%
  |                                                                            
  |..                                                                    |   3%
##    inline R code fragments
## 
## 
  |                                                                            
  |....                                                                  |   6%
## label: checklibraries (with options) 
## List of 1
##  $ echo: logi FALSE
## 
## 
  |                                                                            
  |......                                                                |   9%
##   ordinary text without R code
## 
## 
  |                                                                            
  |........                                                              |  12%
## label: peek (with options) 
## List of 1
##  $ echo: logi FALSE
## 
## 
  |                                                                            
  |..........                                                            |  15%
##   ordinary text without R code
## 
## 
  |                                                                            
  |............                                                          |  18%
## label: metrics (with options) 
## List of 1
##  $ echo: logi FALSE
## 
## 
  |                                                                            
  |..............                                                        |  21%
##   ordinary text without R code
## 
## 
  |                                                                            
  |................                                                      |  24%
## label: scatterplot (with options) 
## List of 5
##  $ echo      : logi FALSE
##  $ fig.height: num 6
##  $ fig.width : num 6.5
##  $ message   : logi FALSE
##  $ warning   : logi FALSE
## 
  |                                                                            
  |...................                                                   |  26%
##   ordinary text without R code
## 
## 
  |                                                                            
  |.....................                                                 |  29%
## label: contourplot (with options) 
## List of 5
##  $ echo      : logi FALSE
##  $ fig.height: num 6
##  $ fig.width : num 6.5
##  $ warning   : logi FALSE
##  $ message   : logi FALSE
## Contour plot does not apply to unidimensional analysis.
## 
  |                                                                            
  |.......................                                               |  32%
##   ordinary text without R code
## 
## 
  |                                                                            
  |.........................                                             |  35%
## label: input_geneset_metrics1 (with options) 
## List of 2
##  $ results: chr "asis"
##  $ echo   : logi FALSE
## 
## 
  |                                                                            
  |...........................                                           |  38%
##   ordinary text without R code
## 
## 
  |                                                                            
  |.............................                                         |  41%
## label: input_geneset_metrics2 (with options) 
## List of 5
##  $ results   : chr "asis"
##  $ echo      : logi FALSE
##  $ fig.height: num 7
##  $ fig.width : num 7
##  $ fig.show  : chr "all"
## 
  |                                                                            
  |...............................                                       |  44%
##   ordinary text without R code
## 
## 
  |                                                                            
  |.................................                                     |  47%
## label: input_geneset_metrics3 (with options) 
## List of 5
##  $ results   : chr "asis"
##  $ echo      : logi FALSE
##  $ message   : logi FALSE
##  $ fig.height: num 7
##  $ fig.width : num 7
## 
  |                                                                            
  |...................................                                   |  50%
##   ordinary text without R code
## 
## 
  |                                                                            
  |.....................................                                 |  53%
## label: echart1d (with options) 
## List of 6
##  $ results   : chr "asis"
##  $ echo      : logi FALSE
##  $ fig.height: num 7
##  $ fig.width : num 7
##  $ fig.show  : chr "all"
##  $ message   : logi FALSE
## 
## 
  |                                                                            
  |.......................................                               |  56%
## label: echart2d (with options) 
## List of 6
##  $ results   : chr "asis"
##  $ echo      : logi FALSE
##  $ fig.height: num 7
##  $ fig.width : num 7
##  $ fig.show  : chr "all"
##  $ message   : logi FALSE
## 
## 
  |                                                                            
  |.........................................                             |  59%
##   ordinary text without R code
## 
## 
  |                                                                            
  |...........................................                           |  62%
## label: heatmap (with options) 
## List of 6
##  $ results   : chr "asis"
##  $ echo      : logi FALSE
##  $ fig.height: num 10
##  $ fig.width : num 7
##  $ fig.show  : chr "all"
##  $ message   : logi FALSE
## 
## 
  |                                                                            
  |.............................................                         |  65%
##   ordinary text without R code
## 
## 
  |                                                                            
  |...............................................                       |  68%
## label: effectsize (with options) 
## List of 6
##  $ results   : chr "asis"
##  $ echo      : logi FALSE
##  $ fig.height: num 7
##  $ fig.width : num 7
##  $ fig.show  : chr "all"
##  $ message   : logi FALSE
## 
## 
  |                                                                            
  |.................................................                     |  71%
##   ordinary text without R code
## 
## 
  |                                                                            
  |...................................................                   |  74%
## label: results_table (with options) 
## List of 2
##  $ results: chr "asis"
##  $ echo   : logi FALSE
## 
## 
  |                                                                            
  |......................................................                |  76%
##   ordinary text without R code
## 
## 
  |                                                                            
  |........................................................              |  79%
## label: results_table_complete (with options) 
## List of 2
##  $ results: chr "asis"
##  $ echo   : logi FALSE
## 
## 
  |                                                                            
  |..........................................................            |  82%
##   ordinary text without R code
## 
## 
  |                                                                            
  |............................................................          |  85%
## label: detailed_geneset_reports1d (with options) 
## List of 7
##  $ results   : chr "asis"
##  $ echo      : logi FALSE
##  $ fig.height: num 6
##  $ fig.width : num 6
##  $ out.width : chr "80%"
##  $ comment   : logi NA
##  $ message   : logi FALSE
## 
  |                                                                            
  |..............................................................        |  88%
##   ordinary text without R code
## 
## 
  |                                                                            
  |................................................................      |  91%
## label: detailed_geneset_reports2d (with options) 
## List of 7
##  $ results   : chr "asis"
##  $ echo      : logi FALSE
##  $ fig.height: num 5
##  $ fig.width : num 6
##  $ out.width : chr "80%"
##  $ comment   : logi NA
##  $ message   : logi FALSE
## 
## 
  |                                                                            
  |..................................................................    |  94%
##   ordinary text without R code
## 
## 
  |                                                                            
  |....................................................................  |  97%
## label: session_info (with options) 
## List of 3
##  $ include: logi TRUE
##  $ echo   : logi TRUE
##  $ results: chr "markup"
## 
## 
  |                                                                            
  |......................................................................| 100%
##   ordinary text without R code
## output file: /mnt/bfx6/bfx/du_xiao/young_mst1tg/integrate/mitch.knit.md
## /usr/bin/pandoc +RTS -K512m -RTS /mnt/bfx6/bfx/du_xiao/young_mst1tg/integrate/mitch.utf8.md --to html4 --from markdown+autolink_bare_uris+tex_math_single_backslash --output /tmp/Rtmp8aocg6/mitch_report.html --email-obfuscation none --self-contained --standalone --section-divs --template /usr/local/lib/R/site-library/rmarkdown/rmd/h/default.html --no-highlight --variable highlightjs=1 --variable 'theme:bootstrap' --include-in-header /tmp/Rtmp8aocg6/rmarkdown-str74175b0e99e8.html --mathjax --variable 'mathjax-url:https://mathjax.rstudio.com/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML'
## 
## Output created: /tmp/Rtmp8aocg6/mitch_report.html
## [1] TRUE
old <- yy[,2,drop=FALSE]
res <- mitch_calc(old, mt, priority="effect",minsetsize=3)
## Note: Enrichments with large effect sizes may not be
##             statistically significant.
head(res$enrichment_result,20)
##                           set setSize       pANOVA     s.dist p.adjustANOVA
## 3                   Complex-2       4 7.455891e-04 -0.9735090  1.065127e-03
## 10 Complex-5-Assembly-Factors       3 4.890470e-03 -0.9381023  5.433856e-03
## 1                   Complex-1      43 7.427705e-26 -0.9254259  7.427705e-25
## 7                   Complex-4       8 6.500947e-06 -0.9204889  1.083491e-05
## 9                   Complex-5      15 6.823345e-10 -0.9197416  3.411672e-09
## 5                   Complex-3       9 2.502900e-06 -0.9060473  6.226995e-06
## 2  Complex-1-Assembly-Factors      13 2.727380e-07 -0.8233419  9.091267e-07
## 4  Complex-2-Assembly-Factors       4 1.262398e-02 -0.7200968  1.262398e-02
## 6  Complex-3-Assembly-Factors       7 2.028537e-03 -0.6735325  2.535671e-03
## 8  Complex-4-Assembly-Factors      23 3.113497e-06 -0.5616581  6.226995e-06
unlink("Mst1TG_old_mitocomplex_mitch.html")
mitch_report(res, outfile = "Mst1TG_old_mitocomplex_mitch.html")
## Dataset saved as " /tmp/Rtmp8aocg6/Mst1TG_old_mitocomplex_mitch.rds ".
## 
## 
## processing file: mitch.Rmd
## 
  |                                                                            
  |                                                                      |   0%
  |                                                                            
  |..                                                                    |   3%
##    inline R code fragments
## 
## 
  |                                                                            
  |....                                                                  |   6%
## label: checklibraries (with options) 
## List of 1
##  $ echo: logi FALSE
## 
## 
  |                                                                            
  |......                                                                |   9%
##   ordinary text without R code
## 
## 
  |                                                                            
  |........                                                              |  12%
## label: peek (with options) 
## List of 1
##  $ echo: logi FALSE
## 
## 
  |                                                                            
  |..........                                                            |  15%
##   ordinary text without R code
## 
## 
  |                                                                            
  |............                                                          |  18%
## label: metrics (with options) 
## List of 1
##  $ echo: logi FALSE
## 
## 
  |                                                                            
  |..............                                                        |  21%
##   ordinary text without R code
## 
## 
  |                                                                            
  |................                                                      |  24%
## label: scatterplot (with options) 
## List of 5
##  $ echo      : logi FALSE
##  $ fig.height: num 6
##  $ fig.width : num 6.5
##  $ message   : logi FALSE
##  $ warning   : logi FALSE
## 
  |                                                                            
  |...................                                                   |  26%
##   ordinary text without R code
## 
## 
  |                                                                            
  |.....................                                                 |  29%
## label: contourplot (with options) 
## List of 5
##  $ echo      : logi FALSE
##  $ fig.height: num 6
##  $ fig.width : num 6.5
##  $ warning   : logi FALSE
##  $ message   : logi FALSE
## Contour plot does not apply to unidimensional analysis.
## 
  |                                                                            
  |.......................                                               |  32%
##   ordinary text without R code
## 
## 
  |                                                                            
  |.........................                                             |  35%
## label: input_geneset_metrics1 (with options) 
## List of 2
##  $ results: chr "asis"
##  $ echo   : logi FALSE
## 
## 
  |                                                                            
  |...........................                                           |  38%
##   ordinary text without R code
## 
## 
  |                                                                            
  |.............................                                         |  41%
## label: input_geneset_metrics2 (with options) 
## List of 5
##  $ results   : chr "asis"
##  $ echo      : logi FALSE
##  $ fig.height: num 7
##  $ fig.width : num 7
##  $ fig.show  : chr "all"
## 
  |                                                                            
  |...............................                                       |  44%
##   ordinary text without R code
## 
## 
  |                                                                            
  |.................................                                     |  47%
## label: input_geneset_metrics3 (with options) 
## List of 5
##  $ results   : chr "asis"
##  $ echo      : logi FALSE
##  $ message   : logi FALSE
##  $ fig.height: num 7
##  $ fig.width : num 7
## 
  |                                                                            
  |...................................                                   |  50%
##   ordinary text without R code
## 
## 
  |                                                                            
  |.....................................                                 |  53%
## label: echart1d (with options) 
## List of 6
##  $ results   : chr "asis"
##  $ echo      : logi FALSE
##  $ fig.height: num 7
##  $ fig.width : num 7
##  $ fig.show  : chr "all"
##  $ message   : logi FALSE
## 
## 
  |                                                                            
  |.......................................                               |  56%
## label: echart2d (with options) 
## List of 6
##  $ results   : chr "asis"
##  $ echo      : logi FALSE
##  $ fig.height: num 7
##  $ fig.width : num 7
##  $ fig.show  : chr "all"
##  $ message   : logi FALSE
## 
## 
  |                                                                            
  |.........................................                             |  59%
##   ordinary text without R code
## 
## 
  |                                                                            
  |...........................................                           |  62%
## label: heatmap (with options) 
## List of 6
##  $ results   : chr "asis"
##  $ echo      : logi FALSE
##  $ fig.height: num 10
##  $ fig.width : num 7
##  $ fig.show  : chr "all"
##  $ message   : logi FALSE
## 
## 
  |                                                                            
  |.............................................                         |  65%
##   ordinary text without R code
## 
## 
  |                                                                            
  |...............................................                       |  68%
## label: effectsize (with options) 
## List of 6
##  $ results   : chr "asis"
##  $ echo      : logi FALSE
##  $ fig.height: num 7
##  $ fig.width : num 7
##  $ fig.show  : chr "all"
##  $ message   : logi FALSE
## 
## 
  |                                                                            
  |.................................................                     |  71%
##   ordinary text without R code
## 
## 
  |                                                                            
  |...................................................                   |  74%
## label: results_table (with options) 
## List of 2
##  $ results: chr "asis"
##  $ echo   : logi FALSE
## 
## 
  |                                                                            
  |......................................................                |  76%
##   ordinary text without R code
## 
## 
  |                                                                            
  |........................................................              |  79%
## label: results_table_complete (with options) 
## List of 2
##  $ results: chr "asis"
##  $ echo   : logi FALSE
## 
## 
  |                                                                            
  |..........................................................            |  82%
##   ordinary text without R code
## 
## 
  |                                                                            
  |............................................................          |  85%
## label: detailed_geneset_reports1d (with options) 
## List of 7
##  $ results   : chr "asis"
##  $ echo      : logi FALSE
##  $ fig.height: num 6
##  $ fig.width : num 6
##  $ out.width : chr "80%"
##  $ comment   : logi NA
##  $ message   : logi FALSE
## 
  |                                                                            
  |..............................................................        |  88%
##   ordinary text without R code
## 
## 
  |                                                                            
  |................................................................      |  91%
## label: detailed_geneset_reports2d (with options) 
## List of 7
##  $ results   : chr "asis"
##  $ echo      : logi FALSE
##  $ fig.height: num 5
##  $ fig.width : num 6
##  $ out.width : chr "80%"
##  $ comment   : logi NA
##  $ message   : logi FALSE
## 
## 
  |                                                                            
  |..................................................................    |  94%
##   ordinary text without R code
## 
## 
  |                                                                            
  |....................................................................  |  97%
## label: session_info (with options) 
## List of 3
##  $ include: logi TRUE
##  $ echo   : logi TRUE
##  $ results: chr "markup"
## 
## 
  |                                                                            
  |......................................................................| 100%
##   ordinary text without R code
## output file: /mnt/bfx6/bfx/du_xiao/young_mst1tg/integrate/mitch.knit.md
## /usr/bin/pandoc +RTS -K512m -RTS /mnt/bfx6/bfx/du_xiao/young_mst1tg/integrate/mitch.utf8.md --to html4 --from markdown+autolink_bare_uris+tex_math_single_backslash --output /tmp/Rtmp8aocg6/mitch_report.html --email-obfuscation none --self-contained --standalone --section-divs --template /usr/local/lib/R/site-library/rmarkdown/rmd/h/default.html --no-highlight --variable highlightjs=1 --variable 'theme:bootstrap' --include-in-header /tmp/Rtmp8aocg6/rmarkdown-str741742e8809e.html --mathjax --variable 'mathjax-url:https://mathjax.rstudio.com/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML'
## 
## Output created: /tmp/Rtmp8aocg6/mitch_report.html

## [1] TRUE

System information

sessionInfo()
## R version 4.0.3 (2020-10-10)
## Platform: x86_64-pc-linux-gnu (64-bit)
## Running under: Ubuntu 18.04.5 LTS
## 
## Matrix products: default
## BLAS:   /usr/lib/x86_64-linux-gnu/blas/libblas.so.3.7.1
## LAPACK: /usr/lib/x86_64-linux-gnu/lapack/liblapack.so.3.7.1
## 
## 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       
## 
## attached base packages:
## [1] stats     graphics  grDevices utils     datasets  methods   base     
## 
## other attached packages:
##  [1] pkgload_1.1.0   GGally_2.0.0    beeswarm_0.2.3  gtools_3.8.2   
##  [5] echarts4r_0.3.3 mitch_1.2.2     gplots_3.1.0    reshape2_1.4.4 
##  [9] forcats_0.5.0   stringr_1.4.0   dplyr_1.0.2     purrr_0.3.4    
## [13] readr_1.4.0     tidyr_1.1.2     tibble_3.0.4    ggplot2_3.3.2  
## [17] tidyverse_1.3.0
## 
## loaded via a namespace (and not attached):
##  [1] httr_1.4.2         jsonlite_1.7.1     modelr_0.1.8       shiny_1.5.0       
##  [5] assertthat_0.2.1   highr_0.8          cellranger_1.1.0   yaml_2.2.1        
##  [9] pillar_1.4.6       backports_1.2.0    glue_1.4.2         digest_0.6.27     
## [13] RColorBrewer_1.1-2 promises_1.1.1     rvest_0.3.6        colorspace_2.0-0  
## [17] htmltools_0.5.0    httpuv_1.5.4       plyr_1.8.6         pkgconfig_2.0.3   
## [21] broom_0.7.2        haven_2.3.1        xtable_1.8-4       scales_1.1.1      
## [25] later_1.1.0.1      farver_2.0.3       generics_0.1.0     ellipsis_0.3.1    
## [29] withr_2.3.0        cli_2.1.0          magrittr_1.5       crayon_1.3.4      
## [33] readxl_1.3.1       mime_0.9           evaluate_0.14      ps_1.4.0          
## [37] fs_1.5.0           fansi_0.4.1        MASS_7.3-53        xml2_1.3.2        
## [41] tools_4.0.3        hms_0.5.3          lifecycle_0.2.0    munsell_0.5.0     
## [45] reprex_0.3.0       compiler_4.0.3     caTools_1.18.0     rlang_0.4.8       
## [49] grid_4.0.3         rstudioapi_0.12    htmlwidgets_1.5.2  labeling_0.4.2    
## [53] bitops_1.0-6       rmarkdown_2.5      testthat_3.0.0     gtable_0.3.0      
## [57] DBI_1.1.0          reshape_0.8.8      R6_2.5.0           gridExtra_2.3     
## [61] lubridate_1.7.9    knitr_1.30         fastmap_1.0.1      rprojroot_1.3-2   
## [65] desc_1.2.0         KernSmooth_2.23-18 stringi_1.5.3      parallel_4.0.3    
## [69] Rcpp_1.0.5         vctrs_0.3.4        dbplyr_2.0.0       tidyselect_1.1.0  
## [73] xfun_0.19