On 04/10/2014 11:44 PM, Peter Hickey wrote:
Could the findOverlaps method with signatures involving SummarizedExperiment objects please be extended 
to allow the full range of "type" and "select" arguments"? Please see the 
examples below for situations where the parameter choices seem unduly restrictive. Are there reasons for 
these restrictions?


Hi Pete -- Updated in 1.15.46, thanks. I think the original rationale had been that the rowData can be a GRanges or GRangesList, and type and select are not equally supported across these types, so only those values implemented for all row data were available. Martin


Thanks,
Pete

These examples use GenomicRanges_1.14.4:

### - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
## Returns error: "Error in match.arg(type) :   'arg' should be one of "any", "start", "end", 
"within""
nrows <- 200; ncols <- 6
   counts <- matrix(runif(nrows * ncols, 1, 1e4), nrows)
   rowData <- GRanges(rep(c("chr1", "chr2"), c(50, 150)),
                      IRanges(floor(runif(200, 1e5, 1e6)), width=100),
                      strand=sample(c("+", "-"), 200, TRUE))
   colData <- DataFrame(Treatment=rep(c("ChIP", "Input"), 3),
                        row.names=LETTERS[1:6])
   sset <- SummarizedExperiment(assays=SimpleList(counts=counts),
                  rowData=rowData, colData=colData)
findOverlaps(sset, sset, type = 'equal')

### - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
## But this works fine (ostensibly doing the same thing as the above but via a 
different signature)
findOverlaps(sset, rowData(sset), type = 'equal')

### - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
## I looked at the method definitions for various signatures
## This revealed that only a subset of "type" and "select" arguments are 
allowed for certain signatures involving SummarizedExperiment objects
## E.g. Does not allow type = 'equal' or select = 'last' or select = 'arbitrary'
selectMethod('findOverlaps', c('SummarizedExperiment', 'SummarizedExperiment'))
Method Definition:

function (query, subject, maxgap = 0L, minoverlap = 1L, type = c("any",
     "start", "end", "within"), select = c("all", "first"), ...)
{
     .local <- function (query, subject, maxgap = 0L, minoverlap = 1L,
         type = c("any", "start", "end", "within"), select = c("all",
             "first"), ignore.strand = FALSE)
     {
         findOverlaps(rowData(query), rowData(subject), maxgap = maxgap,
             minoverlap = minoverlap, type = match.arg(type),
             select = match.arg(select), ignore.strand = ignore.strand)
     }
     .local(query, subject, maxgap, minoverlap, type, select,
         ...)
}
<environment: namespace:GenomicRanges>

Signatures:
         query                  subject
target  "SummarizedExperiment" "SummarizedExperiment"
defined "SummarizedExperiment" "SummarizedExperiment"

### - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
## E.g. Does allow type = 'equal' but does not allow select = 'last' or select 
= 'arbitrary'
selectMethod('findOverlaps', c('SummarizedExperiment', 'Vector'))
Method Definition:

function (query, subject, maxgap = 0L, minoverlap = 1L, type = c("any",
     "start", "end", "within", "equal"), select = c("all", "first"),
     ...)
{
     .local <- function (query, subject, maxgap = 0L, minoverlap = 1L,
         type = c("any", "start", "end", "within", "equal"), select = c("all",
             "first"), ignore.strand = FALSE)
     {
         findOverlaps(rowData(query), subject, maxgap = maxgap,
             minoverlap = minoverlap, type = match.arg(type),
             select = match.arg(select), ignore.strand = ignore.strand)
     }
     .local(query, subject, maxgap, minoverlap, type, select,
         ...)
}
<environment: namespace:GenomicRanges>

Signatures:
         query                  subject
target  "SummarizedExperiment" "Vector"
defined "SummarizedExperiment" "Vector"

### - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
## E.g. Does allow type = 'equal' but does not allow select = 'last' or select 
= 'arbitrary'
selectMethod('findOverlaps', c('Vector', 'SummarizedExperiment'))
Method Definition:

function (query, subject, maxgap = 0L, minoverlap = 1L, type = c("any",
     "start", "end", "within", "equal"), select = c("all", "first"),
     ...)
{
     .local <- function (query, subject, maxgap = 0L, minoverlap = 1L,
         type = c("any", "start", "end", "within", "equal"), select = c("all",
             "first"), ignore.strand = FALSE)
     {
         findOverlaps(query, rowData(subject), maxgap = maxgap,
             minoverlap = minoverlap, type = match.arg(type),
             select = match.arg(select), ignore.strand = ignore.strand)
     }
     .local(query, subject, maxgap, minoverlap, type, select,
         ...)
}
<environment: namespace:GenomicRanges>

Signatures:
         query    subject
target  "Vector" "SummarizedExperiment"
defined "Vector" "SummarizedExperiment"

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

hic...@wehi.edu.au
http://www.wehi.edu.au


______________________________________________________________________
The information in this email is confidential and inte...{{dropped:16}}

_______________________________________________
Bioc-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/bioc-devel

Reply via email to