inst/scripts/generate_make_data_gencode_human.R

library('glue')
library('here')
library('sessioninfo')
params <- expand.grid(genome = c('hg19', 'hg38'), version = as.character(23:32))

code <- apply(params, 1, function(x) {
    genome <- x[1]
    version <- x[2]

    ## Write the script to run
glue::glue(
"

## Build and save the TxDb object
gencode_v{version}_{genome}_txdb <- gencode_txdb('{version}', '{genome}')
saveDb(gencode_v{version}_{genome}_txdb,
    file = file.path(outdir, 'gencode_v{version}_{genome}_txdb.sqlite'))

## Build and save the annotateTranscripts output
gencode_v{version}_{genome}_annotated_genes<- gencode_annotated_genes(
    gencode_v{version}_{genome}_txdb
)
save(gencode_v{version}_{genome}_annotated_genes,
    file = file.path(outdir, 'gencode_v{version}_{genome}_annotated_genes.rda'))

## Build and save the GenomicState
gencode_v{version}_{genome}_GenomicState <- gencode_genomic_state(
    gencode_v{version}_{genome}_txdb
)
save(gencode_v{version}_{genome}_GenomicState,
    file = file.path(outdir, 'gencode_v{version}_{genome}_GenomicState.rda'))

")
})

code <- c("## This file was made by generate_make_data_gencode_human.R
## though the actual files were generated by data-raw/build_gencode_human.R
## and submitted as array jobs at JHPCE. This script will work sequentually
## and will reproduce the same files.


## Build genomic state objects for multiple Gencode versions

library('GenomicState')
library('AnnotationDbi')
library('sessioninfo')

outdir <- 'gencode'
dir.create(outdir, showWarnings = FALSE)

",
    code, "

## Reproducibility information
print('Reproducibility information:')
Sys.time()
proc.time()
options(width = 120)
session_info()
")

cat(code, file = here::here('inst', 'scripts', 'make-data_gencode_human.R'))

## Reproducibility information
print('Reproducibility information:')
Sys.time()
proc.time()
options(width = 120)
session_info()

# ─ Session info ───────────────────────────────────────────────────────────────────────────────────────────────────────
#  setting  value
#  version  R version 3.6.1 (2019-07-05)
#  os       macOS Mojave 10.14.6
#  system   x86_64, darwin15.6.0
#  ui       RStudio
#  language (EN)
#  collate  en_US.UTF-8
#  ctype    en_US.UTF-8
#  tz       America/New_York
#  date     2019-10-04
#
# ─ Packages ───────────────────────────────────────────────────────────────────────────────────────────────────────────
#  package     * version date       lib source
#  assertthat    0.2.1   2019-03-21 [1] CRAN (R 3.6.0)
#  backports     1.1.4   2019-04-10 [1] CRAN (R 3.6.0)
#  callr         3.3.2   2019-09-22 [1] CRAN (R 3.6.1)
#  cli           1.1.0   2019-03-19 [1] CRAN (R 3.6.0)
#  colorout    * 1.2-1   2019-05-07 [1] Github (jalvesaq/colorout@7ea9440)
#  crayon        1.3.4   2017-09-16 [1] CRAN (R 3.6.0)
#  desc          1.2.0   2018-05-01 [1] CRAN (R 3.6.0)
#  devtools    * 2.2.1   2019-09-24 [1] CRAN (R 3.6.1)
#  digest        0.6.21  2019-09-20 [1] CRAN (R 3.6.0)
#  ellipsis      0.3.0   2019-09-20 [1] CRAN (R 3.6.0)
#  fs            1.3.1   2019-05-06 [1] CRAN (R 3.6.0)
#  glue        * 1.3.1   2019-03-12 [1] CRAN (R 3.6.0)
#  here        * 0.1     2017-05-28 [1] CRAN (R 3.6.0)
#  magrittr      1.5     2014-11-22 [1] CRAN (R 3.6.0)
#  memoise       1.1.0   2017-04-21 [1] CRAN (R 3.6.0)
#  packrat       0.5.0   2018-11-14 [1] CRAN (R 3.6.0)
#  pkgbuild      1.0.5   2019-08-26 [1] CRAN (R 3.6.1)
#  pkgload       1.0.2   2018-10-29 [1] CRAN (R 3.6.0)
#  prettyunits   1.0.2   2015-07-13 [1] CRAN (R 3.6.0)
#  processx      3.4.1   2019-07-18 [1] CRAN (R 3.6.0)
#  ps            1.3.0   2018-12-21 [1] CRAN (R 3.6.0)
#  R6            2.4.0   2019-02-14 [1] CRAN (R 3.6.0)
#  Rcpp          1.0.2   2019-07-25 [1] CRAN (R 3.6.0)
#  remotes       2.1.0   2019-06-24 [1] CRAN (R 3.6.0)
#  rlang         0.4.0   2019-06-25 [1] CRAN (R 3.6.0)
#  rprojroot     1.3-2   2018-01-03 [1] CRAN (R 3.6.0)
#  rstudioapi    0.10    2019-03-19 [1] CRAN (R 3.6.0)
#  sessioninfo * 1.1.1   2018-11-05 [1] CRAN (R 3.6.0)
#  testthat    * 2.2.1   2019-07-25 [1] CRAN (R 3.6.0)
#  usethis     * 1.5.1   2019-07-04 [1] CRAN (R 3.6.0)
#  withr         2.1.2   2018-03-15 [1] CRAN (R 3.6.0)
#
# [1] /Library/Frameworks/R.framework/Versions/3.6/Resources/library
LieberInstitute/GenomicState documentation built on May 12, 2023, 5:15 p.m.