[BioC] findOverlaps() fails with type = 'equal' fails when query is a CollapsedVCF object and subject is a GRanges object

Valerie Obenchain vobencha at fhcrc.org
Sat Aug 24 00:34:42 CEST 2013


Hi Peter,

Thanks for catching this oversight. 'equal' was omitted when 
implementing findOverlaps() methods for SummarizedExperiment. The other 
'overlap' methods call findOverlaps() so they were failing too.

Now fixed in GenomicRanges 1.13.37 (devel) and 1.12.5 (release). Both 
should be available via biocLite() by Saturday noon PST.

Valerie

On 08/21/2013 09:04 PM, Peter Hickey wrote:
> Hi all,
>
> I got a bit lost trying to figure out why the following code does not work. The same code does work when type = 'any', 'start', 'end' or 'within', but not when type = 'equal'. When type = 'equal' it fails with one of the following:
> ## countOverlaps() error message
> Error in queryHits(findOverlaps(query, subject, maxgap = maxgap, minoverlap = minoverlap,  :
>    error in evaluating the argument 'x' in selecting a method for function 'queryHits': Error in match.arg(type) :
>    'arg' should be one of “any”, “start”, “end”, “within”
> ## findOverlaps() and overlapsAny() error message
> Error in match.arg(type) :
>    'arg' should be one of “any”, “start”, “end”, “within”
>
> So 'equal' isn't a valid option for when the subject is a CollapsedVCF object, whereas it is a valid option for when the subject is, say, a GRanges object, correct?
>
> Is it possible to extend findOverlaps(), countOverlaps() and overlapsAny() to allow for type = 'equal' when the subject is a CollapsedVCF object? Ideally this would also work if query and subject were both of CollapsedVCF class because I'm often interested in finding overlaps between two VCF files and I'd like to be able to do that with type = 'equal'.
>
> Thanks
> Peter Hickey
>
> #### DESCRIPTION ####
> # Peter Hickey
> # 22/08/2013
> # findOverlaps(), countOverlaps() and overlapsAny() don't work when `query` is a CollapsedVCF object, `subject` is a GRanges object and `type` is 'equal' yet they do work when `type` is 'any'.
>
> #### Load packages ####
> library(VariantAnnotation)
>
> #### Create VCF ####
> fl <- system.file("extdata", "ex2.vcf", package="VariantAnnotation")
> vcf <- readVcf(fl, "hg19")
>
> #### Create GRanges object ####
> gr <- GRanges(seqnames = '20', ranges = IRanges(start = 14370, end = 14370))
>
> #### countOverlaps ####
> countOverlaps(vcf, gr, type = 'any') # Works
> countOverlaps(vcf, gr, type = 'equal') # Doesn't work
> findOverlaps(vcf, gr, type = 'any') # Works
> findOverlaps(vcf, gr, type = 'equal') # Doesn't work
> overlapsAny(vcf, gr, type = 'any') # Works
> overlapsAny(vcf, gr, type = 'equal') # Doesn't work
>
> #### sessionInfo ####
> sessionInfo()
> R version 3.0.0 (2013-04-03)
> 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=en_US.UTF-8    LC_MESSAGES=en_US.UTF-8
>   [7] LC_PAPER=C                 LC_NAME=C
>   [9] LC_ADDRESS=C               LC_TELEPHONE=C
> [11] LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C
>
> attached base packages:
> [1] parallel  stats     graphics  grDevices utils     datasets  methods
> [8] base
>
> other attached packages:
> [1] VariantAnnotation_1.6.7 Rsamtools_1.12.3        Biostrings_2.28.0
> [4] GenomicRanges_1.12.4    IRanges_1.18.3          BiocGenerics_0.6.0
>
> loaded via a namespace (and not attached):
>   [1] AnnotationDbi_1.22.6   Biobase_2.20.1         biomaRt_2.16.0
>   [4] bitops_1.0-6           BSgenome_1.28.0        DBI_0.2-7
>   [7] GenomicFeatures_1.12.3 RCurl_1.95-4.1         RSQLite_0.11.4
> [10] rtracklayer_1.20.4     stats4_3.0.0           tools_3.0.0
> [13] XML_3.98-1.1           zlibbioc_1.6.0
>
>
>
>
> --------------------------------
> Peter Hickey,
> PhD Student/Research Assistant,
> Bioinformatics Division,
> Walter and Eliza Hall Institute of Medical Research,
> 1G Royal Parade, Parkville, Vic 3052, Australia.
> Ph: +613 9345 2324
>
> hickey at wehi.edu.au
> http://www.wehi.edu.au
>
>
> ______________________________________________________________________
> The information in this email is confidential and intend...{{dropped:8}}
>
>
>
> _______________________________________________
> Bioconductor mailing list
> Bioconductor at r-project.org
> https://stat.ethz.ch/mailman/listinfo/bioconductor
> Search the archives: http://news.gmane.org/gmane.science.biology.informatics.conductor
>



More information about the Bioconductor mailing list