Gene-set-Analysen

In diesem Skript arbeiten wir weiter mit dem Ergebnis des Vergleichs der Gen-Expressions-Daten vom Herz von Mäusen im Alter 63 Tage (P63) zu neugeborenen Mäusen (P0).

DESeq-Analyse

Hier ist nochmal die Analyse, wie wir sie letztes Mal durcvhgeführt haben:

suppressPackageStartupMessages({ 
  library( tidyverse )
  library( DESeq2 ) })

# Read full count data
read_tsv( "Downloads/evodevo_mouse_counts.tsv.gz" ) -> mouse_counts_all
Rows: 36141 Columns: 317
── Column specification ────────────────────────────────────────────────────────
Delimiter: "\t"
chr   (1): gene_id
dbl (316): Brain_e10.5_1, Brain_e10.5_2, Brain_e10.5_3, Brain_e11.5_1, Brain...

ℹ Use `spec()` to retrieve the full column specification for this data.
ℹ Specify the column types or set `show_col_types = FALSE` to quiet this message.
# Subset to only relevant samples 
mouse_counts_all %>% 
select( gene_id, starts_with("Heart_P0"), starts_with("Heart_P63") ) %>%
column_to_rownames( "gene_id" ) %>% 
as.matrix -> count_matrix

# Make sample table
tibble( sampleName = colnames(count_matrix) ) %>%
mutate( timepoint = str_extract( sampleName, "P\\d+" ) ) -> sample_table

# Make DESeq object
DESeqDataSetFromMatrix( count_matrix, sample_table, ~timepoint ) -> dds
converting counts to integer mode
Warning in DESeqDataSet(se, design = design, ignoreRank): some variables in
design formula are characters, converting to factors
# Run DESeq
dds %>% DESeq -> dds
estimating size factors
estimating dispersions
gene-wise dispersion estimates
mean-dispersion relationship
final dispersion estimates
fitting model and testing
# Perform LFC shrinkage and get results
lfcShrink( dds, coef=2 ) -> res0
using 'apeglm' for LFC shrinkage. If used in published research, please cite:
    Zhu, A., Ibrahim, J.G., Love, M.I. (2018) Heavy-tailed prior distributions for
    sequence count data: removing the noise and preserving large differences.
    Bioinformatics. https://doi.org/10.1093/bioinformatics/bty895
Warning in nbinomGLM(x = x, Y = YNZ, size = size, weights = weightsNZ, offset =
offsetNZ, : the line search routine failed, unable to sufficiently decrease the
function value
Warning in nbinomGLM(x = x, Y = YNZ, size = size, weights = weightsNZ, offset =
offsetNZ, : the line search routine failed, unable to sufficiently decrease the
function value

Warning in nbinomGLM(x = x, Y = YNZ, size = size, weights = weightsNZ, offset =
offsetNZ, : the line search routine failed, unable to sufficiently decrease the
function value

Warning in nbinomGLM(x = x, Y = YNZ, size = size, weights = weightsNZ, offset =
offsetNZ, : the line search routine failed, unable to sufficiently decrease the
function value

Warning in nbinomGLM(x = x, Y = YNZ, size = size, weights = weightsNZ, offset =
offsetNZ, : the line search routine failed, unable to sufficiently decrease the
function value

Warning in nbinomGLM(x = x, Y = YNZ, size = size, weights = weightsNZ, offset =
offsetNZ, : the line search routine failed, unable to sufficiently decrease the
function value

Warning in nbinomGLM(x = x, Y = YNZ, size = size, weights = weightsNZ, offset =
offsetNZ, : the line search routine failed, unable to sufficiently decrease the
function value

Warning in nbinomGLM(x = x, Y = YNZ, size = size, weights = weightsNZ, offset =
offsetNZ, : the line search routine failed, unable to sufficiently decrease the
function value

Warning in nbinomGLM(x = x, Y = YNZ, size = size, weights = weightsNZ, offset =
offsetNZ, : the line search routine failed, unable to sufficiently decrease the
function value

Warning in nbinomGLM(x = x, Y = YNZ, size = size, weights = weightsNZ, offset =
offsetNZ, : the line search routine failed, unable to sufficiently decrease the
function value

Warning in nbinomGLM(x = x, Y = YNZ, size = size, weights = weightsNZ, offset =
offsetNZ, : the line search routine failed, unable to sufficiently decrease the
function value

Warning in nbinomGLM(x = x, Y = YNZ, size = size, weights = weightsNZ, offset =
offsetNZ, : the line search routine failed, unable to sufficiently decrease the
function value

Warning in nbinomGLM(x = x, Y = YNZ, size = size, weights = weightsNZ, offset =
offsetNZ, : the line search routine failed, unable to sufficiently decrease the
function value

Warning in nbinomGLM(x = x, Y = YNZ, size = size, weights = weightsNZ, offset =
offsetNZ, : the line search routine failed, unable to sufficiently decrease the
function value

Warning in nbinomGLM(x = x, Y = YNZ, size = size, weights = weightsNZ, offset =
offsetNZ, : the line search routine failed, unable to sufficiently decrease the
function value

Warning in nbinomGLM(x = x, Y = YNZ, size = size, weights = weightsNZ, offset =
offsetNZ, : the line search routine failed, unable to sufficiently decrease the
function value

Warning in nbinomGLM(x = x, Y = YNZ, size = size, weights = weightsNZ, offset =
offsetNZ, : the line search routine failed, unable to sufficiently decrease the
function value

Warning in nbinomGLM(x = x, Y = YNZ, size = size, weights = weightsNZ, offset =
offsetNZ, : the line search routine failed, unable to sufficiently decrease the
function value

Warning in nbinomGLM(x = x, Y = YNZ, size = size, weights = weightsNZ, offset =
offsetNZ, : the line search routine failed, unable to sufficiently decrease the
function value

Warning in nbinomGLM(x = x, Y = YNZ, size = size, weights = weightsNZ, offset =
offsetNZ, : the line search routine failed, unable to sufficiently decrease the
function value

Warning in nbinomGLM(x = x, Y = YNZ, size = size, weights = weightsNZ, offset =
offsetNZ, : the line search routine failed, unable to sufficiently decrease the
function value

Warning in nbinomGLM(x = x, Y = YNZ, size = size, weights = weightsNZ, offset =
offsetNZ, : the line search routine failed, unable to sufficiently decrease the
function value

Warning in nbinomGLM(x = x, Y = YNZ, size = size, weights = weightsNZ, offset =
offsetNZ, : the line search routine failed, unable to sufficiently decrease the
function value

Warning in nbinomGLM(x = x, Y = YNZ, size = size, weights = weightsNZ, offset =
offsetNZ, : the line search routine failed, unable to sufficiently decrease the
function value

Warning in nbinomGLM(x = x, Y = YNZ, size = size, weights = weightsNZ, offset =
offsetNZ, : the line search routine failed, unable to sufficiently decrease the
function value

Warning in nbinomGLM(x = x, Y = YNZ, size = size, weights = weightsNZ, offset =
offsetNZ, : the line search routine failed, unable to sufficiently decrease the
function value

Warning in nbinomGLM(x = x, Y = YNZ, size = size, weights = weightsNZ, offset =
offsetNZ, : the line search routine failed, unable to sufficiently decrease the
function value

Warning in nbinomGLM(x = x, Y = YNZ, size = size, weights = weightsNZ, offset =
offsetNZ, : the line search routine failed, unable to sufficiently decrease the
function value

Warning in nbinomGLM(x = x, Y = YNZ, size = size, weights = weightsNZ, offset =
offsetNZ, : the line search routine failed, unable to sufficiently decrease the
function value

Warning in nbinomGLM(x = x, Y = YNZ, size = size, weights = weightsNZ, offset =
offsetNZ, : the line search routine failed, unable to sufficiently decrease the
function value

Warning in nbinomGLM(x = x, Y = YNZ, size = size, weights = weightsNZ, offset =
offsetNZ, : the line search routine failed, unable to sufficiently decrease the
function value

Warning in nbinomGLM(x = x, Y = YNZ, size = size, weights = weightsNZ, offset =
offsetNZ, : the line search routine failed, unable to sufficiently decrease the
function value

Warning in nbinomGLM(x = x, Y = YNZ, size = size, weights = weightsNZ, offset =
offsetNZ, : the line search routine failed, unable to sufficiently decrease the
function value

Warning in nbinomGLM(x = x, Y = YNZ, size = size, weights = weightsNZ, offset =
offsetNZ, : the line search routine failed, unable to sufficiently decrease the
function value
# Make Tibble from results
res0 %>% as.data.frame %>% as_tibble( rownames="gene_id" ) -> res

head( res )
# A tibble: 6 × 6
  gene_id            baseMean log2FoldChange   lfcSE    pvalue      padj
  <chr>                 <dbl>          <dbl>   <dbl>     <dbl>     <dbl>
1 ENSMUSG00000000001  1513.           -0.592  0.141   2.06e- 5  7.20e- 5
2 ENSMUSG00000000003     0            NA     NA      NA        NA       
3 ENSMUSG00000000028   216.           -2.04   0.153   2.58e-41  1.07e-39
4 ENSMUSG00000000037   101.           -1.69   0.378   1.44e- 6  5.86e- 6
5 ENSMUSG00000000049     4.80          0.755  0.852   1.22e- 1  1.97e- 1
6 ENSMUSG00000000056  3441.            0.988  0.0929  9.81e-27  1.90e-25
plotMA( res0 )

Gene-set-Analyse

Gibt es etwas, was alle die Gene, deren Expression im Alter stark zunimmt, gemeinsam haben?

Um solche Fragen zu beantworten, benutzt man gerne sog. “gene-set collections” (Sammlungen von Gen-Listen; der Begriff “set” meint hier eine Menge im mathematischen Sinn).

Wichtige Sammlungen von Gene-Sets:

  • Gene Ontology:

    • Eigentlich eine Ontologie (d.h., eine Sammlung von strikt definierten Begriffen) um Gene zu beschreiben; da aber jedem Begriff Gene zugeordnet sind, ist die auch eine Gene-Set-Sammlung.
    • Die Begriffe sind durch einen DAG (directed acyclic graph) verknüpft.
    • Es gibt drei Sub-Ontologien, jede mit einem DAG
      • BP: biological processes
      • MF: molecular functions
      • CC: cellular components
  • Kyoto Encyclopedia of Genes and Genomes (KEGG): eigentlich eine Sammlung biochemischer Pathways einschliesslich Diagramme; da aber jedem Pathway Gene (Enzyme, Produkte usw) zugeordnet sind, wird sie auch als Gene-Set-Liste verwendet

  • Reactome und WikiPathways: dasselbe, von anderen Autoren

  • Molecular Signature Database (MSigDb): eine Sammlung von Sammlungen, die u.a.; die o.g. enthält

  • MSigDb Hallmark Collection:

Overrepresentation Analysis mit clusterProfiler

Wenn man nun aus einem eigenen Experiment eine Liste von Genen hat, kann man diese Liste mit den Gene-Sets einer Gene-Set-Collections vergleichen und Gene-Sets finden, wo der Überlapp besonders hoch ist.

HIerfür wir gerne das Bioconductor-Paket “clusterProfiler” verwendet.

library( clusterProfiler )
clusterProfiler v4.10.0  For help: https://yulab-smu.top/biomedical-knowledge-mining-book/

If you use clusterProfiler in published research, please cite:
T Wu, E Hu, S Xu, M Chen, P Guo, Z Dai, T Feng, L Zhou, W Tang, L Zhan, X Fu, S Liu, X Bo, and G Yu. clusterProfiler 4.0: A universal enrichment tool for interpreting omics data. The Innovation. 2021, 2(3):100141

Attaching package: 'clusterProfiler'
The following object is masked from 'package:IRanges':

    slice
The following object is masked from 'package:S4Vectors':

    rename
The following object is masked from 'package:purrr':

    simplify
The following object is masked from 'package:stats':

    filter

Eine ausführliche Anleitung fidnet man in diesem Online-Buch.

Außerdem benötigen wir ein Annotations-Paket für das Maus-Genom. Das folgende Paket bündelt eine Vielzahl von Datenbank-Informationen zu den Genen der Maus, etwas deren IDs, ihre Position auf Chromosomen usw. sowie u.a. auch verschiedene Gene-Set-Sammlungen. Bisher haben wir Ensembl Biomart verwendet, um solche Informationen zu enthalten; heute arbeiten wir stattdessen mit der entsprechenden Bioconductor-Resource:

library( org.Mm.eg.db )
Loading required package: AnnotationDbi

Attaching package: 'AnnotationDbi'
The following object is masked from 'package:clusterProfiler':

    select
The following object is masked from 'package:dplyr':

    select

Beachten Sie hier ausnahmsweise die Warnmeldung beim Laden des Pakets: Die Funktion select ist nun überladen, da Sie in dplyr (ein Teil des Tidyverse) und in AnnotationDbi (dem Bioconductor-Paket, dass den Annotationspakten zugrunde liegt) sich widersprechend definiert wurde.

Daher werden wir leider von nun an immer dplyr::select schreiben müssen, wenn wir das Tidyverse-Verb “select” meinen, und AnnotationsDbi::select, wenn wir die Bioconductor-Funktion select meinen.

Durchführen der Analyse

Für unser Beispiel nehmen wir eine Liste aller bei 5% FDR signifikant hochregulierten Gene:

res %>% 
filter( log2FoldChange > 0, padj < 0.05 ) %>%
pull( gene_id ) -> signif_up

head( signif_up )
[1] "ENSMUSG00000000056" "ENSMUSG00000000058" "ENSMUSG00000000078"
[4] "ENSMUSG00000000088" "ENSMUSG00000000127" "ENSMUSG00000000149"
length( signif_up )
[1] 4951

Hier noch dasselbe für die Gene, die runterreguliert werden:

res %>% 
filter( log2FoldChange < 0, padj < 0.05 ) %>%
pull( gene_id ) -> signif_down

Außerdem brauchen wir noch eine Liste aller Gene, für die überhaupt ein p-Wert vorliegt:

res %>% 
filter( !is.na(padj) ) %>%
pull( gene_id ) -> gene_universe

Nun können wir die clusterProfiler-Funktion zur Overrepresentation-Analyse aufrufen

enrichGO(
  signif_up,
  OrgDb = org.Mm.eg.db,
  keyType = "ENSEMBL",
  ont = "BP",
  universe = gene_universe ) -> res_up_GO_BP

as_tibble( res_up_GO_BP )
# A tibble: 619 × 9
   ID      Description GeneRatio BgRatio   pvalue p.adjust   qvalue geneID Count
   <chr>   <chr>       <chr>     <chr>      <dbl>    <dbl>    <dbl> <chr>  <int>
 1 GO:004… cellular r… 153/4519  216/15… 3.46e-38 1.45e-34 1.21e-34 ENSMU…   153
 2 GO:000… aerobic re… 129/4519  169/15… 4.73e-38 1.45e-34 1.21e-34 ENSMU…   129
 3 GO:000… generation… 246/4519  428/15… 1.27e-36 2.60e-33 2.17e-33 ENSMU…   246
 4 GO:001… energy der… 191/4519  307/15… 4.73e-35 7.26e-32 6.05e-32 ENSMU…   191
 5 GO:000… oxidative … 99/4519   124/15… 2.13e-32 2.61e-29 2.18e-29 ENSMU…    99
 6 GO:000… purine nuc… 218/4519  400/15… 4.23e-28 4.32e-25 3.61e-25 ENSMU…   218
 7 GO:007… purine-con… 231/4519  434/15… 9.49e-28 8.32e-25 6.94e-25 ENSMU…   231
 8 GO:004… proton mot… 52/4519   55/157… 4.38e-25 3.36e-22 2.81e-22 ENSMU…    52
 9 GO:003… mitochondr… 74/4519   92/157… 6.43e-25 4.39e-22 3.66e-22 ENSMU…    74
10 GO:001… proton mot… 54/4519   59/157… 3.50e-24 2.15e-21 1.79e-21 ENSMU…    54
# ℹ 609 more rows

Viele der ganz oben gelisteten GO-Terme sind miteinander verwandt, und der DAG beschreibt dies. Folgende Funktion zeignet den relevanten Teil des DAGs:

goplot(res_up_GO_BP) 
Warning: ggrepel: 16 unlabeled data points (too many overlaps). Consider
increasing max.overlaps

Erklärung

Was ist hier nun passiert? Wie hat clusterProfiler die p-Werte berechnet?

Um das zu verstehen, nehmen wir uns einen der “Hits” heraus und rechnen “per Hand” nach. Wir wählen den Term GO:0009060 – “aerobic respiration”.

Zunächst verwenden wir AnnotationDbi’s “select”-Funktion, um zu sehen, was im Annotations-Paket zu diesem Term gespeichert ist:

AnnotationDbi::select( org.Mm.eg.db, "GO:0009060", keytype="GO", 
    columns = c( "ENSEMBL", "SYMBOL", "GENENAME" ) ) -> aero_respr
'select()' returned 1:many mapping between keys and columns
aero_respr
           GO EVIDENCE ONTOLOGY            ENSEMBL  SYMBOL
1  GO:0009060      ISO       BP ENSMUSG00000022407    Adsl
2  GO:0009060      IMP       BP ENSMUSG00000027187     Cat
3  GO:0009060      IMP       BP ENSMUSG00000059363     Fxn
4  GO:0009060      ISO       BP ENSMUSG00000090247 Bloc1s1
5  GO:0009060      ISO       BP ENSMUSG00000019179    Mdh2
6  GO:0009060      IEA       BP ENSMUSG00000064351    COX1
7  GO:0009060      IBA       BP ENSMUSG00000064341     ND1
8  GO:0009060      NAS       BP ENSMUSG00000064341     ND1
9  GO:0009060      NAS       BP ENSMUSG00000064345     ND2
10 GO:0009060      NAS       BP ENSMUSG00000064360     ND3
11 GO:0009060      IBA       BP ENSMUSG00000064363     ND4
12 GO:0009060      NAS       BP ENSMUSG00000064363     ND4
13 GO:0009060      NAS       BP ENSMUSG00000065947    ND4L
14 GO:0009060      NAS       BP ENSMUSG00000064367     ND5
15 GO:0009060      NAS       BP ENSMUSG00000064368     ND6
16 GO:0009060      IDA       BP ENSMUSG00000078683    Mup1
17 GO:0009060      NAS       BP ENSMUSG00000014294  Ndufa2
18 GO:0009060      NAS       BP ENSMUSG00000021764  Ndufs4
19 GO:0009060      NAS       BP ENSMUSG00000037916  Ndufv1
20 GO:0009060      ISO       BP ENSMUSG00000038676     Ucn
21 GO:0009060      NAS       BP ENSMUSG00000016427  Ndufa1
22 GO:0009060      ISO       BP ENSMUSG00000025486   Sirt3
23 GO:0009060      ISO       BP ENSMUSG00000003072 Atp5f1d
24 GO:0009060      NAS       BP ENSMUSG00000027673  Ndufb5
25 GO:0009060      NAS       BP ENSMUSG00000035674  Ndufa3
26 GO:0009060      NAS       BP ENSMUSG00000000399  Ndufa9
27 GO:0009060      NAS       BP ENSMUSG00000022354  Ndufb9
28 GO:0009060      NAS       BP ENSMUSG00000037152  Ndufc1
29 GO:0009060      NAS       BP ENSMUSG00000020022 Ndufa12
30 GO:0009060      NAS       BP ENSMUSG00000041881  Ndufa7
31 GO:0009060      NAS       BP ENSMUSG00000026032  Ndufb3
32 GO:0009060      NAS       BP ENSMUSG00000033938  Ndufb7
33 GO:0009060      NAS       BP ENSMUSG00000022450  Ndufa6
34 GO:0009060      NAS       BP ENSMUSG00000036199 Ndufa13
35 GO:0009060      NAS       BP ENSMUSG00000025204  Ndufb8
36 GO:0009060      NAS       BP ENSMUSG00000026260 Ndufa10
37 GO:0009060      IBA       BP ENSMUSG00000027601   Mtfr1
38 GO:0009060      IMP       BP ENSMUSG00000027601   Mtfr1
39 GO:0009060      IBA       BP ENSMUSG00000009863    Sdhb
40 GO:0009060      NAS       BP ENSMUSG00000022820  Ndufb4
41 GO:0009060      NAS       BP ENSMUSG00000030647  Ndufc2
42 GO:0009060      NAS       BP ENSMUSG00000002416  Ndufb2
43 GO:0009060      NAS       BP ENSMUSG00000023089  Ndufa5
44 GO:0009060      NAS       BP ENSMUSG00000040048 Ndufb10
45 GO:0009060      NAS       BP ENSMUSG00000005510  Ndufs3
46 GO:0009060      NAS       BP ENSMUSG00000026895  Ndufa8
47 GO:0009060      ISO       BP ENSMUSG00000000959   Oxa1l
48 GO:0009060      NAS       BP ENSMUSG00000002379 Ndufa11
49 GO:0009060      NAS       BP ENSMUSG00000030869 Ndufab1
50 GO:0009060      IMP       BP ENSMUSG00000042148   Cox10
51 GO:0009060      IBA       BP ENSMUSG00000019992   Mtfr2
52 GO:0009060      IMP       BP ENSMUSG00000019992   Mtfr2
53 GO:0009060      NAS       BP ENSMUSG00000024099  Ndufv2
54 GO:0009060      IMP       BP ENSMUSG00000037514   Pank2
55 GO:0009060      IBA       BP ENSMUSG00000020153  Ndufs7
56 GO:0009060      NAS       BP ENSMUSG00000020153  Ndufs7
57 GO:0009060      IBA       BP ENSMUSG00000046671  Mtfr1l
58 GO:0009060      NAS       BP ENSMUSG00000024038  Ndufv3
59 GO:0009060      NAS       BP ENSMUSG00000031059 Ndufb11
60 GO:0009060      NAS       BP ENSMUSG00000059734  Ndufs8
61 GO:0009060      NAS       BP ENSMUSG00000013593  Ndufs2
62 GO:0009060      NAS       BP ENSMUSG00000025968  Ndufs1
63 GO:0009060      NAS       BP ENSMUSG00000071014  Ndufb6
64 GO:0009060      NAS       BP ENSMUSG00000021606  Ndufs6
65 GO:0009060      NAS       BP ENSMUSG00000028648  Ndufs5
66 GO:0009060      NAS       BP ENSMUSG00000113902  Ndufb1
                                                             GENENAME
1                                              adenylosuccinate lyase
2                                                            catalase
3                                                            frataxin
4             biogenesis of lysosomal organelles complex-1, subunit 1
5                         malate dehydrogenase 2, NAD (mitochondrial)
6                                      cytochrome c oxidase subunit I
7                                        NADH dehydrogenase subunit 1
8                                        NADH dehydrogenase subunit 1
9                                        NADH dehydrogenase subunit 2
10                                       NADH dehydrogenase subunit 3
11                                       NADH dehydrogenase subunit 4
12                                       NADH dehydrogenase subunit 4
13                                      NADH dehydrogenase subunit 4L
14                                       NADH dehydrogenase subunit 5
15                                       NADH dehydrogenase subunit 6
16                                            major urinary protein 1
17                          NADH:ubiquinone oxidoreductase subunit A2
18                     NADH:ubiquinone oxidoreductase core subunit S4
19                     NADH:ubiquinone oxidoreductase core subunit V1
20                                                          urocortin
21                          NADH:ubiquinone oxidoreductase subunit A1
22                                                          sirtuin 3
23                                      ATP synthase F1 subunit delta
24                          NADH:ubiquinone oxidoreductase subunit B5
25                          NADH:ubiquinone oxidoreductase subunit A3
26                          NADH:ubiquinone oxidoreductase subunit A9
27                          NADH:ubiquinone oxidoreductase subunit B9
28                          NADH:ubiquinone oxidoreductase subunit C1
29                         NADH:ubiquinone oxidoreductase subunit A12
30                          NADH:ubiquinone oxidoreductase subunit A7
31                          NADH:ubiquinone oxidoreductase subunit B3
32                          NADH:ubiquinone oxidoreductase subunit B7
33                          NADH:ubiquinone oxidoreductase subunit A6
34                         NADH:ubiquinone oxidoreductase subunit A13
35                          NADH:ubiquinone oxidoreductase subunit B8
36                         NADH:ubiquinone oxidoreductase subunit A10
37                                  mitochondrial fission regulator 1
38                                  mitochondrial fission regulator 1
39       succinate dehydrogenase complex, subunit B, iron sulfur (Ip)
40                          NADH:ubiquinone oxidoreductase subunit B4
41                          NADH:ubiquinone oxidoreductase subunit C2
42                          NADH:ubiquinone oxidoreductase subunit B2
43                          NADH:ubiquinone oxidoreductase subunit A5
44                         NADH:ubiquinone oxidoreductase subunit B10
45                     NADH:ubiquinone oxidoreductase core subunit S3
46                          NADH:ubiquinone oxidoreductase subunit A8
47                                            oxidase assembly 1-like
48                         NADH:ubiquinone oxidoreductase subunit A11
49                         NADH:ubiquinone oxidoreductase subunit AB1
50 heme A:farnesyltransferase cytochrome c oxidase assembly factor 10
51                                  mitochondrial fission regulator 2
52                                  mitochondrial fission regulator 2
53                     NADH:ubiquinone oxidoreductase core subunit V2
54                                              pantothenate kinase 2
55                     NADH:ubiquinone oxidoreductase core subunit S7
56                     NADH:ubiquinone oxidoreductase core subunit S7
57                             mitochondrial fission regulator 1-like
58                     NADH:ubiquinone oxidoreductase core subunit V3
59                         NADH:ubiquinone oxidoreductase subunit B11
60                     NADH:ubiquinone oxidoreductase core subunit S8
61                     NADH:ubiquinone oxidoreductase core subunit S2
62                     NADH:ubiquinone oxidoreductase core subunit S1
63                          NADH:ubiquinone oxidoreductase subunit B6
64                     NADH:ubiquinone oxidoreductase core subunit S6
65                     NADH:ubiquinone oxidoreductase core subunit S5
66                          NADH:ubiquinone oxidoreductase subunit B1

Wir sehen, dass dem Term 66 Gene zugeordnet sind.

Nun fragen wir uns für alle Gene, für die wir p-Werte haben, jeweils: - Ist das Gen in der Liste signifikant hochregulierter Gene? - Ist das Gen im gerade getesteten Gene-Set (hier: “aerobic respiration”)?

tibble( gene_id = gene_universe ) %>%
mutate( signif = gene_id %in% signif_up ) %>%
mutate( in_set = gene_id %in% aero_respr$ENSEMBL ) %>%
group_by( signif, in_set ) %>%
summarise( count = n() ) -> tbl
`summarise()` has grouped output by 'signif'. You can override using the
`.groups` argument.
tbl
# A tibble: 4 × 3
# Groups:   signif [2]
  signif in_set count
  <lgl>  <lgl>  <int>
1 FALSE  FALSE  14508
2 FALSE  TRUE       8
3 TRUE   FALSE   4909
4 TRUE   TRUE      42

Wir wandeln dies in eine Vier-Felder-Tafel um und führen einen Fisher-Test durch:

tbl %>%
pivot_wider( names_from="in_set", values_from="count" ) %>%
column_to_rownames( "signif" ) %>% as.matrix() -> contingency_table

names(dimnames(contingency_table)) <- c( "signif", "in_set" )

contingency_table
       in_set
signif  FALSE TRUE
  FALSE 14508    8
  TRUE   4909   42

Wie wir sehen, sind 42+8=50 Gene aus dem Genset “aerobic respiration” auch in unserem “Universum” getester Gene. Die große Mehrzahl, nämlich 42 dieser Gene sind siginifikant stärker in P63 als in P0 exprimiert. Unter alle anderen Gene sind aber nur etwa ein Drittel der Gene auf der Liste signifikant hochregulierter Gene. Der Fisher-Test bestätigt, dass dies ein hoch-signifikanter Unterschied ist:

fisher.test( contingency_table )

    Fisher's Exact Test for Count Data

data:  contingency_table
p-value < 2.2e-16
alternative hypothesis: true odds ratio is not equal to 1
95 percent confidence interval:
  7.188513 38.270306
sample estimates:
odds ratio 
  15.50771 

Folglich ist die aerobe Zellatmung also einer der Prozesse, deren Gene in P63 deutlich stärker exprimiert sind als in P0.

Anmerkung: Die Zahlen in unserer Vierfelder-Tafel stimmen nicht mit den Zahlen überein, die in der von enrichGO erzeugten Tabelle stehen. Den Grund verstehe ich leider selbst nicht.

Andere Ontologien

Zum Vergleich noch die anderen Kombinationen:

res_GO_all <- list(
  upBP = enrichGO( signif_up,   ont = "BP", OrgDb = org.Mm.eg.db, keyType = "ENSEMBL", universe = gene_universe ),
  upMF = enrichGO( signif_up,   ont = "MF", OrgDb = org.Mm.eg.db, keyType = "ENSEMBL", universe = gene_universe ),
  upCC = enrichGO( signif_up,   ont = "CC", OrgDb = org.Mm.eg.db, keyType = "ENSEMBL", universe = gene_universe ),
  dnBP = enrichGO( signif_down, ont = "BP", OrgDb = org.Mm.eg.db, keyType = "ENSEMBL", universe = gene_universe ),
  dnMF = enrichGO( signif_down, ont = "MF", OrgDb = org.Mm.eg.db, keyType = "ENSEMBL", universe = gene_universe ),
  dnCC = enrichGO( signif_down, ont = "CC", OrgDb = org.Mm.eg.db, keyType = "ENSEMBL", universe = gene_universe ) )

save( res_GO_all, file="res_GO.rda" )
load( file="res_GO.rda" )
goplot(res_GO_all$dnBP)
Warning: ggrepel: 6 unlabeled data points (too many overlaps). Consider
increasing max.overlaps

Gene-Set-Enrichment-Analyse (GSEA)

Für die Overrepresentation-Analyse haben wir eine Liste signifikant hochregulierter Gene erstellt. Dazu mussten wir willkürlich einen Cut-Off für den p-Wert wählen, was unschön ist, da das Ergebnis oft von diesem abhängt. Außerdem wird nicht unterschieden zwischen Genen, die stark erhöht sind und solchen, die sich nur leicht geändert haben.

Die GSEA vermeidet dies.

Sie braucht als Input eine Liste aller getesteten Gene, aber (absteigend) sortiert nach der Effektgröße:

res %>%
filter( !is.na(padj) ) %>%
arrange( -log2FoldChange ) %>%
dplyr::select( gene_id, log2FoldChange ) %>%
deframe() -> ranked_gene_list

head( ranked_gene_list )
ENSMUSG00000003477 ENSMUSG00000095079 ENSMUSG00000025479 ENSMUSG00000086645 
         12.667194          10.051463           9.169209           8.957852 
ENSMUSG00000061100 ENSMUSG00000026114 
          8.596350           8.375893 

Nun verwenden wir die GSEA-Funktion:

gseGO( 
  geneList = ranked_gene_list,
  ont = "BP",
  OrgDb = org.Mm.eg.db,
  keyType = "ENSEMBL" ) -> gse_res_BP
preparing geneSet collections...
GSEA analysis...
Warning in preparePathwaysAndStats(pathways, stats, minSize, maxSize, gseaParam, : There are ties in the preranked stats (0.43% of the list).
The order of those tied genes will be arbitrary, which may produce unexpected results.
Warning in fgseaMultilevel(pathways = pathways, stats = stats, minSize =
minSize, : For some pathways, in reality P-values are less than 1e-10. You can
set the `eps` argument to zero for better estimation.
leading edge analysis...
done...
head(gse_res_BP)
                   ID                          Description setSize
GO:0000070 GO:0000070 mitotic sister chromatid segregation     168
GO:0007059 GO:0007059               chromosome segregation     389
GO:0098813 GO:0098813       nuclear chromosome segregation     287
GO:0000819 GO:0000819         sister chromatid segregation     207
GO:0051983 GO:0051983 regulation of chromosome segregation     122
GO:0006261 GO:0006261        DNA-templated DNA replication     146
           enrichmentScore       NES pvalue     p.adjust       qvalue rank
GO:0000070      -0.7539142 -2.880358  1e-10 6.696774e-09 4.898698e-09 1305
GO:0007059      -0.6867886 -2.850350  1e-10 6.696774e-09 4.898698e-09 1689
GO:0098813      -0.7005201 -2.834943  1e-10 6.696774e-09 4.898698e-09 1562
GO:0000819      -0.7234078 -2.824569  1e-10 6.696774e-09 4.898698e-09 1305
GO:0051983      -0.7564985 -2.766126  1e-10 6.696774e-09 4.898698e-09 1305
GO:0006261      -0.7374185 -2.752566  1e-10 6.696774e-09 4.898698e-09 2314
                             leading_edge
GO:0000070  tags=36%, list=7%, signal=34%
GO:0007059  tags=32%, list=9%, signal=30%
GO:0098813  tags=33%, list=8%, signal=31%
GO:0000819  tags=32%, list=7%, signal=30%
GO:0051983  tags=36%, list=7%, signal=34%
GO:0006261 tags=47%, list=12%, signal=41%
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               core_enrichment
GO:0000070                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 ENSMUSG00000029516/ENSMUSG00000031971/ENSMUSG00000036006/ENSMUSG00000021287/ENSMUSG00000027115/ENSMUSG00000074476/ENSMUSG00000034349/ENSMUSG00000024660/ENSMUSG00000029910/ENSMUSG00000027635/ENSMUSG00000028312/ENSMUSG00000042029/ENSMUSG00000051235/ENSMUSG00000024301/ENSMUSG00000062510/ENSMUSG00000019773/ENSMUSG00000032254/ENSMUSG00000001403/ENSMUSG00000068744/ENSMUSG00000050107/ENSMUSG00000006585/ENSMUSG00000027306/ENSMUSG00000058290/ENSMUSG00000012443/ENSMUSG00000045328/ENSMUSG00000021714/ENSMUSG00000041498/ENSMUSG00000006398/ENSMUSG00000021569/ENSMUSG00000034906/ENSMUSG00000024056/ENSMUSG00000015880/ENSMUSG00000032400/ENSMUSG00000023015/ENSMUSG00000079553/ENSMUSG00000026622/ENSMUSG00000038943/ENSMUSG00000031262/ENSMUSG00000002055/ENSMUSG00000069910/ENSMUSG00000027469/ENSMUSG00000030867/ENSMUSG00000030677/ENSMUSG00000029414/ENSMUSG00000017861/ENSMUSG00000017716/ENSMUSG00000005233/ENSMUSG00000027331/ENSMUSG00000020897/ENSMUSG00000040084/ENSMUSG00000038379/ENSMUSG00000019942/ENSMUSG00000051378/ENSMUSG00000027326/ENSMUSG00000028678/ENSMUSG00000028873/ENSMUSG00000024791/ENSMUSG00000027379/ENSMUSG00000026683/ENSMUSG00000041431
GO:0007059 ENSMUSG00000028066/ENSMUSG00000032481/ENSMUSG00000015120/ENSMUSG00000022177/ENSMUSG00000009670/ENSMUSG00000020415/ENSMUSG00000021391/ENSMUSG00000038252/ENSMUSG00000038292/ENSMUSG00000032624/ENSMUSG00000007035/ENSMUSG00000029516/ENSMUSG00000031971/ENSMUSG00000030584/ENSMUSG00000036006/ENSMUSG00000030041/ENSMUSG00000027959/ENSMUSG00000021287/ENSMUSG00000026708/ENSMUSG00000027115/ENSMUSG00000036928/ENSMUSG00000037108/ENSMUSG00000074476/ENSMUSG00000044783/ENSMUSG00000003824/ENSMUSG00000034349/ENSMUSG00000073705/ENSMUSG00000041147/ENSMUSG00000026749/ENSMUSG00000032609/ENSMUSG00000027883/ENSMUSG00000024660/ENSMUSG00000036672/ENSMUSG00000029910/ENSMUSG00000030254/ENSMUSG00000037991/ENSMUSG00000001525/ENSMUSG00000019214/ENSMUSG00000027635/ENSMUSG00000022429/ENSMUSG00000028312/ENSMUSG00000028212/ENSMUSG00000042029/ENSMUSG00000034329/ENSMUSG00000041406/ENSMUSG00000051235/ENSMUSG00000002068/ENSMUSG00000075266/ENSMUSG00000024301/ENSMUSG00000031629/ENSMUSG00000062510/ENSMUSG00000019773/ENSMUSG00000031756/ENSMUSG00000037313/ENSMUSG00000051455/ENSMUSG00000032254/ENSMUSG00000034311/ENSMUSG00000001403/ENSMUSG00000068744/ENSMUSG00000050107/ENSMUSG00000006585/ENSMUSG00000027306/ENSMUSG00000058290/ENSMUSG00000027496/ENSMUSG00000017499/ENSMUSG00000012443/ENSMUSG00000031004/ENSMUSG00000033952/ENSMUSG00000034023/ENSMUSG00000045328/ENSMUSG00000021714/ENSMUSG00000041498/ENSMUSG00000006398/ENSMUSG00000021569/ENSMUSG00000034906/ENSMUSG00000024056/ENSMUSG00000015880/ENSMUSG00000032400/ENSMUSG00000023015/ENSMUSG00000079553/ENSMUSG00000026622/ENSMUSG00000038943/ENSMUSG00000031262/ENSMUSG00000002055/ENSMUSG00000069910/ENSMUSG00000027469/ENSMUSG00000030867/ENSMUSG00000030677/ENSMUSG00000029414/ENSMUSG00000017146/ENSMUSG00000017861/ENSMUSG00000021098/ENSMUSG00000017716/ENSMUSG00000005233/ENSMUSG00000027331/ENSMUSG00000027699/ENSMUSG00000020897/ENSMUSG00000021965/ENSMUSG00000040084/ENSMUSG00000048922/ENSMUSG00000032218/ENSMUSG00000037544/ENSMUSG00000047220/ENSMUSG00000028718/ENSMUSG00000023940/ENSMUSG00000072980/ENSMUSG00000036223/ENSMUSG00000020914/ENSMUSG00000038379/ENSMUSG00000019942/ENSMUSG00000045273/ENSMUSG00000022034/ENSMUSG00000051378/ENSMUSG00000027654/ENSMUSG00000027326/ENSMUSG00000028678/ENSMUSG00000028873/ENSMUSG00000024791/ENSMUSG00000068101/ENSMUSG00000027379/ENSMUSG00000026683/ENSMUSG00000041431/ENSMUSG00000002324/ENSMUSG00000047844
GO:0098813                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           ENSMUSG00000009670/ENSMUSG00000020415/ENSMUSG00000038252/ENSMUSG00000038292/ENSMUSG00000032624/ENSMUSG00000007035/ENSMUSG00000029516/ENSMUSG00000031971/ENSMUSG00000030584/ENSMUSG00000036006/ENSMUSG00000030041/ENSMUSG00000021287/ENSMUSG00000027115/ENSMUSG00000036928/ENSMUSG00000037108/ENSMUSG00000074476/ENSMUSG00000003824/ENSMUSG00000034349/ENSMUSG00000041147/ENSMUSG00000026749/ENSMUSG00000032609/ENSMUSG00000024660/ENSMUSG00000029910/ENSMUSG00000037991/ENSMUSG00000027635/ENSMUSG00000022429/ENSMUSG00000028312/ENSMUSG00000028212/ENSMUSG00000042029/ENSMUSG00000034329/ENSMUSG00000051235/ENSMUSG00000002068/ENSMUSG00000024301/ENSMUSG00000062510/ENSMUSG00000019773/ENSMUSG00000037313/ENSMUSG00000051455/ENSMUSG00000032254/ENSMUSG00000034311/ENSMUSG00000001403/ENSMUSG00000068744/ENSMUSG00000050107/ENSMUSG00000006585/ENSMUSG00000027306/ENSMUSG00000058290/ENSMUSG00000027496/ENSMUSG00000017499/ENSMUSG00000012443/ENSMUSG00000033952/ENSMUSG00000034023/ENSMUSG00000045328/ENSMUSG00000021714/ENSMUSG00000041498/ENSMUSG00000006398/ENSMUSG00000021569/ENSMUSG00000034906/ENSMUSG00000024056/ENSMUSG00000015880/ENSMUSG00000032400/ENSMUSG00000023015/ENSMUSG00000079553/ENSMUSG00000026622/ENSMUSG00000038943/ENSMUSG00000031262/ENSMUSG00000002055/ENSMUSG00000069910/ENSMUSG00000027469/ENSMUSG00000030867/ENSMUSG00000030677/ENSMUSG00000029414/ENSMUSG00000017861/ENSMUSG00000021098/ENSMUSG00000017716/ENSMUSG00000005233/ENSMUSG00000027331/ENSMUSG00000027699/ENSMUSG00000020897/ENSMUSG00000040084/ENSMUSG00000032218/ENSMUSG00000047220/ENSMUSG00000023940/ENSMUSG00000020914/ENSMUSG00000038379/ENSMUSG00000019942/ENSMUSG00000051378/ENSMUSG00000027654/ENSMUSG00000027326/ENSMUSG00000028678/ENSMUSG00000028873/ENSMUSG00000024791/ENSMUSG00000027379/ENSMUSG00000026683/ENSMUSG00000041431/ENSMUSG00000002324
GO:0000819                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               ENSMUSG00000029516/ENSMUSG00000031971/ENSMUSG00000030584/ENSMUSG00000036006/ENSMUSG00000021287/ENSMUSG00000027115/ENSMUSG00000074476/ENSMUSG00000034349/ENSMUSG00000026749/ENSMUSG00000024660/ENSMUSG00000029910/ENSMUSG00000037991/ENSMUSG00000027635/ENSMUSG00000028312/ENSMUSG00000042029/ENSMUSG00000051235/ENSMUSG00000024301/ENSMUSG00000062510/ENSMUSG00000019773/ENSMUSG00000037313/ENSMUSG00000032254/ENSMUSG00000001403/ENSMUSG00000068744/ENSMUSG00000050107/ENSMUSG00000006585/ENSMUSG00000027306/ENSMUSG00000058290/ENSMUSG00000017499/ENSMUSG00000012443/ENSMUSG00000045328/ENSMUSG00000021714/ENSMUSG00000041498/ENSMUSG00000006398/ENSMUSG00000021569/ENSMUSG00000034906/ENSMUSG00000024056/ENSMUSG00000015880/ENSMUSG00000032400/ENSMUSG00000023015/ENSMUSG00000079553/ENSMUSG00000026622/ENSMUSG00000038943/ENSMUSG00000031262/ENSMUSG00000002055/ENSMUSG00000069910/ENSMUSG00000027469/ENSMUSG00000030867/ENSMUSG00000030677/ENSMUSG00000029414/ENSMUSG00000017861/ENSMUSG00000017716/ENSMUSG00000005233/ENSMUSG00000027331/ENSMUSG00000020897/ENSMUSG00000040084/ENSMUSG00000020914/ENSMUSG00000038379/ENSMUSG00000019942/ENSMUSG00000051378/ENSMUSG00000027326/ENSMUSG00000028678/ENSMUSG00000028873/ENSMUSG00000024791/ENSMUSG00000027379/ENSMUSG00000026683/ENSMUSG00000041431
GO:0051983                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 ENSMUSG00000029516/ENSMUSG00000030584/ENSMUSG00000021287/ENSMUSG00000074476/ENSMUSG00000034349/ENSMUSG00000026749/ENSMUSG00000024660/ENSMUSG00000029910/ENSMUSG00000030254/ENSMUSG00000037991/ENSMUSG00000019214/ENSMUSG00000028312/ENSMUSG00000042029/ENSMUSG00000051235/ENSMUSG00000019773/ENSMUSG00000037313/ENSMUSG00000001403/ENSMUSG00000050107/ENSMUSG00000017499/ENSMUSG00000031004/ENSMUSG00000045328/ENSMUSG00000006398/ENSMUSG00000021569/ENSMUSG00000034906/ENSMUSG00000024056/ENSMUSG00000015880/ENSMUSG00000032400/ENSMUSG00000069910/ENSMUSG00000030867/ENSMUSG00000029414/ENSMUSG00000017716/ENSMUSG00000005233/ENSMUSG00000020897/ENSMUSG00000040084/ENSMUSG00000048922/ENSMUSG00000047220/ENSMUSG00000038379/ENSMUSG00000019942/ENSMUSG00000027326/ENSMUSG00000028678/ENSMUSG00000028873/ENSMUSG00000027379/ENSMUSG00000026683/ENSMUSG00000041431
GO:0006261                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                         ENSMUSG00000038685/ENSMUSG00000030726/ENSMUSG00000036086/ENSMUSG00000057113/ENSMUSG00000025134/ENSMUSG00000022881/ENSMUSG00000023104/ENSMUSG00000020471/ENSMUSG00000041238/ENSMUSG00000038225/ENSMUSG00000055884/ENSMUSG00000038644/ENSMUSG00000024691/ENSMUSG00000016984/ENSMUSG00000006678/ENSMUSG00000031697/ENSMUSG00000031669/ENSMUSG00000026134/ENSMUSG00000058298/ENSMUSG00000032397/ENSMUSG00000032555/ENSMUSG00000027342/ENSMUSG00000027454/ENSMUSG00000033970/ENSMUSG00000025358/ENSMUSG00000073705/ENSMUSG00000041147/ENSMUSG00000022673/ENSMUSG00000000028/ENSMUSG00000029730/ENSMUSG00000020974/ENSMUSG00000029363/ENSMUSG00000030978/ENSMUSG00000019214/ENSMUSG00000028212/ENSMUSG00000017550/ENSMUSG00000029283/ENSMUSG00000007080/ENSMUSG00000032586/ENSMUSG00000002297/ENSMUSG00000002870/ENSMUSG00000051235/ENSMUSG00000002068/ENSMUSG00000041859/ENSMUSG00000033762/ENSMUSG00000026355/ENSMUSG00000036875/ENSMUSG00000025395/ENSMUSG00000030528/ENSMUSG00000019773/ENSMUSG00000026196/ENSMUSG00000056394/ENSMUSG00000046179/ENSMUSG00000020185/ENSMUSG00000037572/ENSMUSG00000005410/ENSMUSG00000045751/ENSMUSG00000031821/ENSMUSG00000006585/ENSMUSG00000017499/ENSMUSG00000027323/ENSMUSG00000026669/ENSMUSG00000025574/ENSMUSG00000028587/ENSMUSG00000017146/ENSMUSG00000039055/ENSMUSG00000022422/ENSMUSG00000046591

Erklärung

Wie wird diesmal getestet?

Wir nehmen wieder ein signifikantes Gen-Set, diesmal GO:0007059 – “chromsome segregation”.

Hier sind die Gene in diesem Gen-Set:

AnnotationDbi::select( org.Mm.eg.db, "GO:0007059", keytype="GO", columns="ENSEMBL")$ENSEMBL -> go_members
'select()' returned 1:many mapping between keys and columns
head(go_members)
[1] "ENSMUSG00000016319" "ENSMUSG00000017716" "ENSMUSG00000017146"
[4] "ENSMUSG00000027379" "ENSMUSG00000066979" "ENSMUSG00000029253"
length(go_members)
[1] 130

Hier ein MA-Plot, in dem diese Gene anders eingefärbt sind:

res %>%
mutate( in_go = gene_id %in% go_members ) %>%
arrange( in_go ) %>%
ggplot + 
  geom_point( aes( x=baseMean, y=log2FoldChange, col=in_go ), size=.2 ) +
  scale_x_log10()
Warning: Transformation introduced infinite values in continuous x-axis
Warning: Removed 12468 rows containing missing values (`geom_point()`).

Und hier ein Plot, in dem die Gene gemäß ihrem LFC von links nach rechts auf der x-Achse angeordnet sind. Wir starten links bei y=0 und gehen einen (großen) Schritt nach oben immer wenn wir bei einem Gen aus dem GO-Set sind und einen (kleinen) Schritt nach unten bei allen anderen Genen. Die Schrittgrößen sind so gewählt, dass wir ganz rechts wieder bei 0 ankommen.

res %>%
mutate( in_go = gene_id %in% go_members ) %>%
mutate( step = ifelse( in_go, 1/sum(in_go), -1/sum(!in_go)) ) %>%
arrange( log2FoldChange ) %>%
mutate( pos = row_number() ) %>%
mutate( cumsum = cumsum( step ) ) %>%
ggplot + 
  geom_line( aes( x=pos, y=cumsum ), size=.1 )
Warning: Using `size` aesthetic for lines was deprecated in ggplot2 3.4.0.
ℹ Please use `linewidth` instead.

Zum Vergleich erstellen wir uns eine zweite Liste mit Genen, von derselben Länge wie die GO-Liste zu “chromosome segregation”, aber mit zufällig ausgewählten Genen:

random_genes <- sample( gene_universe, length(go_members) )

Nun verwenden wir denselben Code nochmal, nun mit derartigen zufälligen Genen. Das machen wir 10 mal. Wir erkennen dann, dass wir nie weiter als 0.15 von der x-Achse weg kommen. Eben kamen wir aber bis zu einem y-Wert von etwa 0.45. Daran erkennt die GSEA-Funktion signifikantes Enrichment.

for( i in 1:10 ) {
  random_genes <- sample( gene_universe, length(go_members) )
  
  res %>%
  filter( !is.na(log2FoldChange) ) %>%
  mutate( in_go = gene_id %in% random_genes ) %>%
  mutate( step = ifelse( in_go, 1/sum(in_go), -1/sum(!in_go)) ) %>%
  arrange( log2FoldChange ) %>%
  mutate( pos = row_number() ) %>%
  mutate( cumsum = cumsum( step ) ) %>%
  {ggplot(.) + 
    geom_line( aes( x=pos, y=cumsum ), size=.1 )} %>% print()
}

Weitere Collections

Hier haben wir nur GO verwendet; es lohnt sich aber, auch andere Collectungs zu probieren.