knitr::opts_chunk$set(
    collapse = TRUE,
    comment = "#>",
    fig.path = "man/figures/README-",
    out.width = "100%"
)

GenomicTuples

BioC status R-CMD-check-bioc Codecov test coverage

GenomicTuples is an R/Bioconductor package that defines general purpose containers for storing and manipulating genomic tuples. A genomic tuple of size m is of the form chromosome:strand:{pos_1, pos_2, ..., pos_m} where pos_1 \< pos_2 \< ... \< pos_m are positions along the chromosome. GenomicTuples aims to provide functionality for tuples of genomic co-ordinates that are analogous to those available for genomic ranges in the r BiocStyle::Biocpkg("GenomicRanges") R/Bioconductor package.

Installation

Most users will want to install GenomicTuples using the current release of Bioconductor using:

if (!requireNamespace("BiocManager", quietly = TRUE)) {
    install.packages("BiocManager")
}
BiocManager::install("GenomicTuples")

The master branch of this repository is the development version of the package. The development version of GenomicTuples can only be installed using the development version of Bioconductor. Please first read these instructions on installing the development version of Bioconductor; GenomicTuples can then be installed by:

if (!requireNamespace("BiocManager", quietly = TRUE)) {
    install.packages("BiocManager")
}
BiocManager::install("GenomicTuples", version = "devel")

Example

Here we use the GenomicTuples package to define two GTuples objects, one containing 5 3-tuples and one containing 3 3-tuples, demonstrate how to identify 'equal' genomic tuples, and how this calculation would be incorrect if we were to mistakenly treat these genomic tuples as genomic ranges:

# Load the package
library(GenomicTuples)
# Create a GTuples object containing 5 3-tuples
x <- GTuples(
    seqnames = c('chr1', 'chr1', 'chr1', 'chr1', 'chr2'), 
    tuples = matrix(
        c(10L, 20L, 30L,
          10L, 20L, 30L,
          10L, 20L, 35L,
          10L, 25L, 30L,
          10L, 20L, 30L),
        ncol = 3,
        byrow = TRUE), 
    strand = c('+', '-', '*', '+', '+'))
x
# Create a new GTuples object containing 3 3-tuples by subsetting x
y <- x[2:4]
y
# Find equal genomic tuples
subsetByOverlaps(x, y, type = "equal")
# Find equal genomic tuples when ignoring strand
subsetByOverlaps(x, y, type = "equal", ignore.strand = TRUE)
# Note that if were to mistakenly treat these as genomic ranges, then the set 
# of 'equal' genomic tuples would be incorrect since treating these tuples as 
# ranges ignores the "internal positions" (pos2).
# The set of overlaps when correctly treated as genomic tuples:
findOverlaps(x, y, type = "equal")
# The set of overlaps when incorrected treated as genomic ranges:
findOverlaps(as(x, "GRanges"), as(y, "GRanges"), type = 'equal')

GenomicTuples includes extensive documentation available through the R help system:

# See all documentation for the package
help(package = "GenomicTuples")
# See documentation for the GTuples class
?GTuples

The package also includes a comprehensive vignette that explains in greater detail the different between a genomic tuple and a genomic range, when genomic tuples may be usefu, and common operations on genomic tuples. The vignette can be viewed at http://bioconductor.org/packages/release/bioc/vignettes/GenomicTuples/inst/doc/GenomicTuplesIntroduction.html or accessed from R using:

vignette("GenomicTuplesIntroduction", package = "GenomicTuples")

Citation

GenomicTuples has been published in The Journal of Open Source Software, http://joss.theoj.org/papers/10.21105/joss.00020.

If you use GenomicTuples, please cite the paper and software version. This can be done as follows:

citation("GenomicTuples")
packageVersion("GenomicTuples")

License

GenomicTuples is licensed under Artistic 2.0.

Code of Conduct

Please note that the GenomicTuples project is released with a Contributor Code of Conduct. By contributing to this project, you agree to abide by its terms.



PeteHaitch/GenomicTuples documentation built on May 3, 2024, 12:27 a.m.