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

Description Usage Arguments Value Examples

View source: R/helper_functions.R

Description

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

Usage

1
  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

1
2
3
4
5
  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)

Example output

Loading required package: IRanges
Loading required package: BiocGenerics
Loading required package: parallel

Attaching package: 'BiocGenerics'

The following objects are masked from 'package:parallel':

    clusterApply, clusterApplyLB, clusterCall, clusterEvalQ,
    clusterExport, clusterMap, parApply, parCapply, parLapply,
    parLapplyLB, parRapply, parSapply, parSapplyLB

The following objects are masked from 'package:stats':

    IQR, mad, sd, var, xtabs

The following objects are masked from 'package:base':

    Filter, Find, Map, Position, Reduce, anyDuplicated, append,
    as.data.frame, cbind, colMeans, colSums, colnames, do.call,
    duplicated, eval, evalq, get, grep, grepl, intersect, is.unsorted,
    lapply, lengths, mapply, match, mget, order, paste, pmax, pmax.int,
    pmin, pmin.int, rank, rbind, rowMeans, rowSums, rownames, sapply,
    setdiff, sort, table, tapply, union, unique, unsplit, which,
    which.max, which.min

Loading required package: S4Vectors
Loading required package: stats4

Attaching package: 'S4Vectors'

The following object is masked from 'package:base':

    expand.grid

Loading required package: GenomicRanges
Loading required package: GenomeInfoDb
Loading required package: Rsamtools
Loading required package: Biostrings
Loading required package: XVector

Attaching package: 'Biostrings'

The following object is masked from 'package:base':

    strsplit

exomeCopy documentation built on Nov. 8, 2020, 7:45 p.m.