Last updated: 2020-05-18
Checks: 7 0
Knit directory: MINTIE-paper-analysis/
This reproducible R Markdown analysis was created with workflowr (version 1.4.0). The Checks tab describes the reproducibility checks that were applied when the results were created. The Past versions tab lists the development history.
Great! Since the R Markdown file has been committed to the Git repository, you know the exact version of the code that produced these results.
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(20200415)
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 version displayed above was the version of the Git repository at the time these results were generated.
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: .Rhistory
Ignored: .Rproj.user/
Ignored: analysis/cache/
Ignored: data/RCH_B-ALL/
Ignored: data/leucegene/salmon_out/
Ignored: data/leucegene/sample_info/KMT2A-PTD_8-2.fa.xls
Ignored: output/Leucegene_gene_counts.tsv
Ignored: packrat/lib-R/
Ignored: packrat/lib-ext/
Ignored: packrat/lib/
Ignored: packrat/src/
Untracked files:
Untracked: .here
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.
These are the previous versions of the R Markdown and HTML files. If you’ve configured a remote Git repository (see ?wflow_git_remote
), click on the hyperlinks in the table below to view them.
File | Version | Author | Date | Message |
---|---|---|---|---|
html | 3aee926 | Marek Cmero | 2020-05-18 | Build site. |
html | bf478ec | Marek Cmero | 2020-05-12 | Build site. |
html | a166ab8 | Marek Cmero | 2020-05-08 | Build site. |
html | a600688 | Marek Cmero | 2020-05-07 | Build site. |
html | 5c045b5 | Marek Cmero | 2020-05-07 | Build site. |
html | 90c7fd9 | Marek Cmero | 2020-05-06 | Build site. |
Rmd | ff4b1dc | Marek Cmero | 2020-05-06 | Leucegene results |
html | 358aa53 | Marek Cmero | 2020-05-04 | Build site. |
Rmd | 453d754 | Marek Cmero | 2020-05-04 | Added controls comparison in normals analysis. Added variant class collation function. Added variant summary for |
html | 4a5d6ae | Marek Cmero | 2020-05-01 | Build site. |
Rmd | 9556ebb | Marek Cmero | 2020-05-01 | Added leucegene normals analysis. Added expressed genes analysis to leucegene gene expression analysis. |
html | 784838b | Marek Cmero | 2020-04-30 | Build site. |
Rmd | c4c3844 | Marek Cmero | 2020-04-30 | Added leucegene gene expression notebook |
# util
library(data.table)
library(dplyr)
library(here)
library(stringr)
# plotting
library(ggplot2)
library(RColorBrewer)
# bioinformatics/stats helpers
library(tximport)
library(limma)
library(edgeR)
library(matrixStats)
options(stringsAsFactors = FALSE)
Here we generate a PCA plot for all the Leucegene samples used in the MINTIE paper KMT2A-PTD and normal sample analyses, and perform a few small expression analyses presented in the paper.
salmon_dir <- here("data/leucegene/salmon_out")
# construct list of quant.sf files
quant_files <- list.files(salmon_dir,
full.names = TRUE,
recursive = TRUE,
pattern = "quant.sf")
# transcript > gene reference file for CHESS
tx2gene <- read.delim(gzfile(here("data/ref/tx2gene.txt.gz")))
# import quant files
txi <- tximport(quant_files,
type = "salmon",
countsFromAbundance = "lengthScaledTPM",
tx2gene = tx2gene,
ignoreTxVersion = FALSE)
# load sample info
celltype <- read.delim(here("data/leucegene/sample_info/celltypes_info.tsv"))
kmt2a_samples <- read.delim(here("data/leucegene/sample_info/KMT2A-PTD_samples.txt"), header = FALSE)$V1
aml_controls <- read.delim(here("data/leucegene/sample_info/selected_13_CBF_AML_controls.txt"), header = FALSE)$V1
nup_samples <- read.delim(here("data/leucegene/sample_info/NUP98-NSD1_samples.txt"), header = FALSE)$V1
# reduced normal control set (used in KMT2A-PTD analysis)
s1 <- celltype$SRX_ID[celltype$cell_type == "Total white blood cells"][1]
s2 <- celltype$SRX_ID[celltype$cell_type == "Monocytes"][1]
s3 <- celltype$SRX_ID[celltype$cell_type == "Granulocytes"][1]
reduced_normal_controls <- c(s1, s2, s3)
MINTIE paper Supplememtary Figure 1. PCA of gene expression derived from Salmon quantification for Leucegene KMT2A-PTD and normals. Normal samples used as controls in the reduced set of controls are circled.
# get counts matrix
counts <- txi$counts
colnames(counts) <- list.files(salmon_dir)
write.table(counts, file = here("output/Leucegene_gene_counts.tsv"), sep = "\t", quote = FALSE, row.names = FALSE)
# variance stabilised, log2 CPM transformation
ve <- voom(counts)$E
# select 500 most variable genes
select <- order(rowVars(ve), decreasing = T)[1:500]
# perform PCA amd select first two components
pr <- prcomp(ve[select,])
pc <- data.frame(pr$rotation[,1:2])
pc$sample <- rownames(pc)
# attach labels
pc <- left_join(pc, celltype, by = c("sample" = "SRX_ID"))
pc$cell_type[pc$sample %in% kmt2a_samples] <- "KMT2A-PTD"
pc$cell_type[pc$sample %in% nup_samples] <- "NUP98-NSD1"
pc$cell_type[pc$sample %in% aml_controls] <- "CBF AML controls"
pc <- pc[!is.na(pc$cell_type),]
# make colour mappings
cols <- brewer.pal(8, "RdBu")
names(cols) <- c("KMT2A-PTD",
"CBF AML controls",
"Granulocytes",
"Monocytes",
"Total white blood cells",
"T-cells",
"B-cells")
pc$cell_type <- factor(pc$cell_type, levels = names(cols))
# plot
ggplot(pc, aes(PC1, PC2, colour = cell_type)) +
geom_point(size = 2.5) +
theme_bw() +
scale_color_manual(values = cols) +
theme(legend.title = element_blank()) +
geom_point(data = pc[pc$sample %in% reduced_normal_controls,],
shape = 1, size = 5, fill = NA, colour = 'darkgrey')
Number of expressed genes found in Leucegene normals and percentage of those genes that are protein coding.
# load CHESS gene reference containing gene types
chess_genes <- read.delim(gzfile(here("data/ref/chess2.2.genes.gz")))
# construct a normal counts matrix of "expressed" counts
# (>1 CPM in at least one sample)
normal_counts <- counts[,colnames(counts) %in% celltype$SRX_ID]
keep <- rowSums(cpm(normal_counts) > 1) >= 1
normal_counts <- normal_counts[keep,]
# get gene info
expressed_genes <- rownames(normal_counts)
gene_types <- table(chess_genes$Gene_Type[chess_genes$Gene_Name %in% expressed_genes])
print(paste(length(expressed_genes), "expressed genes found in Leucegene normals."))
[1] "20218 expressed genes found in Leucegene normals."
print(gene_types)
antisense_RNA lncRNA misc_RNA protein_coding
146 3418 542 14562
print(paste("Proportion of expressed genes that are protein coding:",
gene_types["protein_coding"] / length(expressed_genes)))
[1] "Proportion of expressed genes that are protein coding: 0.720249282817292"
sessionInfo()
R version 3.6.1 (2019-07-05)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: CentOS Linux 7 (Core)
Matrix products: default
BLAS: /config/RStudio/R/3.6.1/lib64/R/lib/libRblas.so
LAPACK: /config/RStudio/R/3.6.1/lib64/R/lib/libRlapack.so
locale:
[1] LC_CTYPE=en_AU.UTF-8 LC_NUMERIC=C
[3] LC_TIME=en_AU.UTF-8 LC_COLLATE=en_AU.UTF-8
[5] LC_MONETARY=en_AU.UTF-8 LC_MESSAGES=en_AU.UTF-8
[7] LC_PAPER=en_AU.UTF-8 LC_NAME=C
[9] LC_ADDRESS=C LC_TELEPHONE=C
[11] LC_MEASUREMENT=en_AU.UTF-8 LC_IDENTIFICATION=C
attached base packages:
[1] stats graphics grDevices utils datasets methods base
other attached packages:
[1] matrixStats_0.55.0 edgeR_3.26.8 limma_3.40.6
[4] tximport_1.12.3 RColorBrewer_1.1-2 ggplot2_3.2.1
[7] stringr_1.4.0 here_0.1 dplyr_0.8.3
[10] data.table_1.12.6
loaded via a namespace (and not attached):
[1] Rcpp_1.0.2 pillar_1.4.2 compiler_3.6.1 git2r_0.26.1
[5] workflowr_1.4.0 tools_3.6.1 digest_0.6.21 lattice_0.20-38
[9] evaluate_0.14 tibble_2.1.3 gtable_0.3.0 pkgconfig_2.0.3
[13] rlang_0.4.0 yaml_2.2.0 xfun_0.10 withr_2.1.2
[17] knitr_1.25 fs_1.3.1 locfit_1.5-9.1 rprojroot_1.3-2
[21] grid_3.6.1 tidyselect_0.2.5 glue_1.3.1 R6_2.4.0
[25] rmarkdown_1.16 purrr_0.3.2 magrittr_1.5 whisker_0.4
[29] backports_1.1.4 scales_1.0.0 htmltools_0.3.6 assertthat_0.2.1
[33] colorspace_1.4-1 labeling_0.3 stringi_1.4.3 lazyeval_0.2.2
[37] munsell_0.5.0 crayon_1.3.4