Learn R Programming

girafe (version 1.24.0)

which_nearest-methods: Methods for function 'which_nearest' and genome intervals

Description

For each genome interval in one set, finds the nearest interval in a second set of genome intervals.

Arguments

Value

a data.frame with a number of rows equal to the number of intervals in argument from. The elements of the data.frame are:
distance_to_nearest
numeric; distance to nearest interval from object to. Is 0 if the current interval in object from did overlap one or more intervals in object to
which_nearest
list; each list element are the indices or the intervals in object to that have the closest distance to the current interval in object from
which_overlap
list; each list element are the indices or the intervals in object to that do overlap with the current interval in object from

Methods

Currently, the package girafe contains method implementations for the first object (Argument: from) being of any of the classes “AlignedGenomeIntervals”,“Genome_intervals” or “Genome_intervals_stranded”. The second object (Argument: to) has be of class “Genome_intervals_stranded” or “Genome_intervals”.

See Also

which_nearest

Examples

Run this code
  ### process aligned reads
  exDir <- system.file("extdata", package="girafe")
  exA   <- readAligned(dirPath=exDir, type="Bowtie", 
    pattern="aravinSRNA_23_no_adapter_excerpt_mm9_unmasked.bwtmap")
  exAI <- as(exA, "AlignedGenomeIntervals")

  ## load annotated genome features
  load(file.path(exDir, "mgi_gi.RData"))

  ## subset for sake of speed:
  A <- exAI[is.element(seqnames(exAI), c("chrX","chrY"))]
  G <- mgi.gi[is.element(seqnames(mgi.gi), c("chrX","chrY"))]

  ## find nearest annotated feature for each AlignedGenomeInterval
  WN <- which_nearest(A, G)
  dim(WN); tail(WN)

  ## notice the difference to:
  tail(which_nearest(as(A, "Genome_intervals"), G))
  # the last interval in A is located antisense to a gene,
  # but not overlapping anything on the same strand

Run the code above in your browser using DataLab