Learn R Programming

R4RNA (version 1.0.0)

Convert Helix Formats: Convert helix structures to and from other formats

Description

Converts dot bracket vienna format to and from helix format. It should be noted that the allows structures of vienna is a subset of those allowed in the helix format. Thus, conversion from vienna to helix will yield the identical structure, while conversion from helix to vienna may result in the loss of certain basepairs (mainly those that are conflicting). Pseudoknots are supported in both directions of conversion with limitations.

Usage

viennaToHelix(vienna, value = NA, palette = NA) helixToVienna(helix) helixToConnect(helix) helixToBpseq(helix)

Arguments

vienna
A string containing only a vienna dot bracket structure, with balanced brackets. Allowable brackets are (,
value
A numerical value to assign to all helices.
palette
A list of colour names for up to 8 colours that will be used to colour brackets of type (,
helix
A helix data.frame.

Value

viennaToHelix returns a helix data.frame. helixToVienna returns a character string of basepairs in the Vienna helix format. helixToConnect and HelixTpBpseq return data.frames in the connect and bpseq formats, respectively.

Details

viennaToHelix will ignore any non dot-bracket characters prior to parsing, so the resultant length will be shorter than expected if invalid characters are included.

If the colour palette is less than the number of supported brackets, it will simply cycle through the list. To explicitly prevent the colouring/ display of specific bracket type, colour it “NA”.

For helixToVienna, pseudoknotted basepairs will be assigned different bracket types. As there are only 8 supported bracket types, any basepair pseudonotted deeper than 8 levels will be excluded from the output. Additionally, vienna format is unable to respresent conflicting basepairs, so conflicting basepairs will also be excluded. For both types of exclusion, those at the bottom of the helix data.frame will always be excluded in favour of keeping helices higher on the data.frame table.

helixToConnect and helixToBpseq will convert a non-conflicting helix data.frame into connect or bpseq format repsectively, provided the helix structure has a “sequence” attribute containing a single nucleotide sequence of the structure.

Examples

Run this code
    # viennaToHelix demonstrating ALL valid bracket symbols
    dot_bracket <- ".....(<[{.....ABCD.....}]>).....dcba....."
    parsed <- viennaToHelix(dot_bracket, -31.5)
    print(parsed)

    vienna <- helixToVienna(parsed)
    print(vienna)

    # Colouring the brackets by bracket type
    colour <- c("red", "orange", "yellow", "green", "lightblue", "blue", "purple", "black")
    double.rainbow <- viennaToHelix(dot_bracket, 0, colour)
    plotHelix(double.rainbow)

Run the code above in your browser using DataLab