Last data update: 2014.03.03

R: getNeighborhood
getNeighborhoodR Documentation

getNeighborhood

Description

This functon extract the neighborhood DNA regions of a GRangesList object. The neighborhood DNA regions represent the promoter region (5'end) and complementary DNA region on the 3'end, which we call "Tail" here. The 5'end neighborhood DNA can often be useful as a kind of negative control region that is not associated with a clear biological function.

This function is different from the "promoters" function available from GenomicRanges R package, which is designed to extract only the promoter region (5' side DNA), but not the 3' side DNA region.

Usage

getNeighborhood(comp, side = 5, Width = 1000)

Arguments

comp

a GRangesList object, whose 5' or 3' side DNA neighborhood will be extracted.

side

either 5 or 3. When it is 5, the promoter region of the GRangesList object will be extracted; if it is 3, the region on the 3' side complementary to the promoter region will be extracted.

Width

The width of the neighborhood region will be extracted. default: 1000

Details

All inner list elements of the input GRangesList object must have the same strand

Value

A GRangesList, of the same length as the input, will be returned. You may use unlist to convert it into a GRanges object.

Author(s)

Jia Meng <jia.meng@hotmail.com>

Examples

gr1 <-
  GRanges(seqnames = "chr2", ranges = IRanges(3000, 6000),
          strand = "+", score = 5L, GC = 0.45)
gr2 <-
  GRanges(seqnames = c("chr1", "chr1"),
          ranges = IRanges(c(7000,13000), width = 3),
          strand = c("+"), score = 3:4, GC = c(0.3, 0.5))
grl <- GRangesList("gr1" = gr1, "gr2" = gr2)
promoter <- getNeighborhood(grl,5)
promoter
promoter_GRanges <- unlist(promoter)
promoter_GRanges

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(Guitar)
Loading required package: Rsamtools
Loading required package: GenomeInfoDb
Loading required package: stats4
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

Loading required package: S4Vectors

Attaching package: 'S4Vectors'

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

    colMeans, colSums, expand.grid, rowMeans, rowSums

Loading required package: IRanges
Loading required package: GenomicRanges
Loading required package: Biostrings
Loading required package: XVector
Loading required package: GenomicFeatures
Loading required package: AnnotationDbi
Loading required package: Biobase
Welcome to Bioconductor

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

Loading required package: rtracklayer
Loading required package: GenomicAlignments
Loading required package: SummarizedExperiment
Loading required package: ggplot2
Loading required package: grid
> png(filename="/home/ddbj/snapshot/RGM3/R_BC/result/Guitar/getNeighborhood.Rd_%03d_medium.png", width=480, height=480)
> ### Name: getNeighborhood
> ### Title: getNeighborhood
> ### Aliases: getNeighborhood
> ### Keywords: ~kwd1 ~kwd2
> 
> ### ** Examples
> 
> gr1 <-
+   GRanges(seqnames = "chr2", ranges = IRanges(3000, 6000),
+           strand = "+", score = 5L, GC = 0.45)
> gr2 <-
+   GRanges(seqnames = c("chr1", "chr1"),
+           ranges = IRanges(c(7000,13000), width = 3),
+           strand = c("+"), score = 3:4, GC = c(0.3, 0.5))
> grl <- GRangesList("gr1" = gr1, "gr2" = gr2)
> promoter <- getNeighborhood(grl,5)
> promoter
GRangesList object of length 2:
$gr1 
GRanges object with 1 range and 2 metadata columns:
   seqnames       ranges strand |     xHits transcriptsHits
      <Rle>    <IRanges>  <Rle> | <integer>       <integer>
       chr2 [2001, 3000]      + |         1               1

$gr2 
GRanges object with 1 range and 2 metadata columns:
   seqnames       ranges strand | xHits transcriptsHits
       chr1 [6001, 7000]      + |     2               2

-------
seqinfo: 2 sequences from an unspecified genome; no seqlengths
> promoter_GRanges <- unlist(promoter)
> promoter_GRanges
GRanges object with 2 ranges and 2 metadata columns:
      seqnames       ranges strand |     xHits transcriptsHits
         <Rle>    <IRanges>  <Rle> | <integer>       <integer>
  gr1     chr2 [2001, 3000]      + |         1               1
  gr2     chr1 [6001, 7000]      + |         2               2
  -------
  seqinfo: 2 sequences from an unspecified genome; no seqlengths
> 
> 
> 
> 
> 
> dev.off()
null device 
          1 
>