getAttr {gff3Plotter}R Documentation

Extracts Attribute Values from a Character Vector of Attributes

Description

Returns a vector of value-s for attribute field in a character vector stored as field = value. No space is allowed between the field name and the equal sign: field= 10; - correct, whereas field = 10; - wrong. Spaces or absence of those are allowed in any other position (see example).

Usage

getAttr(x, field, splitter = ";[[:space:]]?")

Arguments

x A character vector containing attributes in form field = value
field A character vector giving the name of the field to extract
splitter A regular expression for a field separator. Default a semicolon optionally followed by a space.

Value

A character vector of the same length as input containing values for the given field.

Note

The function is adapted from tilingArray::getAttributeField by W.Huber (regular expressions are used insted of fixed = TRUE).

Author(s)

Oleg Sklyar, email:osklyar@ebi.ac.uk

References

W.Huber, tilingArray R package: http://www.bioconductor.org/packages/bioc/stable/src/contrib/html/tilingArray.html.

Examples

   attributes = c("height= 25; width= 30; depth=40;", "depth=18;height= 21;width= 16", "width= 0.45;height=-10;depth= 34")
   widths = getAttr(attributes, "width")
   print(widths)

[Package gff3Plotter version 1.4.0 Index]