Learn R Programming

genomeIntervals (version 1.28.0)

GenomeIntervals: Constructor function for genomeIntervals objects

Description

A user-friendly constructor function for creating both Genome_intervals and Genome_intervals_stranded objects.

Usage

GenomeIntervals(chromosome, start, end, strand = NULL, inter.base = NULL, leftOpen = NULL, rightOpen = NULL, ...)

Arguments

chromosome
character vector of chromosome names of the intervals; will become the seqnames of the resulting object
start
numeric or integer; start (left-most) coordinate of the intervals
end
numeric or integer; end (right-most) coordinate of the intervals
strand
chacter; specifies which strand the intervals are located on; if specified an object of class Genome_intervals_stranded is created; if NULL an object of class Genome_intervals is created
inter.base
logical; if TRUE an interval is located between the specified coordinates, instead of spanning them; useful for restriction-enzym cutting sites, for example.
leftOpen
logical; if TRUE an interval is left-open; if NULL all intervals are assumed to be left-closed.
rightOpen
logical; if TRUE an interval is right-open; if NULL all intervals are assumed to be right-closed.
...
any additional annotation for supplied intervals

Value

An object of class Genome_intervals or Genome_intervals_stranded depending on whether strand has been specified.

Details

The arguments chromosome, start, and end need to be of the same length, with the first element of each vector corresponding to the first interval, the second element to the second interval, and so on.

The same applies to strand, inter.base, leftOpen, rightOpen and any additional vectors in '...', if they are specified.

See Also

Genome_intervals-class, Genome_intervals_stranded-class

Examples

Run this code
  ## constructing a Genome_intervals object
  G <- GenomeIntervals(start=c(1,3,4,5,8,10), end=c(5,5,6,8,9,11),
                       chromosome=rep(c("chr2","chrX","chr1"), each=2),
                       leftOpen=rep(c(FALSE, FALSE, TRUE), 2))
  show(G)

  ## constructing a Genome_intervals_stranded object with
  ##  additional interval annotation
  GS <- GenomeIntervals(start=c(1,3,4,5,8,10), end=c(5,5,6,8,9,11),
                        chromosome=rep(c("chr2","chrX","chr1"), each=2),
                        strand=c("-","-","+","+","+","+"),
                        GC.content=round(runif(6), digits=2))
  show(GS)

Run the code above in your browser using DataLab