Last updated: 2022-11-22
Checks: 7 0
Knit directory: wf-TranscriptDE/analysis/
This reproducible R Markdown analysis was created with workflowr (version 1.7.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(20221115) 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 3e9c510. 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: .Rhistory
Ignored: .Rproj.user/
Ignored: data/annotation/mm39/
Ignored: data/mouse/fastq/
Ignored: output/mouse/salmon/
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 repository in which changes were
made to the R Markdown (analysis/mouse.Rmd) and HTML
(docs/mouse.html) files. If you’ve configured a remote Git
repository (see ?wflow_git_remote), click on the hyperlinks
in the table below to view the files as they were in that past version.
| File | Version | Author | Date | Message |
|---|---|---|---|---|
| Rmd | 3e9c510 | Pedro Baldoni | 2022-11-22 | Adding mouse report |
| html | 5ee1116 | Pedro Baldoni | 2022-11-22 | Updating docs |
knitr::opts_chunk$set(
dev = "png",
dpi = 300,
dev.args = list(type = "cairo-png"),
root.dir = '.'
)
library(edgeR)
Loading required package: limma
library(data.table)
library(ggplot2)
library(readr)
library(Rsubread)
library(rtracklayer)
Loading required package: GenomicRanges
Loading required package: stats4
Loading required package: BiocGenerics
Attaching package: 'BiocGenerics'
The following object is masked from 'package:limma':
plotMA
The following objects are masked from 'package:stats':
IQR, mad, sd, var, xtabs
The following objects are masked from 'package:base':
anyDuplicated, aperm, append, as.data.frame, basename, cbind,
colnames, dirname, do.call, duplicated, eval, evalq, Filter, Find,
get, grep, grepl, intersect, is.unsorted, lapply, Map, mapply,
match, mget, order, paste, pmax, pmax.int, pmin, pmin.int,
Position, rank, rbind, Reduce, rownames, sapply, setdiff, sort,
table, tapply, union, unique, unsplit, which.max, which.min
Loading required package: S4Vectors
Attaching package: 'S4Vectors'
The following objects are masked from 'package:data.table':
first, second
The following objects are masked from 'package:base':
expand.grid, I, unname
Loading required package: IRanges
Attaching package: 'IRanges'
The following object is masked from 'package:data.table':
shift
Loading required package: GenomeInfoDb
library(magrittr)
Attaching package: 'magrittr'
The following object is masked from 'package:GenomicRanges':
subtract
library(ggpubr)
path.data <- '../data/mouse'
path.anno <- '../data/annotation/mm39'
path.quant <- '../output/mouse'
dt.targets <- fread(file.path(path.data,'misc/targets.txt'))
setnames(dt.targets,old = 'Group',new = 'group')
dt.targets[,path := file.path(path.quant,'salmon',gsub('_R1.fastq.gz','',File1))]
dt.fa <- scanFasta(file.path(path.anno,'gencode.vM27.transcripts.fa.gz'))
Warning: 2429 duplicate sequences were found in the input. Please check the summary table.
dt.fa <- as.data.table(dt.fa)
dt.fa$GeneID <- strsplit2(dt.fa$TranscriptID,'\\|')[,2]
dt.fa$TranscriptID <- strsplit2(dt.fa$TranscriptID,'\\|')[,1]
dt.fa.gene <- dt.fa[,.(NTranscriptID = .N),by = 'GeneID']
dt.fa <- merge(dt.fa,dt.fa.gene,by = 'GeneID',all.x = TRUE,sort = FALSE)
gr.gtf <- import(file.path(path.anno,'gencode.vM27.annotation.gtf.gz'))
gr.gtf.gene <- gr.gtf[gr.gtf$type == 'gene']
gr.gtf.transcript <- gr.gtf[gr.gtf$type == 'transcript']
gr.gtf.gene.interest <-
gr.gtf.gene[gr.gtf.gene$gene_type %in% c('protein_coding','lncRNA')]
gr.gtf.transcript.interest <-
gr.gtf.transcript[gr.gtf.transcript$gene_id %in% gr.gtf.gene.interest$gene_id]
catch <- catchSalmon(dt.targets$path,verbose = FALSE)
key.catch.fa <- match(rownames(catch$annotation),dt.fa$TranscriptID)
catch$annotation$GeneID <- dt.fa$GeneID[key.catch.fa]
catch$annotation$NTranscriptID <- dt.fa$NTranscriptID[key.catch.fa]
dte.scaled <- DGEList(counts = catch$counts/catch$annotation$Overdispersion,
genes = catch$annotation,
samples = dt.targets)
colnames(dte.scaled) <- dte.scaled$samples$Sample
design <- model.matrix(~0+group,data = dte.scaled$samples)
con.3groups <- makeContrasts(LPvsB = groupLP - groupBasal,
MLvsB = groupML - groupBasal, levels = design)
con.2groups <- makeContrasts(MLvsLP = groupML - groupLP, levels = design)
keep.scaled <-
filterByExpr(dte.scaled) &
rownames(dte.scaled) %in% gr.gtf.transcript.interest$transcript_id
dte.scaled.filtr <- dte.scaled[keep.scaled, , keep.lib.sizes = FALSE]
dte.scaled.filtr <- calcNormFactors(dte.scaled.filtr)
dte.scaled.filtr <- estimateDisp(dte.scaled.filtr,design)
fit.scaled <- glmQLFit(dte.scaled.filtr,design)
qlf.3groups.scaled <- glmQLFTest(fit.scaled,contrast = con.3groups)
out.3groups.scaled <- topTags(qlf.3groups.scaled,n = Inf)
qlf.2groups.scaled <- glmQLFTest(fit.scaled,contrast = con.2groups)
out.2groups.scaled <- topTags(qlf.2groups.scaled,n = Inf)
dt.mao.plot <- as.data.table(dte.scaled.filtr$genes)
dt.mao.plot[,NTranscriptIDTrunc := ifelse(NTranscriptID<10,NTranscriptID,paste0('>=10'))]
dt.mao.plot$NTranscriptIDTrunc %<>% factor(levels = paste0(c(1:10,'>=10')))
plot.mao.1 <-
ggplot(dt.mao.plot,aes(x = log10(Overdispersion))) +
geom_histogram(fill = 'gray',color = 'black',boundary = 0,binwidth = 0.1) +
theme_bw() +
labs(y = 'Frequency', x = 'Overdispersion (log10 scale)') +
scale_x_continuous(limits = c(0,3)) +
theme(panel.grid = element_blank())
plot.mao.2 <-
ggplot(data = dt.mao.plot,aes(x = NTranscriptIDTrunc,y = log10(Overdispersion))) +
geom_boxplot(fill = 'gray',outlier.alpha = 0.2) +
geom_smooth(aes(group = 1),color = 'red',se = FALSE,span = 0.8,method = 'loess') +
labs(x = 'Number of expressed transcripts per gene', y = 'Overdispersion (log10 scale)') +
scale_y_continuous(limits = c(0,3),breaks = seq(0,3,1)) +
theme_bw() +
theme(panel.grid = element_blank())
plot.mao <- ggarrange(plot.mao.1,plot.mao.2,nrow = 1,ncol = 2,labels = c('a','b'))
`geom_smooth()` using formula = 'y ~ x'
plot.mao

| Version | Author | Date |
|---|---|---|
| 5ee1116 | Pedro Baldoni | 2022-11-22 |
sessionInfo()
R version 4.2.1 (2022-06-23)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: CentOS Linux 7 (Core)
Matrix products: default
BLAS: /stornext/System/data/apps/R/R-4.2.1/lib64/R/lib/libRblas.so
LAPACK: /stornext/System/data/apps/R/R-4.2.1/lib64/R/lib/libRlapack.so
locale:
[1] LC_CTYPE=en_US.UTF-8 LC_NUMERIC=C
[3] LC_TIME=en_US.UTF-8 LC_COLLATE=en_US.UTF-8
[5] LC_MONETARY=en_US.UTF-8 LC_MESSAGES=en_US.UTF-8
[7] LC_PAPER=en_US.UTF-8 LC_NAME=C
[9] LC_ADDRESS=C LC_TELEPHONE=C
[11] LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C
attached base packages:
[1] stats4 stats graphics grDevices utils datasets methods
[8] base
other attached packages:
[1] ggpubr_0.5.0 magrittr_2.0.3 rtracklayer_1.58.0
[4] GenomicRanges_1.50.1 GenomeInfoDb_1.34.3 IRanges_2.32.0
[7] S4Vectors_0.36.0 BiocGenerics_0.44.0 Rsubread_2.12.0
[10] readr_2.1.3 ggplot2_3.4.0 data.table_1.14.6
[13] edgeR_3.40.0 limma_3.54.0 workflowr_1.7.0
loaded via a namespace (and not attached):
[1] nlme_3.1-160 bitops_1.0-7
[3] matrixStats_0.63.0 fs_1.5.2
[5] bit64_4.0.5 httr_1.4.4
[7] rprojroot_2.0.3 backports_1.4.1
[9] tools_4.2.1 bslib_0.4.1
[11] utf8_1.2.2 R6_2.5.1
[13] mgcv_1.8-41 DBI_1.1.3
[15] colorspace_2.0-3 withr_2.5.0
[17] tidyselect_1.2.0 processx_3.8.0
[19] bit_4.0.5 compiler_4.2.1
[21] git2r_0.30.1 cli_3.4.1
[23] Biobase_2.58.0 DelayedArray_0.24.0
[25] labeling_0.4.2 sass_0.4.3
[27] scales_1.2.1 callr_3.7.3
[29] stringr_1.4.1 digest_0.6.30
[31] Rsamtools_2.14.0 rmarkdown_2.18
[33] XVector_0.38.0 pkgconfig_2.0.3
[35] htmltools_0.5.3 MatrixGenerics_1.10.0
[37] highr_0.9 fastmap_1.1.0
[39] rlang_1.0.6 rstudioapi_0.14
[41] farver_2.1.1 jquerylib_0.1.4
[43] BiocIO_1.8.0 generics_0.1.3
[45] jsonlite_1.8.3 vroom_1.6.0
[47] BiocParallel_1.32.1 car_3.1-1
[49] dplyr_1.0.10 RCurl_1.98-1.9
[51] GenomeInfoDbData_1.2.9 Matrix_1.5-3
[53] Rcpp_1.0.9 munsell_0.5.0
[55] fansi_1.0.3 abind_1.4-5
[57] lifecycle_1.0.3 stringi_1.7.8
[59] whisker_0.4 yaml_2.3.6
[61] carData_3.0-5 SummarizedExperiment_1.28.0
[63] zlibbioc_1.44.0 grid_4.2.1
[65] parallel_4.2.1 promises_1.2.0.1
[67] crayon_1.5.2 lattice_0.20-45
[69] cowplot_1.1.1 splines_4.2.1
[71] Biostrings_2.66.0 hms_1.1.2
[73] locfit_1.5-9.6 knitr_1.41
[75] ps_1.7.2 pillar_1.8.1
[77] rjson_0.2.21 ggsignif_0.6.4
[79] codetools_0.2-18 XML_3.99-0.12
[81] glue_1.6.2 evaluate_0.18
[83] getPass_0.2-2 vctrs_0.5.1
[85] tzdb_0.3.0 httpuv_1.6.6
[87] tidyr_1.2.1 gtable_0.3.1
[89] purrr_0.3.5 assertthat_0.2.1
[91] cachem_1.0.6 xfun_0.35
[93] broom_1.0.1 restfulr_0.0.15
[95] rstatix_0.7.1 later_1.3.0
[97] tibble_3.1.8 GenomicAlignments_1.34.0
[99] ellipsis_0.3.2