expandCollapseHelix: Expand or collapse helices to and from basepairs

Description Usage Arguments Details Value Author(s) Examples

Description

Given a helix data frame, expands a helix of arbitrary length into helices of length 1 (i.e. basepairs). Also does the reverse operation of clustering consecutive basepairs (or helices), and merging/collapsing them into a single helix.

Usage

1
2

Arguments

helix

A helix data frame.

number

Indicates presence of a column in the helix data frame titled exactly 'number', which will be used to unique identify basepairs belonging to the same helix. Only basepairs from the same helix as identified by the number will be collapsed together.

Details

During the expansion, basepairs expanded from a single helix will all be assigned the value of the originating helix (the same goes for all other columns besides i, j, and length). During collapsing, only helices/basepairs of equal value will be grouped together. The ordering of collapsed helices returned will be sorted by value (increasing order). For any other columns besides i, j, length and value, values will be obtained from the corresponding columns of the outer most basepair.

Value

Returns a helix data frame.

Author(s)

Daniel Lai

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
    # Create helix data frame
    helix <- data.frame(2, 8, 3, 0.5)
    helix[2, ] <- c(5, 15, 4, -0.5)
    helix <- as.helix(helix)
    helix$colour <- c("red", "blue")

    # Before expansion
    print(helix)
    # After expansion
    print(expanded <- expandHelix(helix))
    # Collapse back (sorted by value)
    print(collapseHelix(expanded))

R4RNA documentation built on Nov. 8, 2020, 5:15 p.m.