grToLocationString: Extract a genomic location string from a GRange object

Description Usage Arguments Details Value Examples

Description

Returns a string representation of a GRange object if it contains only ranges on just one chromosome and on just one strand. The string returned is specified using the format characters {{c}} for the chromosme, {{S}} for the strand and {{e}} for the element string (formatted as with grToElementString()). The default format returned is "{{c}}:{{e}}:{{s}}"

Usage

1
grToLocationString(gr, format = "{{c}}:{{e}}:{{s}}", ...)

Arguments

gr

The GRange object to extract a location string from.

format

The string to print, translating {{e}} to an element location string, {{c}} as the chromosme, {{s}} as the strand. Defaults to "{{c}}:{{e}}:{{s}}",

...

Allows passing parameters to the grToElementString used to generate the elements string.

Details

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

This is the reciprocal of /code/linkgrFromLocationString.

Value

A string equivalent to the GRange object provided, formatted as specified.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
gr <- grNew( start=c(1,200,400), end=c(100,300,500), chr='chr1', strand='-')
grToLocationString(gr)
#=> [1] "chr1:1-100,200-300,400-500:-"
grToLocationString(gr, format="{{c}}({{s}}){{e}}")
#=> [1] "chr1(-)1-100,200-300,400-500"
grToLocationString(gr, format="On {{c}}: {{e}}.", fromDelim=' to ', betweenDelim=', ')
#=> [1] "On chr1: 1 to 100, 200 to 300, 400 to 500."
gr1 <- grFromLocationString(grToLocationString(gr))
grToLocationString(gr1) == grToLocationString(gr)
#=> [1] TRUE

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