Last data update: 2014.03.03

R: Get CpG density for genomic regions
cpgdensityR Documentation

Get CpG density for genomic regions

Description

Calculate the CpG density for a set of windows

Usage

cpgdensity(subject, chr, pos, windowSize = 500, sequence = "CG")

Arguments

subject

BSGenome object (e.g. Hsapiens)

chr

character vector

pos

numeric vector

windowSize

number value

sequence

character string

Details

Calculate the CpG density for a set of regions. chr and pos specify the region mid-points and windowSize specifies the size of the window to be centered on these mid-points. i.e. The window will stretch from pos-windowSize/2 to pos+windowSize/2.

Value

a numeric vector

Author(s)

Martin Aryee <aryee@jhu.edu>

Examples

	if (require(BSgenome.Hsapiens.UCSC.hg18)){
		chr <- c("chr1", "chr1", "chr2")
		pos <- c(100000, 100500, 100000)
		cpgd <- cpgdensity(Hsapiens, chr=chr, pos=pos, windowSize = 500)
		cpgd
	}

Results


R version 3.3.1 (2016-06-21) -- "Bug in Your Hair"
Copyright (C) 2016 The R Foundation for Statistical Computing
Platform: x86_64-pc-linux-gnu (64-bit)

R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.

R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.

Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.

> library(charm)
Loading required package: Biobase
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, xtabs

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

    Filter, Find, Map, Position, Reduce, anyDuplicated, append,
    as.data.frame, cbind, 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, rownames, sapply, setdiff, sort, table, tapply, union,
    unique, unsplit

Welcome to Bioconductor

    Vignettes contain introductory material; view with
    'browseVignettes()'. To cite Bioconductor, see
    'citation("Biobase")', and for packages 'citation("pkgname")'.

Loading required package: SQN
Loading required package: mclust
Package 'mclust' version 5.2
Type 'citation("mclust")' for citing this R package in publications.
Loading required package: nor1mix
Loading required package: fields
Loading required package: spam
Loading required package: grid
Spam version 1.3-0 (2015-10-24) is loaded.
Type 'help( Spam)' or 'demo( spam)' for a short introduction 
and overview of this package.
Help for individual functions is also obtained by adding the
suffix '.spam' to the function name, e.g. 'help( chol.spam)'.

Attaching package: 'spam'

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

    backsolve, forwardsolve

Loading required package: maps

 # maps v3.1: updated 'world': all lakes moved to separate new #
 # 'lakes' database. Type '?world' or 'news(package="maps")'.  #



Attaching package: 'maps'

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

    map

Loading required package: RColorBrewer
Loading required package: genefilter
Welcome to charm version 2.18.0
> png(filename="/home/ddbj/snapshot/RGM3/R_BC/result/charm/cpgdensity.Rd_%03d_medium.png", width=480, height=480)
> ### Name: cpgdensity
> ### Title: Get CpG density for genomic regions
> ### Aliases: cpgdensity
> 
> ### ** Examples
> 
> 	if (require(BSgenome.Hsapiens.UCSC.hg18)){
+ 		chr <- c("chr1", "chr1", "chr2")
+ 		pos <- c(100000, 100500, 100000)
+ 		cpgd <- cpgdensity(Hsapiens, chr=chr, pos=pos, windowSize = 500)
+ 		cpgd
+ 	}
Loading required package: BSgenome.Hsapiens.UCSC.hg18
Loading required package: BSgenome
Loading required package: S4Vectors
Loading required package: stats4

Attaching package: 'stats4'

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

    mle


Attaching package: 'S4Vectors'

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

    colMeans, colSums, rowMeans, rowSums

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

    colMeans, colSums, expand.grid, rowMeans, rowSums

Loading required package: IRanges
Loading required package: GenomeInfoDb
Loading required package: GenomicRanges
Loading required package: Biostrings
Loading required package: XVector
Loading required package: rtracklayer
[1] 0.000 0.004 0.002
> 
> 
> 
> 
> 
> dev.off()
null device 
          1 
>