addStrandCombination: Add combination of anchor strand orientation.

Description Usage Arguments Value Examples

View source: R/interaction.R

Description

Each anchor region has a strand that is '+' or '-'. Therefore, the each interaction between two regions has one of the following strand combinations: "forward", "reverse", "convergent", or "divergent". Unstranded ranges, indicated by *, are treated as positive strand.

Usage

1
addStrandCombination(gi, colname = "strandOrientation")

Arguments

gi

GInteractions

colname

name of the new column that is created in gi.

Value

The same GInteractions as gi but with an additional column indicating the four possible combinations of strands "forward", "reverse", "convergent", or "divergent".

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
# build example GRanges as anchors
anchorGR <- GRanges(
 rep("chr1", 4),
 IRanges(
   c(1, 5, 20, 14),
   c(4, 8, 23, 17)
 ),
 strand = c("+", "+", "+", "-"),
 score = c(5, 4, 6, 7)
)


# build example GIntreaction object
gi <- GInteractions(
 c(1, 2, 2),
 c(4, 3, 4),
 anchorGR,
 mode = "strict"
)

# add combination of anchor strands as new metadata column
gi <- addStrandCombination(gi)

# build small matrix to check strand combination
cbind(
as.character(strand(anchors(gi, "first"))),
as.character(strand(anchors(gi, "second"))),
mcols(gi)[, "strandOrientation"]
)

sevenC documentation built on Nov. 8, 2020, 5:35 p.m.