Last data update: 2014.03.03

R: Logical filters of helix by type
Helix Type FiltersR Documentation

Logical filters of helix by type

Description

Given a helix data frame, checks if helices are conflicting, duplicating, or overlapping, and returns an array of numeric values, where 0 is FALSE and 1 is TRUE. Values in between 0 and 1 occur when a single helix has multiple basepairs with different values, the number observed in this case is the mean of the basepair values within the helix. See details for exact definition of the three types of events.

Usage

    isConflictingHelix(helix)
    isDuplicatingHelix(helix)
    isOverlappingHelix(helix, query)

Arguments

helix

A helix data frame

query

For isOverlappingHelix, a helix data structure against which helix will be checked for overlap against.

Details

Helices of length greater than 1 are internally expanded into basepairs of length 1, after which the following conditions are evaluated:

A conflicting basepair is one where at least one of its two positions is used by either end of another basepair.

A duplicating basepair is one where both of its positions are used by both ends of another basepair.

An overlapping basepair is one in helix where both of its positions are used by both ends of another basepair in the query structure.

In the case of conflicting and duplicating basepairs, for a set of basepairs that satisfies this condition, the basepair situation highest on the data frame will be exempt from the condition. i.e. Say 5 basepairs are all duplicates of each other, the top 1 will return FALSE, while the bottom 4 will return TRUE. This assumes some significant meaning to the ordering of rows prior to using this function. This is to be used with which to filter out basepairs that satisfy these conditions, leaving a set of basepairs free of these events.

If the original input had helices greater than length 1, then after applying all of the above, TRUE is treated as 1, FALSE as 0, and the average of values from each basepair is taken as the value for the helix in question.

Value

Returns an array of numerics corresponding to each row of helix, giving the average conditional status of the helix, where 0 signifying all basepairs are FALSE, and 1 where all basepairs are TRUE.

Author(s)

Daniel Lai

Examples

    data(helix)

    conflicting <- isConflictingHelix(helix)
    duplicating <- isDuplicatingHelix(helix)

    # Nonsensical covariation plot
    plotCovariance(fasta, helix)

    # Plot nonconflicting helices
    plotCovariance(fasta, helix[(!conflicting & !duplicating), ])

    # Similar result
    plotCovariance(fasta, helix, conflict.col = "lightgrey")

Results


R version 3.3.1 (2016-06-21) -- "Bug in Your Hair"
Copyright (C) 2016 The R Foundation for Statistical Computing
Platform: x86_64-pc-linux-gnu (64-bit)

R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.

R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.

Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.

> library(R4RNA)
Loading required package: Biostrings
Loading required package: BiocGenerics
Loading required package: parallel

Attaching package: 'BiocGenerics'

The following objects are masked from 'package:parallel':

    clusterApply, clusterApplyLB, clusterCall, clusterEvalQ,
    clusterExport, clusterMap, parApply, parCapply, parLapply,
    parLapplyLB, parRapply, parSapply, parSapplyLB

The following objects are masked from 'package:stats':

    IQR, mad, xtabs

The following objects are masked from 'package:base':

    Filter, Find, Map, Position, Reduce, anyDuplicated, append,
    as.data.frame, cbind, colnames, do.call, duplicated, eval, evalq,
    get, grep, grepl, intersect, is.unsorted, lapply, lengths, mapply,
    match, mget, order, paste, pmax, pmax.int, pmin, pmin.int, rank,
    rbind, rownames, sapply, setdiff, sort, table, tapply, union,
    unique, unsplit

Loading required package: S4Vectors
Loading required package: stats4

Attaching package: 'S4Vectors'

The following objects are masked from 'package:base':

    colMeans, colSums, expand.grid, rowMeans, rowSums

Loading required package: IRanges
Loading required package: XVector
> png(filename="/home/ddbj/snapshot/RGM3/R_BC/result/R4RNA/logicalHelix.Rd_%03d_medium.png", width=480, height=480)
> ### Name: Helix Type Filters
> ### Title: Logical filters of helix by type
> ### Aliases: isConflictingHelix isDuplicatingHelix isOverlappingHelix
> ### Keywords: logic
> 
> ### ** Examples
> 
>     data(helix)
> 
>     conflicting <- isConflictingHelix(helix)
>     duplicating <- isDuplicatingHelix(helix)
> 
>     # Nonsensical covariation plot
>     plotCovariance(fasta, helix)
> 
>     # Plot nonconflicting helices
>     plotCovariance(fasta, helix[(!conflicting & !duplicating), ])
> 
>     # Similar result
>     plotCovariance(fasta, helix, conflict.col = "lightgrey")
> 
> 
> 
> 
> 
> dev.off()
null device 
          1 
>