Last updated: 2024-10-01

Checks: 7 0

Knit directory: damsel_paper/analysis/

This reproducible R Markdown analysis was created with workflowr (version 1.7.1). 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(20240816) 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 73f7dc1. 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:    data/.DS_Store
    Ignored:    renv/library/
    Ignored:    renv/staging/

Untracked files:
    Untracked:  data/damsel_counts.rds
    Untracked:  data/damsel_counts_a.rds
    Untracked:  data/damsel_counts_b.rds
    Untracked:  data/sd_1_SRR794884-vs-Dam.kde-norm.gatc-FDR0.01.peaks.gff
    Untracked:  data/sd_2_SRR7948877-vs-Dam.kde-norm.gatc-FDR0.01.peaks.gff
    Untracked:  data/txdb_genes.rds
    Untracked:  output/damsel_dm.rds
    Untracked:  output/damsel_genes.rds
    Untracked:  output/damsel_peaks.rds
    Untracked:  output/fp_vissers_peaks.txt
    Untracked:  output/keep
    Untracked:  output/lrt_sd.txt
    Untracked:  output/marshall_peaks.rds
    Untracked:  output/peaks.txt
    Untracked:  output/vissers_dm.rds
    Untracked:  output/vissers_peaks.rds
    Untracked:  output/vissers_peaks.txt
    Untracked:  output/vissers_peaks_mod.rds
    Untracked:  renv/.gitignore

Unstaged changes:
    Modified:   code/run-Damsel.R
    Modified:   code/run-Vissers.R

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/compare-Damsel-Vissers.Rmd) and HTML (docs/compare-Damsel-Vissers.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 73f7dc1 caitlinpage 2024-10-01 wflow_publish(c("analysis/compare_dm.Rmd", "analysis/compare_peaks.Rmd",
Rmd 08944f8 caitlinpage 2024-10-01 initial commit analysis

Introduction

library(Damsel)
library(plyranges)
Loading required package: BiocGenerics

Attaching package: 'BiocGenerics'
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, table,
    tapply, union, unique, unsplit, which.max, which.min
Loading required package: IRanges
Warning: package 'IRanges' was built under R version 4.4.1
Loading required package: S4Vectors
Warning: package 'S4Vectors' was built under R version 4.4.1
Loading required package: stats4

Attaching package: 'S4Vectors'
The following object is masked from 'package:utils':

    findMatches
The following objects are masked from 'package:base':

    expand.grid, I, unname
Loading required package: GenomicRanges
Loading required package: GenomeInfoDb

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

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

    filter
library(dplyr)

Attaching package: 'dplyr'
The following objects are masked from 'package:plyranges':

    between, n, n_distinct
The following objects are masked from 'package:GenomicRanges':

    intersect, setdiff, union
The following object is masked from 'package:GenomeInfoDb':

    intersect
The following objects are masked from 'package:IRanges':

    collapse, desc, intersect, setdiff, slice, union
The following objects are masked from 'package:S4Vectors':

    first, intersect, rename, setdiff, setequal, union
The following objects are masked from 'package:BiocGenerics':

    combine, intersect, setdiff, union
The following objects are masked from 'package:stats':

    filter, lag
The following objects are masked from 'package:base':

    intersect, setdiff, setequal, union
library(tidyr)

Attaching package: 'tidyr'
The following object is masked from 'package:S4Vectors':

    expand
library(ggplot2)
library(ggVennDiagram)

Attaching package: 'ggVennDiagram'
The following object is masked from 'package:tidyr':

    unite
library(BSgenome.Dmelanogaster.UCSC.dm6)
Loading required package: BSgenome
Loading required package: Biostrings
Loading required package: XVector

Attaching package: 'Biostrings'
The following object is masked from 'package:base':

    strsplit
Loading required package: BiocIO
Loading required package: rtracklayer

Attaching package: 'rtracklayer'
The following object is masked from 'package:BiocIO':

    FileForFormat
library(TxDb.Dmelanogaster.UCSC.dm6.ensGene)
Loading required package: GenomicFeatures
Loading required package: AnnotationDbi
Loading required package: Biobase
Welcome to Bioconductor

    Vignettes contain introductory material; view with
    'browseVignettes()'. To cite Bioconductor, see
    'citation("Biobase")', and for packages 'citation("pkgname")'.

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

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

    select
library(org.Dm.eg.db)
library(ggVennDiagram)
gatc_regions <- getGatcRegions(BSgenome.Dmelanogaster.UCSC.dm6::BSgenome.Dmelanogaster.UCSC.dm6)$regions %>% data.frame()
Warning in .local(x, row.names, optional, ...): 'optional' argument was ignored
Warning in .local(x, row.names, optional, ...): 'optional' argument was ignored
Warning in .local(x, row.names, optional, ...): 'optional' argument was ignored
Warning in .local(x, row.names, optional, ...): 'optional' argument was ignored
Warning in .local(x, row.names, optional, ...): 'optional' argument was ignored
Warning in .local(x, row.names, optional, ...): 'optional' argument was ignored
Warning in .local(x, row.names, optional, ...): 'optional' argument was ignored
Warning in GenomeInfoDb::renameSeqlevels(x = df_, value = newStyle): invalid
seqlevels 'chrM' ignored

Compare DM results

damsel_dm <- readRDS("../output/damsel_dm.rds")
vissers_dm <- readRDS("../output/vissers_dm.rds")
head(vissers_dm)
Loading required package: limma
Warning: package 'limma' was built under R version 4.4.1

Attaching package: 'limma'
The following object is masked from 'package:BiocGenerics':

    plotMA
               logFC      logCPM        LR     PValue groupSd
chr2L-231  0.8135627  0.15655127 0.4788446 0.48894612       0
chr2L-372  0.7964397  0.20584811 0.5453325 0.46023115       0
chr2L-5154 1.5970202 -0.66316083 4.2724166 0.03873580       0
chr2L-5303 1.4069922  2.10057246 5.5817359 0.01814872       0
chr2L-6025 1.0885501  2.70375018 3.3924308 0.06549632       0
chr2L-6881 0.7484152  0.05202975 0.7966800 0.37208787       0
dm_compare <- damsel_dm %>%
  mutate(vissers_logFC = vissers_dm[match(damsel_dm$Position, row.names(vissers_dm)), "logFC"]) %>%
  mutate(vissers_PValue = vissers_dm[match(.$Position, row.names(vissers_dm)), "PValue"]) %>%
  mutate(vissers_dm = vissers_dm[match(damsel_dm$Position, row.names(vissers_dm)), "significant"],
         vissers_logFC = ifelse(is.na(vissers_logFC), 0, vissers_logFC),
         vissers_PValue = ifelse(is.na(vissers_PValue), 1, vissers_PValue))

compare P Values

dm_compare %>%
  ggplot(aes(x = vissers_PValue, y = PValue)) +
  geom_point(alpha = 0.1) +
  geom_vline(xintercept = 0.05, colour = "red", linetype = "dashed") +
  geom_hline(yintercept = 0.05, colour = "red", linetype = "dashed") +
  geom_smooth()
`geom_smooth()` using method = 'gam' and formula = 'y ~ s(x, bs = "cs")'

cor.test(dm_compare$vissers_PValue, dm_compare$PValue)

    Pearson's product-moment correlation

data:  dm_compare$vissers_PValue and dm_compare$PValue
t = 2295, df = 383652, p-value < 2.2e-16
alternative hypothesis: true correlation is not equal to 0
95 percent confidence interval:
 0.9652407 0.9656704
sample estimates:
      cor 
0.9654562 

Compare peaks

damsel_peaks <- readRDS("../output/damsel_peaks.rds")
vissers_peaks <- readRDS("../output/vissers_peaks.rds")
vissers_peaks_mod <- readRDS("../output/vissers_peaks_mod.rds")
  • Visser’s peaks had to be modified in order to be usable (missing chromosome name)
  • They also do not contain a p value - making it difficult to rank peaks and identify the most significant
vissers_peaks_mod$peak_num <- 1:nrow(vissers_peaks_mod)
vissers_peaks_mod$Position <- paste0(vissers_peaks_mod$seqnames, "-", vissers_peaks_mod$start)
peak_all <- union_ranges(as_granges(damsel_peaks), as_granges(vissers_peaks_mod)) %>% 
  data.frame() %>% mutate(peak_num = 1:n())
peak_compare_damsel <- find_overlaps(as_granges(peak_all), as_granges(damsel_peaks)) %>% data.frame()
peak_compare_vissers <- find_overlaps(as_granges(peak_all), as_granges(vissers_peaks_mod)) %>% data.frame()
venn_data <- list(Damsel = peak_compare_damsel$peak_num, Vissers = peak_compare_vissers$peak_num.x)
ggVennDiagram(venn_data)


sessionInfo()
R Under development (unstable) (2024-01-17 r85813)
Platform: x86_64-apple-darwin20
Running under: macOS Sonoma 14.1.1

Matrix products: default
BLAS:   /Library/Frameworks/R.framework/Versions/4.4-x86_64/Resources/lib/libRblas.0.dylib 
LAPACK: /Library/Frameworks/R.framework/Versions/4.4-x86_64/Resources/lib/libRlapack.dylib;  LAPACK version 3.12.0

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

time zone: Australia/Melbourne
tzcode source: internal

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

other attached packages:
 [1] limma_3.60.4                              
 [2] org.Dm.eg.db_3.19.1                       
 [3] TxDb.Dmelanogaster.UCSC.dm6.ensGene_3.12.0
 [4] GenomicFeatures_1.56.0                    
 [5] AnnotationDbi_1.66.0                      
 [6] Biobase_2.64.0                            
 [7] BSgenome.Dmelanogaster.UCSC.dm6_1.4.1     
 [8] BSgenome_1.72.0                           
 [9] rtracklayer_1.64.0                        
[10] BiocIO_1.14.0                             
[11] Biostrings_2.72.1                         
[12] XVector_0.44.0                            
[13] ggVennDiagram_1.5.2                       
[14] ggplot2_3.5.1                             
[15] tidyr_1.3.1                               
[16] dplyr_1.1.4                               
[17] plyranges_1.24.0                          
[18] GenomicRanges_1.56.1                      
[19] GenomeInfoDb_1.40.1                       
[20] IRanges_2.38.1                            
[21] S4Vectors_0.42.1                          
[22] BiocGenerics_0.50.0                       
[23] Damsel_1.0.0                              
[24] workflowr_1.7.1                           

loaded via a namespace (and not attached):
 [1] DBI_1.2.3                   bitops_1.0-8               
 [3] rlang_1.1.3                 magrittr_2.0.3.9000        
 [5] git2r_0.33.0                matrixStats_1.3.0          
 [7] compiler_4.4.0              RSQLite_2.3.7              
 [9] mgcv_1.9-1                  getPass_0.2-4              
[11] png_0.1-8                   callr_3.7.6                
[13] vctrs_0.6.5                 stringr_1.5.1.9000         
[15] pkgconfig_2.0.3             crayon_1.5.3               
[17] fastmap_1.2.0               labeling_0.4.3             
[19] utf8_1.2.4                  Rsamtools_2.20.0           
[21] promises_1.3.0              rmarkdown_2.27             
[23] UCSC.utils_1.0.0            ps_1.7.6                   
[25] purrr_1.0.2                 bit_4.0.5                  
[27] xfun_0.44                   zlibbioc_1.50.0            
[29] cachem_1.1.0                jsonlite_1.8.8             
[31] blob_1.2.4                  highr_0.10                 
[33] later_1.3.2                 DelayedArray_0.30.1        
[35] BiocParallel_1.38.0         parallel_4.4.0             
[37] R6_2.5.1                    bslib_0.7.0                
[39] stringi_1.8.4               jquerylib_0.1.4            
[41] Rcpp_1.0.12                 SummarizedExperiment_1.34.0
[43] knitr_1.46                  splines_4.4.0              
[45] httpuv_1.6.15               Matrix_1.7-0               
[47] tidyselect_1.2.1            rstudioapi_0.16.0          
[49] abind_1.4-5                 yaml_2.3.8                 
[51] codetools_0.2-20            curl_5.2.1                 
[53] processx_3.8.4              lattice_0.22-6             
[55] tibble_3.2.1                KEGGREST_1.44.1            
[57] withr_3.0.1                 evaluate_0.23              
[59] pillar_1.9.0                BiocManager_1.30.23        
[61] MatrixGenerics_1.16.0       whisker_0.4.1              
[63] renv_1.0.7                  generics_0.1.3             
[65] rprojroot_2.0.4             RCurl_1.98-1.16            
[67] munsell_0.5.1               scales_1.3.0               
[69] glue_1.7.0                  tools_4.4.0                
[71] GenomicAlignments_1.40.0    fs_1.6.4                   
[73] XML_3.99-0.17               grid_4.4.0                 
[75] colorspace_2.1-1            nlme_3.1-164               
[77] GenomeInfoDbData_1.2.12     restfulr_0.0.15            
[79] cli_3.6.2                   fansi_1.0.6                
[81] S4Arrays_1.4.1              gtable_0.3.5               
[83] sass_0.4.9                  digest_0.6.35              
[85] SparseArray_1.4.8           farver_2.1.2               
[87] rjson_0.2.21                memoise_2.0.1              
[89] htmltools_0.5.8.1           lifecycle_1.0.4            
[91] httr_1.4.7                  statmod_1.5.0              
[93] bit64_4.0.5