Learn R Programming

SomaticSignatures (version 2.8.4)

GRanges-converters: GRanges converter functions

Description

A set of utilities functions to convert and extract data in 'GRanges' objects.

Usage

ncbi(x) ucsc(x) seqchar(x)

Arguments

x
A 'GRanges' object or one inheriting from the 'GRanges' class [required].

Value

For 'ncbi', 'ucsc': An object of the same class as the input.For 'seqchar': A character vector with 'seqnames'.

Details

  • grangesExtracts only the 'GRanges' information by dropping the metadata columns of the object. The 'seqinfo' slot is kept.
  • ncbi, ucscShorthand for converting the seqnames notation to 'UCSC' (e.g. 'chr1', 'chrM') or 'NCBI' (e.g. '1', 'MT'') notation, respectively. This also sets the 'genome' slot in the 'seqinfo' field to 'NA'.
  • seqcharExtracts the 'seqnames' as a character vector.

See Also

seqnames, mcols seqlevelsStyle

Examples

Run this code

  mutect_path = system.file("examples", "mutect.tsv", package = "SomaticSignatures")
  vr1 = readMutect(mutect_path, strip = TRUE)
  
  ## extract the GRanges
  gr = granges(vr1)
  
  ## convert back and forth
  gr_ncbi = ncbi(gr)
  gr_ucsc = ucsc(gr_ncbi)
  
  identical(gr, gr_ucsc)
  
  ## extract the seqnames as a character vector
  seq_chars = seqchar(gr)
  

Run the code above in your browser using DataLab