Last updated: 2020-11-10

Checks: 6 1

Knit directory: Proteomics/analysis/

This reproducible R Markdown analysis was created with workflowr (version 1.6.2). The Checks tab describes the reproducibility checks that were applied when the results were created. The Past versions tab lists the development history.


The R Markdown is untracked by Git. To know which version of the R Markdown file created these results, you'll want to first commit it to the Git repo. If you're still working on the analysis, you can ignore this warning. When you're finished, you can run wflow_publish to commit the R Markdown file and build the HTML.

Great job! The global environment was empty. Objects defined in the global environment can affect the analysis in your R Markdown file in unknown ways. For reproduciblity it's best to always run the code in an empty environment.

The command set.seed(20200227) was run prior to running the code in the R Markdown file. Setting a seed ensures that any results that rely on randomness, e.g. subsampling or permutations, are reproducible.

Great job! Recording the operating system, R version, and package versions is critical for reproducibility.

Nice! There were no cached chunks for this analysis, so you can be confident that you successfully produced the results during this run.

Great job! Using relative paths to the files within your workflowr project makes it easier to run your code on other machines.

Great! You are using Git for version control. Tracking code development and connecting the code version to the results is critical for reproducibility.

The results in this page were generated with repository version 3fb50c5. See the Past versions tab to see a history of the changes made to the R Markdown and HTML files.

Note that you need to be careful to ensure that all relevant files for the analysis have been committed to Git prior to generating the results (you can use wflow_publish or wflow_git_commit). workflowr only checks the R Markdown file, but you know if there are other scripts or data files that it depends on. Below is the status of the Git repository when the results were generated:


Ignored files:
    Ignored:    .DS_Store
    Ignored:    .Rhistory
    Ignored:    .Rproj.user/
    Ignored:    analysis/.DS_Store
    Ignored:    analysis/.Rhistory
    Ignored:    analysis/correlateCLLPD_cache/
    Ignored:    analysis/lassoForSTAT2_cache/
    Ignored:    analysis/manuscript_S2_genomicAssociation_oldTimsTOF_cache/
    Ignored:    analysis/manuscript_S3_trisomy12_cache/
    Ignored:    analysis/manuscript_S4_IGHV_cache/
    Ignored:    analysis/manuscript_S4_IGHV_oldTimsTOF_cache/
    Ignored:    analysis/manuscript_S5_trisomy19_cache/
    Ignored:    analysis/manuscript_S6_del11q_cache/
    Ignored:    analysis/manuscript_S6_del11q_oldTimsTOF_cache/
    Ignored:    analysis/manuscript_S7_SF3B1_cache/
    Ignored:    analysis/manuscript_S8_drugResponse_Outcomes_cache/
    Ignored:    analysis/manuscript_S9_STAT2_cache/
    Ignored:    code/.Rhistory
    Ignored:    data/.DS_Store
    Ignored:    output/.DS_Store

Untracked files:
    Untracked:  analysis/.trisomy12_norm.pdf
    Untracked:  analysis/CNVanalysis_11q.Rmd
    Untracked:  analysis/CNVanalysis_trisomy12.Rmd
    Untracked:  analysis/CNVanalysis_trisomy19.Rmd
    Untracked:  analysis/STAT2_cytokines.Rmd
    Untracked:  analysis/SUGP1_splicing.svg.xml
    Untracked:  analysis/analysisDrugResponses.Rmd
    Untracked:  analysis/analysisDrugResponses_IC50.Rmd
    Untracked:  analysis/analysisPCA.Rmd
    Untracked:  analysis/analysisPreliminary_LUMOS.Rmd
    Untracked:  analysis/analysisPreliminary_timsTOF_Hela.Rmd
    Untracked:  analysis/analysisPreliminary_timsTOF_new.Rmd
    Untracked:  analysis/analysisSplicing.Rmd
    Untracked:  analysis/analysisTrisomy19.Rmd
    Untracked:  analysis/annotateCNV.Rmd
    Untracked:  analysis/comparePlatforms_LUMOS_helaTimsTOF.Rmd
    Untracked:  analysis/comparePlatforms_LUMOS_newTimsTOF.Rmd
    Untracked:  analysis/comparePlatforms_newTimsTOF_helaTimsTOF.Rmd
    Untracked:  analysis/complexAnalysis_IGHV.Rmd
    Untracked:  analysis/complexAnalysis_IGHV_alternative.Rmd
    Untracked:  analysis/complexAnalysis_overall.Rmd
    Untracked:  analysis/complexAnalysis_trisomy12.Rmd
    Untracked:  analysis/complexAnalysis_trisomy12_alternative.Rmd
    Untracked:  analysis/correlateGenomic_PC12adjusted.Rmd
    Untracked:  analysis/correlateGenomic_noBlock.Rmd
    Untracked:  analysis/correlateGenomic_noBlock_MCLL.Rmd
    Untracked:  analysis/correlateGenomic_noBlock_UCLL.Rmd
    Untracked:  analysis/correlateGenomic_timsTOFnew.Rmd
    Untracked:  analysis/correlateGenomic_timsTOFnewHela.Rmd
    Untracked:  analysis/correlateRNAexpression.Rmd
    Untracked:  analysis/default.css
    Untracked:  analysis/del11q.pdf
    Untracked:  analysis/del11q_norm.pdf
    Untracked:  analysis/full_diff_list.csv
    Untracked:  analysis/lassoForSTAT2.Rmd
    Untracked:  analysis/manuscript_S0_PrepareData.Rmd
    Untracked:  analysis/manuscript_S1_Overview.Rmd
    Untracked:  analysis/manuscript_S2_genomicAssociation.Rmd
    Untracked:  analysis/manuscript_S2_genomicAssociation_oldTimsTOF.Rmd
    Untracked:  analysis/manuscript_S3_trisomy12.Rmd
    Untracked:  analysis/manuscript_S4_IGHV.Rmd
    Untracked:  analysis/manuscript_S4_IGHV_oldTimsTOF.Rmd
    Untracked:  analysis/manuscript_S5_trisomy19.Rmd
    Untracked:  analysis/manuscript_S6_del11q.Rmd
    Untracked:  analysis/manuscript_S6_del11q_oldTimsTOF.Rmd
    Untracked:  analysis/manuscript_S7_SF3B1.Rmd
    Untracked:  analysis/manuscript_S8_drugResponse_Outcomes.Rmd
    Untracked:  analysis/manuscript_S9_STAT2.Rmd
    Untracked:  analysis/peptideValidate.Rmd
    Untracked:  analysis/plotCNV_del11q.pdf
    Untracked:  analysis/plotExpressionCNV.Rmd
    Untracked:  analysis/processPeptides_LUMOS.Rmd
    Untracked:  analysis/processProteomics_timsTOF_Hela.Rmd
    Untracked:  analysis/processProteomics_timsTOF_new.Rmd
    Untracked:  analysis/protCLL.RData
    Untracked:  analysis/qualityControl_timsTOF_Hela.Rmd
    Untracked:  analysis/qualityControl_timsTOF_new.Rmd
    Untracked:  analysis/style.css
    Untracked:  analysis/tableS1_DE_proteins_p0.01.xlsx
    Untracked:  analysis/test.pdf
    Untracked:  analysis/test.svg
    Untracked:  analysis/tri12Enrich.pdf
    Untracked:  analysis/trisomy12.pdf
    Untracked:  analysis/trisomy12_AFcor.Rmd
    Untracked:  analysis/trisomy12_norm.pdf
    Untracked:  code/AlteredPQR.R
    Untracked:  code/utils.R
    Untracked:  data/190909_CLL_prot_abund_med_norm.tsv
    Untracked:  data/190909_CLL_prot_abund_no_norm.tsv
    Untracked:  data/200725_cll_diaPASEF_direct_reports/
    Untracked:  data/200728_cll_diaPASEF_direct_plus_hela_reports/
    Untracked:  data/20190423_Proteom_submitted_samples_bereinigt.xlsx
    Untracked:  data/20191025_Proteom_submitted_samples_final.xlsx
    Untracked:  data/Chemokines.csv
    Untracked:  data/IFN_list.csv
    Untracked:  data/IFNreceptor.csv
    Untracked:  data/Interleukin_receptor.csv
    Untracked:  data/Interleukins.csv
    Untracked:  data/LUMOS/
    Untracked:  data/LUMOS_peptides/
    Untracked:  data/LUMOS_protAnnotation.csv
    Untracked:  data/LUMOS_protAnnotation_fix.csv
    Untracked:  data/SampleAnnotation_cleaned.xlsx
    Untracked:  data/chemoReceptor.csv
    Untracked:  data/example_proteomics_data
    Untracked:  data/facTab_IC50atLeast3New.RData
    Untracked:  data/gmts/
    Untracked:  data/mapEnsemble.txt
    Untracked:  data/mapSymbol.txt
    Untracked:  data/proteins_in_complexes
    Untracked:  data/pyprophet_export_aligned.csv
    Untracked:  data/timsTOF_protAnnotation.csv
    Untracked:  output/Figure1A.png
    Untracked:  output/Figure1A.pptx
    Untracked:  output/LUMOS_processed.RData
    Untracked:  output/MSH6_splicing.svg
    Untracked:  output/SUGP1_splicing.eps
    Untracked:  output/SUGP1_splicing.pdf
    Untracked:  output/SUGP1_splicing.svg
    Untracked:  output/cnv_plots.zip
    Untracked:  output/cnv_plots/
    Untracked:  output/cnv_plots_norm.zip
    Untracked:  output/ddsrna_enc.RData
    Untracked:  output/deResList.RData
    Untracked:  output/deResList_timsTOF.RData
    Untracked:  output/deResList_timsTOF_old.RData
    Untracked:  output/dxdCLL.RData
    Untracked:  output/dxdCLL2.RData
    Untracked:  output/encMap.RData
    Untracked:  output/exprCNV.RData
    Untracked:  output/exprCNV_enc.RData
    Untracked:  output/lassoResults_CPS.RData
    Untracked:  output/lassoResults_IC50.RData
    Untracked:  output/patMeta_enc.RData
    Untracked:  output/pepCLL_lumos.RData
    Untracked:  output/pepCLL_lumos_enc.RData
    Untracked:  output/pepTab_lumos.RData
    Untracked:  output/pheno1000_enc.RData
    Untracked:  output/pheno1000_main.RData
    Untracked:  output/plotCNV_allChr11_diff.pdf
    Untracked:  output/plotCNV_del11q_sum.pdf
    Untracked:  output/proteomic_LUMOS_20200227.RData
    Untracked:  output/proteomic_LUMOS_20200320.RData
    Untracked:  output/proteomic_LUMOS_20200430.RData
    Untracked:  output/proteomic_LUMOS_enc.RData
    Untracked:  output/proteomic_timsTOF_20200227.RData
    Untracked:  output/proteomic_timsTOF_Hela_20200806.RData
    Untracked:  output/proteomic_timsTOF_enc.RData
    Untracked:  output/proteomic_timsTOF_new_20200806.RData
    Untracked:  output/proteomic_timsTOF_old_enc.RData
    Untracked:  output/splicingResults.RData
    Untracked:  output/survival_enc.RData
    Untracked:  output/timsTOF_processed.RData
    Untracked:  plotCNV_del11q_diff.pdf
    Untracked:  summary/
    Untracked:  supp_latex/

Unstaged changes:
    Modified:   analysis/_site.yml
    Modified:   analysis/analysisSF3B1.Rmd
    Modified:   analysis/compareProteomicsRNAseq.Rmd
    Modified:   analysis/correlateCLLPD.Rmd
    Modified:   analysis/correlateGenomic.Rmd
    Deleted:    analysis/correlateGenomic_removePC.Rmd
    Modified:   analysis/correlateMIR.Rmd
    Modified:   analysis/correlateMethylationCluster.Rmd
    Modified:   analysis/index.Rmd
    Modified:   analysis/predictOutcome.Rmd
    Modified:   analysis/processProteomics_LUMOS.Rmd
    Modified:   analysis/qualityControl_LUMOS.Rmd

Note that any generated files, e.g. HTML, png, CSS, etc., are not included in this status report because it is ok for generated content to have uncommitted changes.


There are no past versions. Publish this analysis with wflow_publish() to start tracking its development.


RNA-protein associations

Process both datasets

protCLL <- protCLL[rowData(protCLL)$uniqueMap,]

colnames(dds) <- dds$PatID
dds <- estimateSizeFactors(dds)
sampleOverlap <- intersect(colnames(protCLL), colnames(dds))
geneOverlap <- intersect(rowData(protCLL)$ensembl_gene_id, rownames(dds))
ddsSub <- dds[geneOverlap, sampleOverlap]
protSub <- protCLL[match(geneOverlap, rowData(protCLL)$ensembl_gene_id), sampleOverlap]

#how many gene don't have RNA expression at all?
noExp <- rowSums(counts(ddsSub)) == 0

#remove those genes in both datasets
ddsSub <- ddsSub[!noExp,]
protSub <- protSub[!noExp,]

#remove proteins with duplicated identifiers
protSub <- protSub[!duplicated(rowData(protSub)$name)]

geneOverlap <- intersect(rowData(protSub)$ensembl_gene_id, rownames(ddsSub))

ddsSub.vst <- varianceStabilizingTransformation(ddsSub)

Calculate correlations between protein abundance and RNA expression

rnaMat <- assay(ddsSub.vst)
proMat <- assays(protSub)[["count"]]
rownames(proMat) <- rowData(protSub)$ensembl_gene_id

corTab <- lapply(geneOverlap, function(n) {
  rna <- rnaMat[n,]
  pro.raw <- proMat[n,]
  res.raw <- cor.test(rna, pro.raw, use = "pairwise.complete.obs")
  tibble(id = n,
         p = res.raw$p.value,
         coef = res.raw$estimate)
}) %>% bind_rows() %>%
  arrange(desc(coef)) %>% mutate(p.adj = p.adjust(p, method = "BH"),
                                 symbol = rowData(dds[id,])$symbol,
                                 chr = rowData(dds[id,])$chromosome)

Plot the distribution

corHistPlot <- ggplot(corTab, aes(x=coef)) + geom_histogram(position = "identity", col = colList[2], alpha =0.3, bins =50) +
  geom_vline(xintercept = 0, col = colList[1], linetype = "dashed") + xlim(-0.7,1) +
      xlab("Pearson's correlation coefficient") + theme_half +
  ggtitle("Correlation between mRNA and protein expression")
corHistPlot

Median Pearson's correlation coefficient

median(corTab$coef)
[1] 0.1718669

Influence of overall protein/RNA abundance on correlation

medProt <- rowMedians(proMat,na.rm = T)
names(medProt) <- rownames(proMat)
medRNA <- rowMedians(rnaMat, na.rm = T)
names(medRNA) <- rownames(rnaMat)

plotTab <- corTab %>% mutate(rnaAbundance = medRNA[id], protAbundance = medProt[id])
plotList <- list()

plotList[["rna"]] <- plotCorScatter(plotTab,"coef","rnaAbundance",
                                    showR2 = FALSE, annoPos = "left",
                                    x_lab ="Correlation coefficient",
                                    y_lab = "Median RNA expression",
                                    title = "", dotCol = colList[5], textCol = colList[1])

plotList[["protein"]] <- plotCorScatter(plotTab,"coef","protAbundance",
                                    showR2 = FALSE, annoPos = "left",
                                    x_lab ="Correlation coefficient",
                                    y_lab = "Median protein expression",
                                    title = "", dotCol = colList[6], textCol = colList[1])

cowplot::plot_grid(plotlist = plotList, ncol =2)

Plot protein RNA correlation for specified genes

Good correlations

geneList <- c("ZAP70","CD22","CD38","CD79A")
plotList <- lapply(geneList, function(n) {
  geneId <- rownames(dds)[match(n, rowData(dds)$symbol)]
  stopifnot(length(geneId) ==1)
  plotTab <- tibble(x=rnaMat[geneId,],y=proMat[geneId,], IGHV=protSub$IGHV.status)
  coef <- cor(plotTab$x, plotTab$y, use="pairwise.complete")
  annoPos <- ifelse (coef > 0, "left","right")
  plotCorScatter(plotTab, "x","y", showR2 = FALSE, annoPos = annoPos, x_lab = "RNA expression", shape = "IGHV",
                 y_lab ="Protein expression", title = n,dotCol = colList[4], textCol = colList[1], legendPos="none")
})
goodCorPlot <- cowplot::plot_grid(plotlist = plotList, ncol =2)
goodCorPlot

Bad correlations

geneList <- c("DTNBP1","PRPF19")
plotList <- lapply(geneList, function(n) {
  geneId <- rownames(dds)[match(n, rowData(dds)$symbol)]
  stopifnot(length(geneId) ==1)
  plotTab <- tibble(x=rnaMat[geneId,],y=proMat[geneId,], IGHV=protSub$IGHV.status)
  coef <- cor(plotTab$x, plotTab$y, use="pairwise.complete")
  annoPos <- ifelse (coef > 0, "left","right")
  plotCorScatter(plotTab, "x","y", showR2 = FALSE, annoPos = annoPos, x_lab = "RNA expression",
                 y_lab ="Protein expression", title = n,dotCol = colList[4], textCol = colList[1],
                 shape = "IGHV", legendPos = "none")
})
badCorPlot <- cowplot::plot_grid(plotlist = plotList, ncol =2)
badCorPlot

Principal component analysis

Calculate PCA

#remove genes on sex chromosomes
protCLL.sub <- protCLL[!rowData(protCLL)$chromosome_name %in% c("X","Y"),]
plotMat <- assays(protCLL.sub)[["QRILC"]]
sds <- genefilter::rowSds(plotMat)
plotMat <- as.matrix(plotMat[order(sds,decreasing = TRUE),])
colAnno <- colData(protCLL)[,c("gender","IGHV.status","trisomy12")] %>%
  data.frame()
colAnno$trisomy12 <- ifelse(colAnno$trisomy12 %in% 1, "yes","no")

pcOut <- prcomp(t(plotMat), center =TRUE, scale. = TRUE)
pcRes <- pcOut$x
eigs <- pcOut$sdev^2
varExp <- structure(eigs/sum(eigs),names = colnames(pcRes))

All proteins are included for PCA analysis

Plot PC1 and PC2

plotTab <- pcRes %>% data.frame() %>% cbind(colAnno[rownames(.),]) %>%
  rownames_to_column("patID") %>% as_tibble()

plotPCA12 <- ggplot(plotTab, aes(x=PC1, y=PC2, col = trisomy12, shape = IGHV.status)) + geom_point(size=4) +
  xlab(sprintf("PC1 (%1.2f%%)",varExp[["PC1"]]*100)) +
  ylab(sprintf("PC2 (%1.2f%%)",varExp[["PC2"]]*100)) +
  scale_color_manual(values = colList) +
  scale_shape_manual(values = c(M = 16, U =1)) +
  xlim(-60,60) + ylim(-60,60) +
  theme_full + theme(legend.position = "none")

plotPCA12

Plot PC3 and PC4

plotPCA34 <- ggplot(plotTab, aes(x=PC3, y=PC4, col = trisomy12, shape = IGHV.status)) + geom_point(size=4) +
  xlab(sprintf("PC3 (%1.2f%%)",varExp[["PC3"]]*100)) +
  ylab(sprintf("PC4 (%1.2f%%)",varExp[["PC4"]]*100)) +
  scale_color_manual(values = colList) +
  scale_shape_manual(values = c(M = 16, U =1)) +
  xlim(-60,60) + ylim(-60,60) +
  theme_full
plotPCA34

Correlation test between PCs and IGHV.status

corTab <- lapply(colnames(pcRes),  function(pc) {
  ighvCor <- t.test(pcRes[,pc] ~ colAnno$IGHV.status, var.equal=TRUE)
  tri12Cor <- t.test(pcRes[,pc] ~ colAnno$trisomy12, var.equal=TRUE)
  tibble(PC = pc, 
         feature=c("IGHV", "trisomy12"),
         p = c(ighvCor$p.value, tri12Cor$p.value))
}) %>% bind_rows() %>% mutate(p.adj = p.adjust(p)) %>%
  filter(p <= 0.05) %>% arrange(p)
corTab
# A tibble: 5 x 4
  PC    feature          p        p.adj
  <chr> <chr>        <dbl>        <dbl>
1 PC3   trisomy12 1.09e-10 0.0000000107
2 PC4   IGHV      2.84e- 6 0.000275    
3 PC49  IGHV      4.97e- 3 0.477       
4 PC2   trisomy12 2.13e- 2 1           
5 PC1   IGHV      4.81e- 2 1           

Pathway enrichment on PC1 and PC2

PC1

enRes <- list()
gmts = list(H= "../data/gmts/h.all.v6.2.symbols.gmt",
            KEGG = "../data/gmts/c2.cp.kegg.v6.2.symbols.gmt",
            C6 = "../data/gmts/c6.all.v6.2.symbols.gmt")

proMat <- assays(protCLL.sub)[["QRILC"]]
iPC <- "PC1"
pc <- pcRes[,iPC][colnames(proMat)]
designMat <- model.matrix(~1+pc)
fit <- limma::lmFit(proMat, designMat)
fit2 <- eBayes(fit)
corRes <- topTable(fit2, "pc", number = Inf) %>%
  data.frame() %>% rownames_to_column("id")

inputTab <- corRes %>% filter(adj.P.Val < 0.1) %>%
  mutate(name = rowData(protCLL[id,])$hgnc_symbol) %>% filter(!is.na(name)) %>%
  distinct(name, .keep_all = TRUE) %>%
  select(name, t) %>% data.frame() %>% column_to_rownames("name")

enRes[["Proteins associated with PC1"]] <- runGSEA(inputTab, gmts$H, "page")

PC2

proMat <- assays(protCLL.sub)[["QRILC"]]
iPC <- "PC2"
pc <- pcRes[,iPC][colnames(proMat)]
designMat <- model.matrix(~1+pc)
fit <- limma::lmFit(proMat, designMat)
fit2 <- eBayes(fit)
corRes <- topTable(fit2, "pc", number = Inf) %>%
  data.frame() %>% rownames_to_column("id")

inputTab <- corRes %>% filter(adj.P.Val < 0.1) %>%
  mutate(name = rowData(protCLL[id,])$hgnc_symbol) %>% filter(!is.na(name)) %>%
  distinct(name, .keep_all = TRUE) %>%
  select(name, t) %>% data.frame() %>% column_to_rownames("name")

enRes[["Proteins associated with PC2"]] <- runGSEA(inputTab, gmts$H, "page")
cowplot::plot_grid(plotEnrichmentBar(enRes[[1]], ifFDR = TRUE, pCut = 0.05, setName = "",title = "Proteins associated with PC1"),
                   plotEnrichmentBar(enRes[[2]], ifFDR = TRUE, pCut = 0.05, setName = "", title = "Proteins associated with PC2"),ncol=1)

#using Camera, the results are slightly different

gmts = list(H= "../data/gmts/h.all.v6.2.symbols.gmt",
            KEGG = "../data/gmts/c2.cp.kegg.v6.2.symbols.gmt",
            C6 = "../data/gmts/c6.all.v6.2.symbols.gmt")

proMat <- assays(protCLL.sub)[["QRILC"]]
iPC <- "PC1"
pc <- pcRes[,iPC][colnames(proMat)]
designMat <- model.matrix(~1+pc)
res1 <- runCamera(proMat, designMat, gmts$H, id = rowData(protCLL[rownames(proMat),])$hgnc_symbol,
                  plotTitle = "Proteins associated with PC1")$enrichPlot

iPC <- "PC2"
pc <- pcRes[,iPC][colnames(proMat)]
designMat <- model.matrix(~1+pc)
res2 <- runCamera(proMat, designMat, gmts$H, id = rowData(protCLL[rownames(proMat),])$hgnc_symbol,
                  plotTitle = "Proteins associated with PC2")$enrichPlot

cowplot::plot_grid(res1, res2, nrow=2, align = "hv", rel_heights = c(1,2))

Hierarchical clustering

Original dataset

protCLL.sub <- protCLL[!rowData(protCLL)$chromosome_name %in% c("X","Y"),]
plotMat <- assays(protCLL.sub)[["QRILC"]]
colAnno <- colData(protCLL)[,c("IGHV.status","trisomy12")] %>%
  data.frame()
colAnno$trisomy12 <- ifelse(colAnno$trisomy12 %in% 1, "yes","no")

plotMat <- mscale(plotMat, center = 5)

annoCol <- list(trisomy12 = c(yes = "black",no = "grey80"),
                IGHV.status = c(M = colList[3], U = colList[4]))
pheatmap::pheatmap(plotMat, annotation_col = colAnno, scale = "none",
                   clustering_method = "ward.D2",
                   color = colorRampPalette(c(colList[2],"white",colList[1]))(100),
                   breaks = seq(-5,5, length.out = 101), annotation_colors = annoCol, 
                   show_rownames = FALSE, show_colnames = FALSE,
                   treeheight_row = 0)

Data with PC1 and PC2 removed

#Reconstruct data with PC1 and PC2 removed
protCLL.sub <- protCLL[!rowData(protCLL)$chromosome_name %in% c("X","Y"),]
protMat <- assays(protCLL.sub)[["QRILC"]]
mu <- colMeans(protMat)
Xpca <- prcomp(protMat, center = TRUE, scale. = TRUE)
#reconstruct without the first two components
protMat.new <- Xpca$x[,3:ncol(Xpca$x)] %*% t(Xpca$rotation[,3:ncol(Xpca$x)])
protMat.new <- scale(protMat.new, center = -mu, scale = TRUE)
#protMat.new <- t(protMat.new)
plotMat <- protMat.new
plotMat <- mscale(plotMat, center = 5)
annoCol <- list(trisomy12 = c(yes = "black",no = "grey80"),
                IGHV.status = c(M = colList[3], U = colList[4]))
pheatmap::pheatmap(plotMat, annotation_col = colAnno, scale = "none",
                   clustering_method = "ward.D2",
                   color = colorRampPalette(c(colList[2],"white",colList[1]))(100),
                   breaks = seq(-5,5, length.out = 101), annotation_colors = annoCol, 
                   show_rownames = FALSE, show_colnames = FALSE,
                   treeheight_row = 0)

Summarise significant associations

Bar plot of number of significant associations (10% FDR)

load("../output/deResList.RData")
plotTab <- resList %>% group_by(Gene) %>%
  summarise(nFDR.local = sum(adj.P.Val <= 0.1),
            nFDR.global = sum(adj.P.global <= 0.1),
            nFDR.IHW = sum(adj.P.IHW <= 0.1),
            nP = sum(P.Value < 0.05))

#use IHW for adjusting p-values
resList <- mutate(resList, adj.P.Val = adj.P.IHW)
plotTab <- arrange(plotTab, desc(nFDR.IHW)) %>% mutate(Gene = factor(Gene, levels = Gene))
numCorBar <- ggplot(plotTab, aes(x=Gene, y = nFDR.IHW)) + geom_bar(stat="identity",fill=colList[2]) + 
  geom_text(aes(label = paste0("n=", nFDR.IHW)),vjust=-1,col=colList[1]) + ylim(0,1200) +
  theme_half + theme(axis.text.x = element_text(angle = 90, hjust=1, vjust=0.5)) +
  ylab("Number of associations\n(10% FDR)") + xlab("")

numCorBar

Assemble figure

designPlot <- draw_image("../output/Figure1A.png")
p <- ggdraw() + designPlot

leftCol <- plot_grid(p, 
                     plot_grid(plotPCA12, plotPCA34, ncol=2, rel_widths = c(.45,0.55)),
                     plot_grid(numCorBar,NULL,rel_widths = c(0.8,0.2),ncol=2), ncol = 1,
                     labels = c("A","E","F"), label_size = 20, vjust = c(1.5, 0,-0.1),
                     rel_heights = c(1.2,1,1))


rightCol <- plot_grid(corHistPlot,
                       goodCorPlot,
                       badCorPlot, ncol=1, rel_heights = c(0.28,0.48,0.24), labels = c("B","C","D"), label_size = 20)
#pdf("test.pdf", height = 13, width = 18)
plot_grid(leftCol, rightCol, rel_widths = c(0.6, 0.4))

#dev.off()

sessionInfo()
R version 3.6.0 (2019-04-26)
Platform: x86_64-apple-darwin15.6.0 (64-bit)
Running under: macOS  10.15.7

Matrix products: default
BLAS:   /Library/Frameworks/R.framework/Versions/3.6/Resources/lib/libRblas.0.dylib
LAPACK: /Library/Frameworks/R.framework/Versions/3.6/Resources/lib/libRlapack.dylib

locale:
[1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8

attached base packages:
[1] parallel  stats4    stats     graphics  grDevices utils     datasets 
[8] methods   base     

other attached packages:
 [1] piano_2.2.0                 latex2exp_0.4.0            
 [3] forcats_0.5.0               stringr_1.4.0              
 [5] dplyr_1.0.0                 purrr_0.3.4                
 [7] readr_1.3.1                 tidyr_1.1.0                
 [9] tibble_3.0.3                ggplot2_3.3.2              
[11] tidyverse_1.3.0             proDA_1.1.2                
[13] cowplot_1.0.0               DESeq2_1.26.0              
[15] SummarizedExperiment_1.16.1 DelayedArray_0.12.3        
[17] BiocParallel_1.20.1         matrixStats_0.56.0         
[19] Biobase_2.46.0              GenomicRanges_1.38.0       
[21] GenomeInfoDb_1.22.1         IRanges_2.20.2             
[23] S4Vectors_0.24.4            BiocGenerics_0.32.0        
[25] limma_3.42.2               

loaded via a namespace (and not attached):
  [1] readxl_1.3.1           backports_1.1.8        Hmisc_4.4-0           
  [4] fastmatch_1.1-0        workflowr_1.6.2        igraph_1.2.5          
  [7] shinydashboard_0.7.1   splines_3.6.0          digest_0.6.25         
 [10] htmltools_0.5.0        magick_2.4.0           gdata_2.18.0          
 [13] fansi_0.4.1            magrittr_1.5           checkmate_2.0.0       
 [16] memoise_1.1.0          cluster_2.1.0          annotate_1.64.0       
 [19] modelr_0.1.8           jpeg_0.1-8.1           colorspace_1.4-1      
 [22] blob_1.2.1             rvest_0.3.5            haven_2.3.1           
 [25] xfun_0.15              crayon_1.3.4           RCurl_1.98-1.2        
 [28] jsonlite_1.7.0         genefilter_1.68.0      survival_3.2-3        
 [31] glue_1.4.1             gtable_0.3.0           zlibbioc_1.32.0       
 [34] XVector_0.26.0         scales_1.1.1           pheatmap_1.0.12       
 [37] DBI_1.1.0              relations_0.6-9        Rcpp_1.0.5            
 [40] xtable_1.8-4           htmlTable_2.0.1        foreign_0.8-71        
 [43] bit_4.0.4              Formula_1.2-3          DT_0.14               
 [46] htmlwidgets_1.5.1      httr_1.4.1             fgsea_1.12.0          
 [49] gplots_3.0.4           RColorBrewer_1.1-2     acepack_1.4.1         
 [52] ellipsis_0.3.1         pkgconfig_2.0.3        XML_3.98-1.20         
 [55] farver_2.0.3           nnet_7.3-14            dbplyr_1.4.4          
 [58] locfit_1.5-9.4         utf8_1.1.4             tidyselect_1.1.0      
 [61] labeling_0.3           rlang_0.4.7            later_1.1.0.1         
 [64] AnnotationDbi_1.48.0   visNetwork_2.0.9       munsell_0.5.0         
 [67] cellranger_1.1.0       tools_3.6.0            cli_2.0.2             
 [70] generics_0.0.2         RSQLite_2.2.0          broom_0.7.0           
 [73] evaluate_0.14          fastmap_1.0.1          yaml_2.2.1            
 [76] knitr_1.29             bit64_0.9-7            fs_1.4.2              
 [79] caTools_1.18.0         nlme_3.1-148           mime_0.9              
 [82] slam_0.1-47            xml2_1.3.2             compiler_3.6.0        
 [85] rstudioapi_0.11        png_0.1-7              marray_1.64.0         
 [88] reprex_0.3.0           geneplotter_1.64.0     stringi_1.4.6         
 [91] lattice_0.20-41        Matrix_1.2-18          shinyjs_1.1           
 [94] vctrs_0.3.1            pillar_1.4.6           lifecycle_0.2.0       
 [97] data.table_1.12.8      bitops_1.0-6           httpuv_1.5.4          
[100] R6_2.4.1               latticeExtra_0.6-29    promises_1.1.1        
[103] KernSmooth_2.23-17     gridExtra_2.3          codetools_0.2-16      
[106] gtools_3.8.2           assertthat_0.2.1       rprojroot_1.3-2       
[109] withr_2.2.0            GenomeInfoDbData_1.2.2 mgcv_1.8-31           
[112] hms_0.5.3              grid_3.6.0             rpart_4.1-15          
[115] rmarkdown_2.3          git2r_0.27.1           sets_1.0-18           
[118] shiny_1.5.0            lubridate_1.7.9        base64enc_0.1-3