grToElementString: Extract a genomic element string from a GRange object

Description Usage Arguments Details Value Examples

View source: R/grUtils.R

Description

Returns a string representation of the ranges in a GRange object if they are on only one chromosome of one strand. The two ends of each range are separated by a '-' by default but any string can be specified for this 'from' delimiter. Additionally, each range element is separated by a ',' by default, but any string can be specified for this 'between' delimiter. If there are no ranges in the GRange object, then an empty string is returned.

Usage

1
grToElementString(gr, fromDelim = "-", betweenDelim = ",")

Arguments

gr

The GRange object to extract an element string from.

fromDelim

The string to print between the start and end position of a range. Defaults to '-'

betweenDelim

The string to print between the range elements. Defaults to ','

Details

It is an error to try and generate an element string from a GRanges object representing ranges on more than one chromosome or on more than one strand.

This is the reciprocal of grFromElementString.

Value

A string equivalent of the ranges in the GRange object provided.

Examples

1
2
3
4
5
6
7
8
gr <- grNew( start=c(1,200,400), end=c(100,300,500), chr='chr1', strand='-')
grToElementString(gr)
#=> [1] "1-100,200-300,400-500"
grToElementString(gr, fromDelim=' to ', betweenDelim='; ')
#=> [1] "1 to 100; 200 to 300; 400 to 500"
gr1 <- grFromElementString(grToElementString(gr), chr='ANY')
grToElementString(gr1) == grToElementString(gr)
#=> [1] TRUE

jefferys/FusionExpressionPlot documentation built on May 19, 2019, 3:59 a.m.