Learn R Programming

exomeCopy (version 1.18.0)

getGCcontent: Get the GC content of target ranges from a reference FASTA file

Description

A short function using scanFa from the Rsamtools package on a target GRanges and a reference FASTA file

Usage

getGCcontent(target, reference.file)

Arguments

target
GRanges object
reference.file
the path to the reference FASTA file

Value

Returns a vector of the ratio of G and C basepairs to total basepairs (not counting N's).

Examples

Run this code
  target.file <- system.file("extdata","targets.bed",package="exomeCopy")
  target.df <- read.delim(target.file,header=FALSE,col.names=c("seqname","start","end")) 
  target <- GRanges(seqname=target.df$seqname,IRanges(start=target.df$start+1,end=target.df$end))
  reference.file <- system.file("extdata","reference.fa",package="exomeCopy")
  GCcontent <- getGCcontent(target, reference.file)

Run the code above in your browser using DataLab