suppressPackageStartupMessages({
  library(SummarizedExperiment)
  library(PLIER)
  library(grid)
  library(circlize)
  library(ComplexHeatmap)
  library(GenomicSuperSignature)
})

source('/data2/GenomicSuperSignature/R/sampleScoreHeatmap.R')
source('/data2/GenomicSuperSignature/R/validte.R')

1 Load models

recount2PCAmodel = readRDS("/data2/Genomic_Super_Signature/multiPCA/data/avgLoadingRecount2.rds")
recount_KEGG_model = readRDS("/data2/Genomic_Super_Signature/PLIER/data/recount_KEGG_PLIER_model.RDS")

2 Load test data

load("/data2/GenomicSuperSignature/data/TCGA_validationDatasets.rda")
exprs.mat.ov = assay(TCGA_validationDatasets[["OV"]])
exprs.mat.coad = assay(TCGA_validationDatasets[["COAD"]])

cm = intersect(rownames(exprs.mat.ov), rownames(exprs.mat.coad))
exprs.mat = cbind(exprs.mat.ov[cm, 1:5], exprs.mat.coad[cm, 1:5])  # assign score to only 5 samples 

3 PLIER functions

PLIER::plotU(recount_KEGG_model, auc.cutoff = 0.9, fdr.cutoff = 0.01, top = 2)

4 multiPLIER functions

4.1 GetNewDataB

iso.b.matrix = GetNewDataB(exprs.mat = exprs.mat,
                           plier.model = recount_KEGG_model)

sampleScoreHeatmap(t(iso.b.matrix), "TCGA_RNAseq", "recount_KEGG_model",
                   show_column_names = FALSE, 
                   show_row_names = TRUE,
                   row_names_gp = 7)

topInd = order(iso.b.matrix[,1], decreasing = TRUE)[1:5]
bottomInd = order(iso.b.matrix[,1])[1:5]

sampleScoreHeatmap(t(iso.b.matrix[c(topInd, bottomInd), 1]), colnames(iso.b.matrix)[1], "recount_KEGG_model",
                   show_column_names = TRUE, 
                   show_row_names = TRUE,
                   column_names_gp = 10)

4.2 GetPathwayCoverage

  • pathway: proportion of “covered” pathways
  • lv: proportion of LVs that have pathways associated with them
  • sig.pathway.by.lv: number of pathways “covered” / number of LVs
GetPathwayCoverage(recount_KEGG_model)
## $pathway
## [1] 0.8590604
## 
## $lv
## [1] 0.464467
## 
## $sig.pathway.by.lv
## [1] 0.6497462

4.3 CalculateUSparsity

a vector of length ncol(plier.results$U) that contains the proportion of positive (significant.only = FALSE) or significant (significant.only = TRUE) entries in each column

prop.vector = CalculateUSparsity(recount_KEGG_model)
head(prop.vector)
##        LV1        LV2        LV3        LV4        LV5        LV6 
## 0.30536913 0.11744966 0.11744966 0.10067114 0.09395973 0.06040268

4.4 EvalWrapper

EvalWrapper(recount_KEGG_model)

5 GenomicSuperSignature functions

score = GenomicSuperSignature::calScore(exprs.mat, recount2PCAmodel)
sampleScoreHeatmap(score[[1]], "TCGA_RNAseq", "recount_PCA_model",
                   show_column_names = FALSE, 
                   show_row_names = TRUE,
                   row_names_gp = 7)

x = t(score[[1]])
topInd = order(x[,1], decreasing = TRUE)[1:5]
bottomInd = order(x[,1])[1:5]

subset = x[c(topInd, bottomInd), 1]
sampleScoreHeatmap(t(subset), colnames(x)[1], "recount2_PCA_model",
                   show_column_names = TRUE, 
                   show_row_names = TRUE,
                   column_names_gp = 10)

topPathways_recount2PCAmodel = readRDS("/data2/Genomic_Super_Signature/multiPCA/data/topPathways_recount2PCAmodel.rds")
topPathways_recount2PCAmodel[names(subset)]
##                                               Cl118_22 (44/44)
## Up_1                                  ECM-receptor interaction
## Up_2                                                    Asthma
## Up_3                           Staphylococcus aureus infection
## Up_4    Arrhythmogenic right ventricular cardiomyopathy (ARVC)
## Up_5                       Complement and coagulation cascades
## Up_6                                                   Malaria
## Up_7                                  Renin-angiotensin system
## Up_8                          Protein digestion and absorption
## Up_9                            Cell adhesion molecules (CAMs)
## Up_10                                       Mineral absorption
## Down_1                                                Ribosome
## Down_2             Protein processing in endoplasmic reticulum
## Down_3                                             Spliceosome
## Down_4                                Primary immunodeficiency
## Down_5                                   N-Glycan biosynthesis
## Down_6                               mRNA surveillance pathway
## Down_7                                              Proteasome
## Down_8                             Aminoacyl-tRNA biosynthesis
## Down_9                            NF-kappa B signaling pathway
## Down_10                      B cell receptor signaling pathway
##                                  Cl118_06 (31/31)
## Up_1             Regulation of actin cytoskeleton
## Up_2            Thyroid hormone signaling pathway
## Up_3                               Focal adhesion
## Up_4        Phosphatidylinositol signaling system
## Up_5                          MicroRNAs in cancer
## Up_6                            Adherens junction
## Up_7             Cortisol synthesis and secretion
## Up_8                                Axon guidance
## Up_9                      Proteoglycans in cancer
## Up_10                          Salivary secretion
## Down_1                                   Ribosome
## Down_2                  Oxidative phosphorylation
## Down_3                          Parkinson disease
## Down_4               Systemic lupus erythematosus
## Down_5                         Huntington disease
## Down_6  Non-alcoholic fatty liver disease (NAFLD)
## Down_7                                 Proteasome
## Down_8                 Cardiac muscle contraction
## Down_9                          Alzheimer disease
## Down_10                             Thermogenesis
##                                   Cl118_108 (46/46)
## Up_1                                    Influenza A
## Up_2                                        Measles
## Up_3    Protein processing in endoplasmic reticulum
## Up_4                     Osteoclast differentiation
## Up_5                                      Mitophagy
## Up_6                    Prolactin signaling pathway
## Up_7                                    Hepatitis C
## Up_8       C-type lectin receptor signaling pathway
## Up_9                 Collecting duct acid secretion
## Up_10                                Focal adhesion
## Down_1                              DNA replication
## Down_2                     Homologous recombination
## Down_3                       Fanconi anemia pathway
## Down_4                              Mismatch repair
## Down_5                         Base excision repair
## Down_6                                   Cell cycle
## Down_7                   Nucleotide excision repair
## Down_8                 Systemic lupus erythematosus
## Down_9                              Drug metabolism
## Down_10                   One carbon pool by folate
##                                     Cl118_46 (37/37)
## Up_1                    Steroid hormone biosynthesis
## Up_2                         Chemical carcinogenesis
## Up_3    Metabolism of xenobiotics by cytochrome P450
## Up_4                                          Asthma
## Up_5               Ascorbate and aldarate metabolism
## Up_6                                     Necroptosis
## Up_7                           TNF signaling pathway
## Up_8                                       Apoptosis
## Up_9                          Rap1 signaling pathway
## Up_10                           Serotonergic synapse
## Down_1                                  Gap junction
## Down_2                     mRNA surveillance pathway
## Down_3                     Citrate cycle (TCA cycle)
## Down_4                  Fat digestion and absorption
## Down_5                     Th17 cell differentiation
## Down_6            Vascular smooth muscle contraction
## Down_7                                 RNA transport
## Down_8                   Aminoacyl-tRNA biosynthesis
## Down_9                      Chronic myeloid leukemia
## Down_10                   Oxytocin signaling pathway
##                                 Cl118_74 (16/16)
## Up_1                                     Malaria
## Up_2                        Rheumatoid arthritis
## Up_3             Staphylococcus aureus infection
## Up_4      Cytokine-cytokine receptor interaction
## Up_5         Antigen processing and presentation
## Up_6                Dilated cardiomyopathy (DCM)
## Up_7                    ECM-receptor interaction
## Up_8         Complement and coagulation cascades
## Up_9           Hypertrophic cardiomyopathy (HCM)
## Up_10                                  Phagosome
## Down_1   Proximal tubule bicarbonate reclamation
## Down_2                        Mineral absorption
## Down_3                                Peroxisome
## Down_4                      Histidine metabolism
## Down_5                   Glycerolipid metabolism
## Down_6  Glycine, serine and threonine metabolism
## Down_7                    PPAR signaling pathway
## Down_8                       Pyruvate metabolism
## Down_9              Glycolysis / Gluconeogenesis
## Down_10          Fructose and mannose metabolism
##                                     Cl118_30 (26/26)
## Up_1                                      Proteasome
## Up_2                                        Ribosome
## Up_3                       Oxidative phosphorylation
## Up_4                               Parkinson disease
## Up_5                                     Spliceosome
## Up_6                            Steroid biosynthesis
## Up_7                             Pyruvate metabolism
## Up_8                           Propanoate metabolism
## Up_9                              Huntington disease
## Up_10              Ribosome biogenesis in eukaryotes
## Down_1                              ABC transporters
## Down_2                            Taste transduction
## Down_3                     Graft-versus-host disease
## Down_4                       African trypanosomiasis
## Down_5  Intestinal immune network for IgA production
## Down_6                    Autoimmune thyroid disease
## Down_7                           Allograft rejection
## Down_8               Staphylococcus aureus infection
## Down_9                      Linoleic acid metabolism
## Down_10                                    Mitophagy
##                                                 Cl118_64 (48/48)
## Up_1                                                    Ribosome
## Up_2                                   Oxidative phosphorylation
## Up_3                                           Parkinson disease
## Up_4                                          Huntington disease
## Up_5                                                  Proteasome
## Up_6                                           Alzheimer disease
## Up_7                                  Cardiac muscle contraction
## Up_8                   Non-alcoholic fatty liver disease (NAFLD)
## Up_9                                Glycolysis / Gluconeogenesis
## Up_10                                              Thermogenesis
## Down_1                                JAK-STAT signaling pathway
## Down_2                          Herpes simplex virus 1 infection
## Down_3                         Thyroid hormone signaling pathway
## Down_4                     Phosphatidylinositol signaling system
## Down_5                                               Hepatitis B
## Down_6  Signaling pathways regulating pluripotency of stem cells
## Down_7                                  ECM-receptor interaction
## Down_8                                    Fanconi anemia pathway
## Down_9                                       MicroRNAs in cancer
## Down_10                                Type II diabetes mellitus
##                                                  Cl118_86 (33/33)
## Up_1                                         Galactose metabolism
## Up_2                                                     Lysosome
## Up_3    Endocrine and other factor-regulated calcium reabsorption
## Up_4                                               Bile secretion
## Up_5                                    Citrate cycle (TCA cycle)
## Up_6                                        N-Glycan biosynthesis
## Up_7                                Starch and sucrose metabolism
## Up_8                              Fructose and mannose metabolism
## Up_9                                                    Autophagy
## Up_10                                          Insulin resistance
## Down_1                                 Autoimmune thyroid disease
## Down_2                                  Graft-versus-host disease
## Down_3                                        Allograft rejection
## Down_4                                              Legionellosis
## Down_5                                                     Asthma
## Down_6                                   Type I diabetes mellitus
## Down_7                            Staphylococcus aureus infection
## Down_8                                   Linoleic acid metabolism
## Down_9                               Epstein-Barr virus infection
## Down_10                                  Apelin signaling pathway
##                                    Cl118_94 (36/36)
## Up_1                                       Ribosome
## Up_2                            Tyrosine metabolism
## Up_3                      Pentose phosphate pathway
## Up_4                       Phenylalanine metabolism
## Up_5                Fructose and mannose metabolism
## Up_6                   Glycolysis / Gluconeogenesis
## Up_7                           Galactose metabolism
## Up_8                           Basal cell carcinoma
## Up_9                   Fat digestion and absorption
## Up_10                        Glutathione metabolism
## Down_1                       Fanconi anemia pathway
## Down_2                                RNA transport
## Down_3                               Protein export
## Down_4                   Non-homologous end-joining
## Down_5                    mRNA surveillance pathway
## Down_6               Ubiquitin mediated proteolysis
## Down_7                  Prolactin signaling pathway
## Down_8                               Oocyte meiosis
## Down_9                                  Hepatitis B
## Down_10 Protein processing in endoplasmic reticulum
##                                  Cl118_54 (54/54)
## Up_1                                     Ribosome
## Up_2                    mRNA surveillance pathway
## Up_3                             Circadian rhythm
## Up_4                                  Spliceosome
## Up_5                                RNA transport
## Up_6                                  Necroptosis
## Up_7               Ubiquitin mediated proteolysis
## Up_8                  Basal transcription factors
## Up_9    SNARE interactions in vesicular transport
## Up_10   Natural killer cell mediated cytotoxicity
## Down_1                   Phenylalanine metabolism
## Down_2            Staphylococcus aureus infection
## Down_3                    African trypanosomiasis
## Down_4                 Autoimmune thyroid disease
## Down_5                                    Malaria
## Down_6                         Taste transduction
## Down_7                        Tyrosine metabolism
## Down_8   Human immunodeficiency virus 1 infection
## Down_9               Epstein-Barr virus infection
## Down_10  C-type lectin receptor signaling pathway