### 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