[Bioc-sig-seq] findOverlaps with GenomicRanges?

Janet Young jayoung at fhcrc.org
Thu Feb 24 20:23:03 CET 2011


Hi again,


On Feb 24, 2011, at 5:41 AM, Martin Morgan wrote:
> On 02/22/2011 09:04 PM, Janet Young wrote:
>> Hi,
>> 
>> Thanks, Martin - that'll work.
>> 
>> I also just realized that for RangedData, findOverlaps is correctly assuming subject=query when I only specify one set of ranges as input.  But for GenomicRanges, it doesn't have that default set up.  If I specify subject as well:
>> 	findOverlaps(myregions_GR, myregions_GR) 
>> then findOverlaps DOES work for GenomicRanges.
> 
> Hi Janet --
> 
> not sure what you mean. I have
> 
> gr = GRanges(seqnames=c("chr1","chr1","chr2"),
>             ranges=IRanges(start=c(101L,201L,101L),
>                            end=c(250L,301L,201L)))
> identical(findOverlaps(gr, type="any"),
>          findOverlaps(gr, gr, type="any"))
> 
> maybe you were just indicating the workaround findOverlaps(gr, gr)?

Yes, I was - sorry that was unclear.

> Better to expend the keystrokes and type TRUE rather than T
> 
>> T <- FALSE # surprises ahead!
>> TRUE <- FALSE
> Error in TRUE <- FALSE : invalid (do_set) left-hand side to assignment
> 
> 'T' is a plain old variable, TRUE a language reserved words.

not sure where I picked up that bad habit from!  It seems to work most of the time (that's why it's dangerous, I'm sure....)


Janet


> Martin
> 
>> thanks again,
>> 
>> Janet
>> 
>> 
>> 
>> 
>> On Feb 22, 2011, at 8:43 PM, Martin Morgan wrote:
>> 
>>> On 02/22/2011 08:22 PM, Janet Young wrote:
>>>> Hi there,
>>>> 
>>>> Is findOverlaps supposed to work on GRanges objects?  For me it works
>>>> on RangedData but not on GRanges - see below for the error,
>>>> sessionInfo, etc.   It would be useful for me if it could also work
>>>> on GRanges, so if this doesn't count as a bug report can we count it
>>>> as a feature request?
>>> 
>>> Hi Janet -- it's a bug; try
>>> 
>>>> ??findOverlaps
>>>> ?"findOverlaps,GenomicRanges,GenomicRanges-method"
>>>> findOverlaps(myregions_GR, type="any")
>>> An object of class "RangesMatching"
>>> Slot "matchMatrix":
>>>    query subject
>>> [1,]     1       1
>>> [2,]     1       2
>>> [3,]     2       1
>>> [4,]     2       2
>>> [5,]     3       3
>>> 
>>> Slot "DIM":
>>> [1] 3 3
>>> 
>>> or another appropriate argument for 'type'. It seems to be fixed in devel.
>>> 
>>> Martin
>>> 
>>> 
>>>> 
>>>> thanks very much,
>>>> 
>>>> Janet
>>>> 
>>>> 
>>>> -------------------------------------------------------------------
>>>> 
>>>> Dr. Janet Young (Trask lab)
>>>> 
>>>> Fred Hutchinson Cancer Research Center 1100 Fairview Avenue N.,
>>>> C3-168, P.O. Box 19024, Seattle, WA 98109-1024, USA.
>>>> 
>>>> tel: (206) 667 1471 fax: (206) 667 6524 email: jayoung  ...at...
>>>> fhcrc.org
>>>> 
>>>> http://www.fhcrc.org/labs/trask/
>>>> 
>>>> -------------------------------------------------------------------
>>>> 
>>>> 
>>>> 
>>>>> library(GenomicRanges)
>>>> Loading required package: IRanges
>>>> 
>>>> Attaching package: 'IRanges'
>>>> 
>>>> The following object(s) are masked from 'package:base':
>>>> 
>>>> cbind, eval, Map, mapply, order, paste, pmax, pmax.int, pmin, 
>>>> pmin.int, rbind, rep.int, table
>>>> 
>>>>> 
>>>>> myregions_GR <-
>>>>> GRanges(seqnames=c("chr1","chr1","chr2"),ranges=IRanges(start=c(101L,201L,101L),end=c(250L,301L,201L))
>>>>> )
>>>>> 
>>>>> findOverlaps(myregions_GR)
>>>> Error in match.arg(type) : 'arg' must be of length 1
>>>>> 
>>>>> 
>>>>> myregions_RD <-
>>>>> RangedData(IRanges(start=c(101L,201L,101L),end=c(250L,301L,201L)),space=c("chr1","chr1","chr2"),strand=c("+","+","+")
>>>>> )
>>>>> 
>>>>> findOverlaps(myregions_RD)
>>>> RangesMatchingList of length 2 names(2): chr1 chr2
>>>>> 
>>>>> sessionInfo()
>>>> R version 2.12.1 (2010-12-16) Platform: x86_64-unknown-linux-gnu
>>>> (64-bit)
>>>> 
>>>> locale: [1] LC_CTYPE=en_US.UTF-8       LC_NUMERIC=C [3]
>>>> LC_TIME=en_US.UTF-8        LC_COLLATE=en_US.UTF-8 [5] LC_MONETARY=C
>>>> LC_MESSAGES=en_US.UTF-8 [7] LC_PAPER=en_US.UTF-8       LC_NAME=C
>>>> [9] LC_ADDRESS=C               LC_TELEPHONE=C [11]
>>>> LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C
>>>> 
>>>> attached base packages: [1] stats     graphics  grDevices utils
>>>> datasets  methods   base
>>>> 
>>>> other attached packages: [1] GenomicRanges_1.2.3 IRanges_1.8.9
>>>> 
>>>> _______________________________________________ Bioc-sig-sequencing
>>>> mailing list Bioc-sig-sequencing at r-project.org 
>>>> https://stat.ethz.ch/mailman/listinfo/bioc-sig-sequencing
>>> 
>>> 
>>> -- 
>>> Computational Biology
>>> Fred Hutchinson Cancer Research Center
>>> 1100 Fairview Ave. N. PO Box 19024 Seattle, WA 98109
>>> 
>>> Location: M1-B861
>>> Telephone: 206 667-2793
>> 
> 
> 
> -- 
> Computational Biology
> Fred Hutchinson Cancer Research Center
> 1100 Fairview Ave. N. PO Box 19024 Seattle, WA 98109
> 
> Location: M1-B861
> Telephone: 206 667-2793



More information about the Bioc-sig-sequencing mailing list