Contents

1 Introduction

BSgenome data packages are one of the many types of annotation packages available in Bioconductor. They contain the genomic sequences, which comprise chromosome sequences and other DNA sequences of a particular genome assembly for a given organism. For example BSgenome.Hsapiens.UCSC.hg19 is a BSgenome data package that contains the genomic sequences of the hg19 genome from UCSC. Users can easily and efficiently access the sequences, or portions of the sequences, stored in these packages, via a common API implemented in the BSgenome software package.

Bioconductor currently provides more than 100 BSgenome data packages, for more than 30 organisms. Most of them contain the genomic sequences of UCSC genomes (i.e. genomes supported by the UCSC Genome Browser) or NCBI assemblies. The packages are used in various Bioconductor workflows, as well as in man page examples and vignettes of other Bioconductor packages, typically in conjunction with tools available in the BSgenome and Biostrings software packages. New BSgenome data packages get added on a regular basis, based on user demand.

The BSgenomeForge package provides tools that allow the user to make their own BSgenome data package. The two primary tools in the package are the forgeBSgenomeDataPkgfromNCBI and forgeBSgenomeDataPkgfromUCSC functions. These functions allow the user to forge a BSgenome data package for a given NCBI assembly or UCSC genome.

For other genome assemblies please consult the Advanced BSgenomeForge usage vignettes also provided in this package.

2 Installation

if (!require("BiocManager", quietly=TRUE))
    install.packages("BiocManager")
BiocManager::install("BSgenomeForge")

3 Basic usage

3.1 Using forgeBSgenomeDataPkgFromNCBI()

library(BSgenomeForge)

Example 1: Information about assembly ASM972954v1 can be found at https://www.ncbi.nlm.nih.gov/assembly/GCF_009729545.1/, including the assembly accession, GCA_009729545.1 and organism name, Acidianus infernus. Assembly ASM972954v1 does not contain any circular sequences to be specified:

forgeBSgenomeDataPkgFromNCBI(assembly_accession="GCA_009729545.1",
                             pkg_maintainer="Jane Doe <janedoe@gmail.com>",
                             organism="Acidianus infernus")
## Creating package in ./BSgenome.Ainfernus.NCBI.ASM972954v1

Example 2: Information about assembly ASM836960v1 can be found at https://www.ncbi.nlm.nih.gov/assembly/GCA_008369605.1/, including the assembly accession, GCA_008369605.1 and organism name, Vibrio cholerae. Assembly ASM836960v1 contains three circular sequence, “1”, “2” and “unnamed”. See CP043554.1, CP043556.1, and CP043555.1 in the NCBI Nucleotide database at https://www.ncbi.nlm.nih.gov/nuccore/. They must be specified as shown in the example below:

forgeBSgenomeDataPkgFromNCBI(assembly_accession="GCA_008369605.1",
                             pkg_maintainer="Jane Doe <janedoe@gmail.com>",
                             organism="Vibrio cholerae",
                             circ_seqs=c("1", "2", "unnamed"))
## Creating package in ./BSgenome.Vcholerae.NCBI.ASM836960v1

Check ?forgeBSgenomeDataPkgFromNCBI for more information.

3.2 Using forgeBSgenomeDataPkgFromUCSC()

Example 3: Information about genome wuhCor1 can be found at https://genome.ucsc.edu/cgi-bin/hgGateway. This belongs to the organism Severe acute respiratory syndrome coronavirus 2. Genome wuhCor1 does not contain any circular sequences to be specified:

forgeBSgenomeDataPkgFromUCSC(
    genome="wuhCor1",
    organism="Severe acute respiratory syndrome coronavirus 2",
    pkg_maintainer="Jane Doe <janedoe@gmail.com>"
)
## Creating package in ./BSgenome.Scoronavirus2.UCSC.wuhCor1

Check ?forgeBSgenomeDataPkgFromUCSC for more information.

4 Final steps

forgeBSgenomeDataPkgfromNCBI or forgeBSgenomeDataPkgfromUCSC returns the path to the created package at the end of its execution. This can be used to find the package location, and afterwards carry out the following commands to build the package source tarball via command line (i.e. in a Linux/Unix terminal or Windows PowerShell terminal).

R CMD build <pkgdir>

where <pkgdir> is the path to the source tree of the package. Then check the package with

R CMD check <tarball>

where <tarball> is the path to the tarball produced by R CMD build. Finally install the package with

R CMD INSTALL <tarball>

These operations can also be carried out within R, instead, using the devtools package

devtools::build("./BSgenome.Ainfernus.NCBI.ASM972954v1")
## ── R CMD build ─────────────────────────────────────────────────────────────────
## * checking for file ‘/tmp/RtmpyMRYMj/Rbuild2f3462daad4c3/BSgenomeForge/vignettes/BSgenome.Ainfernus.NCBI.ASM972954v1/DESCRIPTION’ ... OK
## * preparing ‘BSgenome.Ainfernus.NCBI.ASM972954v1’:
## * checking DESCRIPTION meta-information ... OK
## * checking for LF line-endings in source and make files and shell scripts
## * checking for empty or unneeded directories
## * building ‘BSgenome.Ainfernus.NCBI.ASM972954v1_1.0.0.tar.gz’
## [1] "/tmp/RtmpyMRYMj/Rbuild2f3462daad4c3/BSgenomeForge/vignettes/BSgenome.Ainfernus.NCBI.ASM972954v1_1.0.0.tar.gz"
devtools::check_built("BSgenome.Ainfernus.NCBI.ASM972954v1_1.0.0.tar.gz")
devtools::install_local("BSgenome.Ainfernus.NCBI.ASM972954v1_1.0.0.tar.gz")

5 sessionInfo()

sessionInfo()
## R version 4.4.1 (2024-06-14)
## Platform: x86_64-pc-linux-gnu
## Running under: Ubuntu 22.04.5 LTS
## 
## Matrix products: default
## BLAS:   /home/biocbuild/bbs-3.19-bioc/R/lib/libRblas.so 
## LAPACK: /usr/lib/x86_64-linux-gnu/lapack/liblapack.so.3.10.0
## 
## locale:
##  [1] LC_CTYPE=en_US.UTF-8       LC_NUMERIC=C              
##  [3] LC_TIME=en_GB              LC_COLLATE=C              
##  [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       
## 
## time zone: America/New_York
## tzcode source: system (glibc)
## 
## attached base packages:
## [1] stats4    stats     graphics  grDevices utils     datasets  methods  
## [8] base     
## 
## other attached packages:
##  [1] BSgenomeForge_1.4.1  BSgenome_1.72.0      rtracklayer_1.64.0  
##  [4] BiocIO_1.14.0        GenomicRanges_1.56.1 Biostrings_2.72.1   
##  [7] XVector_0.44.0       GenomeInfoDb_1.40.1  IRanges_2.38.1      
## [10] S4Vectors_0.42.1     BiocGenerics_0.50.0  BiocStyle_2.32.1    
## 
## loaded via a namespace (and not attached):
##  [1] SummarizedExperiment_1.34.0 rjson_0.2.23               
##  [3] xfun_0.48                   bslib_0.8.0                
##  [5] remotes_2.5.0               htmlwidgets_1.6.4          
##  [7] devtools_2.4.5              processx_3.8.4             
##  [9] Biobase_2.64.0              lattice_0.22-6             
## [11] callr_3.7.6                 ps_1.8.0                   
## [13] vctrs_0.6.5                 tools_4.4.1                
## [15] bitops_1.0-9                curl_5.2.3                 
## [17] parallel_4.4.1              Matrix_1.7-0               
## [19] desc_1.4.3                  lifecycle_1.0.4            
## [21] GenomeInfoDbData_1.2.12     compiler_4.4.1             
## [23] Rsamtools_2.20.0            codetools_0.2-20           
## [25] httpuv_1.6.15               usethis_3.0.0              
## [27] htmltools_0.5.8.1           sass_0.4.9                 
## [29] RCurl_1.98-1.16             yaml_2.3.10                
## [31] urlchecker_1.0.1            later_1.3.2                
## [33] crayon_1.5.3                jquerylib_0.1.4            
## [35] ellipsis_0.3.2              BiocParallel_1.38.0        
## [37] DelayedArray_0.30.1         cachem_1.1.0               
## [39] sessioninfo_1.2.2           abind_1.4-8                
## [41] mime_0.12                   digest_0.6.37              
## [43] purrr_1.0.2                 restfulr_0.0.15            
## [45] bookdown_0.40               fastmap_1.2.0              
## [47] grid_4.4.1                  cli_3.6.3                  
## [49] SparseArray_1.4.8           magrittr_2.0.3             
## [51] S4Arrays_1.4.1              pkgbuild_1.4.4             
## [53] XML_3.99-0.17               UCSC.utils_1.0.0           
## [55] promises_1.3.0              rmarkdown_2.28             
## [57] httr_1.4.7                  matrixStats_1.4.1          
## [59] memoise_2.0.1               shiny_1.9.1                
## [61] evaluate_1.0.0              knitr_1.48                 
## [63] miniUI_0.1.1.1              profvis_0.4.0              
## [65] rlang_1.1.4                 Rcpp_1.0.13                
## [67] glue_1.8.0                  xtable_1.8-4               
## [69] BiocManager_1.30.25         pkgload_1.4.0              
## [71] rstudioapi_0.16.0           jsonlite_1.8.9             
## [73] R6_2.5.1                    MatrixGenerics_1.16.0      
## [75] GenomicAlignments_1.40.0    fs_1.6.4                   
## [77] zlibbioc_1.50.0