[BioC] find gene symbols immediately flanking before and after a SNP position

Adaikalavan Ramasamy adaikalavan.ramasamy at gmail.com
Wed Feb 13 23:38:13 CET 2013


Dear all,

I have a list of several hundred SNP that I would like to annotate
functionally and am able to do this via websites such as SeattleSeq.
However, for intergenic SNPs it does not give me the neighbouring
genes. Therefore, I have tried to find genes immediately flanking a
SNP (one left and right) in R. I note that this question has been
asked previously. I am trying to follow one of the previous
suggestions (https://stat.ethz.ch/pipermail/bioconductor/2010-December/037185.html).
I been struggling with this for the last two days but I think I am
getting something fundamentally wrong.

I have chosen the following two SNPs (among several thousands). I am
expecting to see the following kind of output:
   rs881375    (chr9:123652898)  is located between PHF19 and TRAF1
   rs12191877 (chr6:31252925)   is located between RPL3P2 and WASF5P


First, I code the query up as a GRange object:

   rsid <- c("rs881375", "rs12191877")
   chr  <- c("chr9",     "chr6")
   pos  <- c(123652898,  31252925)

   library(GenomicFeatures)

   target <- GRanges(
      seqnames = Rle( chr ),
      ranges   = IRanges(pos, end=pos, names=rsid),
      strand   = Rle(strand( rep("*", length(chr)) ))
   )

   # GRanges with 2 ranges and 0 metadata columns:
   #              seqnames                 ranges strand
   #                <Rle>              <IRanges>  <Rle>
   #        rs881375     chr9 [123652898, 123652898]      *
   #    rs12191877     chr6 [ 31252925,  31252925]      *
   # ---
   #     seqlengths:
   #   chr6 chr9
   #       NA   NA

   txdb <- makeTranscriptDbFromUCSC("hg19")   # about 5 min
   tx  <- transcriptsBy(txdb)


But when I try
   precede( target, tx )
   follow( target, tx )

I get the following message:
   Error in function (classes, fdef, mtable)  :
     unable to find an inherited method for function ‘precede’ for
signature ‘"GRanges", "GRangesList"’

Any help would be very much appreciated. I am happy to try other
packages or websites if available. Many thanks.

Regards, Adai



More information about the Bioconductor mailing list