Dear Steve,

I repeated the whole process and this time i get a GRanges object like the
one you shown after checking it as you said.

GRanges with 6 ranges and 0 metadata columns:
      seqnames                 ranges strand
         <Rle>              <IRanges>  <Rle>
  [1]    chr10 [100051744, 100051744]      *
  [2]    chr10 [100051760, 100051760]      *
  [3]    chr10 [100051762, 100051762]      *
  [4]    chr10 [100051780, 100051780]      *
  [5]    chr10 [100051790, 100051790]      *
  [6]    chr10 [100837476, 100837476]      *
  ---
  seqlengths:
           chr1        chr10        chr11 ...         chrY  chrY_random
             NA           NA           NA ...           NA           NA

You gave me the clue to find the error in my command, I was passing "*y*"
instead of "*probes*", eg:

loc <- locateVariants(query=*y*, subject=txdb, region=AllVariants())

instead of:

loc <- locateVariants(query=*probes*, subject=txdb, region=AllVariants())

Thus the error shown was as you said:
"But I'm guessing your `probes` object is actually still a data.frame
(in which case I am a bit surprised that your call to `probes <-
GRanges(y[,1], ...)` didn't result in an error) "

Now after changing the command it works  ;)

Thank you all very much for your support!

PD. I almost forgot it, but I also had to filter ChrM related features
because otherwise I got the following error:

*Error in .findOverlaps.circle(circle.length, seqselect(q_ranges, q_idx),  :
  overlap type "within" is not yet supported for circular sequence chrM
In addition: Warning messages:
1: In .setActiveSubjectSeq(query, subject) :
  circular sequence(s) in query 'chrM' ignored
2: In .setActiveSubjectSeq(query, subject) :
  circular sequence(s) in query 'chrM' ignored
3: In .setActiveSubjectSeq(query, subject) :
  circular sequence(s) in query 'chrM' ignored
4: In .setActiveSubjectSeq(query, subject) :
  circular sequence(s) in query 'chrM' ignored
5: In .setActiveSubjectSeq(query, subject) :
  circular sequence(s) in query 'chrM' ignored*

Hope this may be of interest for someone sometime in the future  ;)




2012/11/13 Steve Lianoglou <mailinglist.honeypot@gmail.com>

> Hi,
>
> On Tue, Nov 13, 2012 at 5:00 AM, José Luis Lavín
> <jluis.lavin@unavarra.es> wrote:
> > Dear all,
> >
> > I tried Valerie's approach but I came across an error I don't really know
> > how to fix (I not familiar with R errors yet, but if I keep performing so
> > badly I guess I will soon come across quite a few of them in a short
> > time...)
> >
> > I will write the code I tested and the error I got:
> >
> > #I had to install some libraries from Bioconductor at the beginning
> >
> > source("http://bioconductor.org/biocLite.R")
> > biocLite('Mus.musculus')
> > biocLite('TxDb.Mmusculus.UCSC.mm9.knownGene')
> > biocLite('VariantAnnotation')
> >
> >
> > library(Mus.musculus)
> > library(TxDb.Mmusculus.UCSC.mm9.knownGene)
> >
> > txdb <- TxDb.Mmusculus.UCSC.mm9.knownGene
> >
> > #gr <- GRanges(seq = "chr17", IRanges(start = 31245606, width = 20))
> >
> > y <- read.delim("/path_to_dir/ids.txt", sep=".", header=FALSE, as.is
> =TRUE)
> >
> >
> > probes<- GRanges(seqnames=y[,1], ranges=IRanges(start=y[,2], width=1))
> >
> > *#Lets see if ids.txt was read correctly into probes*
> >
> > head(probes)
> >
> > 1         chr13  21272514
> > 2         chr13  21272519
> > 3         chr13  21272525
> > 4         chr13  21272533
> > 5         chr13  21295151
> > 6         chr13  21295172
> >
> > *#seems correct to me*
>
> This doesn't seem correct to me, actually. Taking the `head` of a
> proper GRanges object should print some "GRanges" like stuff around
> the data, for instance:
>
> R> probes <- GRanges('chr13', IRanges(c(21272514, 21272519, 21272525),
> width=1))
> R> head(probes)
>
> GRanges with 3 ranges and 0 metadata columns:
>       seqnames               ranges strand
>          <Rle>            <IRanges>  <Rle>
>   [1]    chr13 [21272514, 21272514]      *
>   [2]    chr13 [21272519, 21272519]      *
>   [3]    chr13 [21272525, 21272525]      *
>   ---
>   seqlengths:
>    chr13
>       NA
>
> You see how these two are very different?
>
> You can also check to see what your `probes` object is, like so:
>
> R> class(probes)
> [1] "GRanges"
> attr(,"package")
> [1] "GenomicRanges"
>
> But I'm guessing your `probes` object is actually still a data.frame
> (in which case I am a bit surprised that your call to `probes <-
> GRanges(y[,1], ...)` didn't result in an error) because:
>
> > library(VariantAnnotation)
> >
> > loc <- locateVariants(query=y, subject=txdb, region=AllVariants())
> >
> > *#Error in function (classes, fdef, mtable)  :
> > #unable to find an inherited method for function "locateVariants",
> > #for signature "data.frame", "TranscriptDb", "AllVariants"*
>
> R is telling you that you are trying to call `locateVariants` on a
> query that is a `data.frame` object, and there is no `locateVariants`
> function defined like that.
>
> HTH,
> -steve
>
> --
> Steve Lianoglou
> Graduate Student: Computational Systems Biology
>  | Memorial Sloan-Kettering Cancer Center
>  | Weill Medical College of Cornell University
> Contact Info: http://cbio.mskcc.org/~lianos/contact
>



-- 
-- 
Dr. José Luis Lavín Trueba

Dpto. de Producción Agraria
Grupo de Genética y Microbiología
Universidad Pública de Navarra
31006 Pamplona
Navarra
SPAIN

	[[alternative HTML version deleted]]

