-
Notifications
You must be signed in to change notification settings - Fork 0
/
README.Rmd
119 lines (94 loc) · 5.06 KB
/
README.Rmd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
---
output: github_document
---
<!-- README.md is generated from README.Rmd. Please edit that file -->
```{r, include = FALSE}
knitr::opts_chunk$set(
collapse = TRUE,
comment = "#>",
fig.path = "man/figures/README-",
out.width = "100%"
)
```
# GenomicTuples
<!-- badges: start -->
[![BioC status](http://www.bioconductor.org/shields/build/release/bioc/GenomicTuples.svg)](https://bioconductor.org/checkResults/release/bioc-LATEST/GenomicTuples)
[![R-CMD-check-bioc](https://github.com/PeteHaitch/GenomicTuples/workflows/R-CMD-check-bioc/badge.svg)](https://github.com/PeteHaitch/GenomicTuples/actions)
[![Codecov test coverage](https://codecov.io/gh/PeteHaitch/GenomicTuples/branch/master/graph/badge.svg)](https://codecov.io/gh/PeteHaitch/GenomicTuples?branch=master)
<!-- badges: end -->
**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:
```{r, eval = FALSE}
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](http://www.bioconductor.org/developers/how-to/useDevel/); **GenomicTuples** can then be installed by:
```{r, eval = FALSE}
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:
```{r, eval = TRUE, echo = TRUE, message = FALSE}
# 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:
```{r, eval = FALSE}
# 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](http://bioconductor.org/packages/release/bioc/vignettes/GenomicTuples/inst/doc/GenomicTuplesIntroduction.html) or accessed from R using:
```{r, eval = FALSE}
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](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:
```{r, citation}
citation("GenomicTuples")
packageVersion("GenomicTuples")
```
## License
**GenomicTuples** is licensed under [Artistic 2.0](https://www.r-project.org/Licenses/Artistic-2.0).
## Code of Conduct
Please note that the **GenomicTuples** project is released with a [Contributor Code of Conduct](http://bioconductor.org/about/code-of-conduct/).
By contributing to this project, you agree to abide by its terms.