Last updated: 2023-04-05

Checks: 7 0

Knit directory: GlobalStructure/

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(20230404) 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 baf2fd4. 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:    .Rproj.user/
    Ignored:    1_Raw/.DS_Store
    Ignored:    2_Derived/.DS_Store
    Ignored:    3_Results/.DS_Store
    Ignored:    renv/library/
    Ignored:    renv/staging/

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/CopelandDeletionsPca.Rmd) and HTML (docs/CopelandDeletionsPca.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 baf2fd4 Evgenii O. Tretiakov 2023-04-05 Start workflowr project.

1: READ Authors-provided data

Pca = read.table(here(
  raw_dir, 
  "CopelandDeletionsPca/PCA_vectors_c0toc2_01.txt"))

take only the third component (which is called component 2 in the file because they start from zero) = see “1Raw/CopelandDeletionsPca/ReadMe.txt” and derive bin coordinates

Pca = Pca[12807:nrow(Pca),]
for (i in 1:nrow(Pca))
{ # i = 1
  FirstBin = unlist(strsplit(Pca$V1[i],','))[1]
  Pca$FirstBinStart[i] = as.numeric(unlist(strsplit(FirstBin,':'))[1])
  Pca$FirstBinEnd[i] = as.numeric(unlist(strsplit(FirstBin,':'))[2])
  
  SecondBin = unlist(strsplit(Pca$V1[i],','))[2]
  Pca$SecondBinStart[i] = as.numeric(unlist(strsplit(SecondBin,':'))[1])
  Pca$SecondBinEnd[i] = as.numeric(unlist(strsplit(SecondBin,':'))[2])
}

summary(Pca$SecondBinStart - Pca$SecondBinEnd) # 207 is a step!
   Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
 -208.0  -207.0  -207.0  -207.1  -207.0  -207.0 
summary(Pca$FirstBinStart - Pca$FirstBinEnd) # 207 is a step! 
   Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
 -208.0  -207.0  -207.0  -207.1  -207.0  -207.0 
Pca$FirstBinCenter = Pca$FirstBinStart + (Pca$FirstBinEnd - Pca$FirstBinStart)/2
Pca$SecondBinCenter = Pca$SecondBinStart + (Pca$SecondBinEnd - Pca$SecondBinStart)/2

2: plot PC3 and extract major arc. Major arc is from Ol (5721) till the end of mtDNA (16569) and a bit more (till Oh: 110)

par(mfrow=c(2,1))
plot(Pca$FirstBinCenter,Pca$V2, pch = 20, cex = 0.5)
plot(Pca$SecondBinCenter,Pca$V2, pch = 20, cex = 0.5)

Pca = Pca[Pca$FirstBinCenter > 5721 & Pca$SecondBinCenter > 5721,]
plot(Pca$FirstBinCenter,Pca$SecondBinCenter)

par(mfrow=c(2,1))
plot(Pca$FirstBinCenter,Pca$V2, pch = 20, cex = 0.5)
plot(Pca$SecondBinCenter,Pca$V2, pch = 20, cex = 0.5)

3: rounded to 1kb cells

Pca$FirstBinCenterRound  = round(Pca$FirstBinCenter,-3) # till thousands
Pca$SecondBinCenterRound = round(Pca$SecondBinCenter,-3) # till thousands
Agg = aggregate(as.numeric(Pca$V2), by = list(Pca$FirstBinCenterRound,Pca$SecondBinCenterRound), FUN = mean)
names(Agg)=c('Start','End','Value')
head(Agg)
ggp1 <- ggplot(Agg, aes(Start, End)) +                           # Create heatmap with ggplot2
  geom_tile(aes(fill = Value))
ggp1

4: original cells (PAPER)

Agg = aggregate(as.numeric(Pca$V2), by = list(Pca$FirstBinCenter,Pca$SecondBinCenter), FUN = mean)
names(Agg)=c('Start','End','Value')
ContactZone = Agg[Agg$Start >= 6000 & Agg$Start <= 9000 & Agg$End >= 13000 & Agg$Start <= 16000,]$Value

ggp2 <- ggplot(Agg, aes(Start, End)) +                           # Create heatmap with ggplot2
  geom_tile(aes(fill = Value))
ggp2

5: Tests

wilcox.test(ContactZone,Agg$Value)

    Wilcoxon rank sum test with continuity correction

data:  ContactZone and Agg$Value
W = 412736, p-value = 4.48e-13
alternative hypothesis: true location shift is not equal to 0
t.test(ContactZone,Agg$Value) 

    Welch Two Sample t-test

data:  ContactZone and Agg$Value
t = 3.1974, df = 243.17, p-value = 0.001571
alternative hypothesis: true difference in means is not equal to 0
95 percent confidence interval:
 0.002894104 0.012181694
sample estimates:
    mean of x     mean of y 
 7.532794e-03 -5.104566e-06 

sessionInfo()
R version 4.2.2 (2022-10-31)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: Ubuntu 22.04.1 LTS

Matrix products: default
BLAS:   /usr/lib/x86_64-linux-gnu/openblas-pthread/libblas.so.3
LAPACK: /usr/lib/x86_64-linux-gnu/openblas-pthread/libopenblasp-r0.3.20.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] stats     graphics  grDevices datasets  utils     methods   base     

other attached packages:
 [1] reshape_0.8.9   here_1.0.1      lubridate_1.9.2 forcats_1.0.0  
 [5] stringr_1.5.0   dplyr_1.1.1     purrr_1.0.1     readr_2.1.4    
 [9] tidyr_1.3.0     tibble_3.2.1    ggplot2_3.4.2   tidyverse_2.0.0
[13] workflowr_1.7.0

loaded via a namespace (and not attached):
 [1] tidyselect_1.2.0 xfun_0.38        bslib_0.4.2      colorspace_2.1-0
 [5] vctrs_0.6.1      generics_0.1.3   htmltools_0.5.5  yaml_2.3.7      
 [9] utf8_1.2.3       rlang_1.1.0      jquerylib_0.1.4  later_1.3.0     
[13] pillar_1.9.0     glue_1.6.2       withr_2.5.0      plyr_1.8.8      
[17] lifecycle_1.0.3  munsell_0.5.0    gtable_0.3.3     evaluate_0.20   
[21] labeling_0.4.2   knitr_1.42       tzdb_0.3.0       callr_3.7.3     
[25] fastmap_1.1.1    httpuv_1.6.9     ps_1.7.4         fansi_1.0.4     
[29] highr_0.10       Rcpp_1.0.10      renv_0.17.2      promises_1.2.0.1
[33] scales_1.2.1     cachem_1.0.7     jsonlite_1.8.4   farver_2.1.1    
[37] fs_1.6.1         hms_1.1.3        digest_0.6.31    stringi_1.7.12  
[41] processx_3.8.0   getPass_0.2-2    rprojroot_2.0.3  grid_4.2.2      
[45] cli_3.6.1        tools_4.2.2      magrittr_2.0.3   sass_0.4.5      
[49] whisker_0.4.1    pkgconfig_2.0.3  timechange_0.2.0 rmarkdown_2.21  
[53] httr_1.4.5       rstudioapi_0.14  R6_2.5.1         git2r_0.31.0    
[57] compiler_4.2.2