strand-utils: Strand utilities

Description Usage Arguments Details Value Author(s) See Also Examples

Description

A bunch of useful strand and invertStrand methods.

Usage

 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
## S4 method for signature 'missing'
strand(x)
## S4 method for signature 'character'
strand(x)
## S4 method for signature 'factor'
strand(x)
## S4 method for signature 'integer'
strand(x)
## S4 method for signature 'logical'
strand(x)
## S4 method for signature 'Rle'
strand(x)
## S4 method for signature 'RleList'
strand(x)
## S4 method for signature 'DataFrame'
strand(x)
## S4 replacement method for signature 'DataFrame,ANY'
strand(x) <- value

## S4 method for signature 'character'
invertStrand(x)
## S4 method for signature 'factor'
invertStrand(x)
## S4 method for signature 'integer'
invertStrand(x)
## S4 method for signature 'logical'
invertStrand(x)
## S4 method for signature 'Rle'
invertStrand(x)
## S4 method for signature 'RleList'
invertStrand(x)

Arguments

x

The object from which to obtain a strand factor, strand factor Rle, or strand factor RleList object. Can be missing. See Details and Value sections below for more information.

value

Replacement value for the strand.

Details

All the strand and invertStrand methods documented here return either a strand factor, strand factor Rle, or strand factor RleList object. These are factor, factor-Rle, or factor-RleList objects containing the "standard strand levels" (i.e. +, -, and *) and no NAs.

Value

All the strand and invertStrand methods documented here return an object that is parallel to input object x when x is a character, factor, integer, logical, Rle, or RleList object.

For the strand methods:

Each invertStrand method returns the same object as its corresponding strand method but with "+" and "-" switched.

Author(s)

M. Lawrence and H. Pagès

See Also

strand

Examples

 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
strand()

x1 <- c("-", "*", "*", "+", "-", "*")
x2 <- factor(c("-", "-", "+", "-"))
x3 <- c(-1L, NA, NA, 1L, -1L, NA)
x4 <- c(TRUE, NA, NA, FALSE, TRUE, NA)

strand(x1)
invertStrand(x1)
strand(x2)
invertStrand(x2)
strand(x3)
invertStrand(x3)
strand(x4)
invertStrand(x4)

strand(Rle(x1))
invertStrand(Rle(x1))
strand(Rle(x2))
invertStrand(Rle(x2))
strand(Rle(x3))
invertStrand(Rle(x3))
strand(Rle(x4))
invertStrand(Rle(x4))

x5 <- RleList(x1, character(0), as.character(x2))
strand(x5)
invertStrand(x5)

strand(DataFrame(score=2:-3))
strand(DataFrame(score=2:-3, strand=x3))
strand(DataFrame(score=2:-3, strand=Rle(x3)))

## Sanity checks:
target <- strand(x1)
stopifnot(identical(target, strand(x3)))
stopifnot(identical(target, strand(x4)))

stopifnot(identical(Rle(strand(x1)), strand(Rle(x1))))
stopifnot(identical(Rle(strand(x2)), strand(Rle(x2))))
stopifnot(identical(Rle(strand(x3)), strand(Rle(x3))))
stopifnot(identical(Rle(strand(x4)), strand(Rle(x4))))

vjcitn/GenomicRangesGHA documentation built on Jan. 18, 2021, 12:39 a.m.