Michael,

Thanks.  I think you understood my ill-stated needs perfectly.

However, I don't find that though there is RangesMatchingList-class, the constructor RangesMatchingList is not defined.

Neither is there an unlist method for the class, though I do see some discussion about index offsetting in the as.matrix help.

I am using IRanges_1.10.6

I suppose all this is thus not defined in current release, but is in dev and will be in the soon-to-come latest?

I tried to "roll-by-own" by calling new('RangesMatchingList',listData=myListOfRangedData) and setting the @elementType and @subjectOffsets myself, but got a downstream error.

So I thought I'd write....

Any advice?  Wait till next release and try your suggestions again?

Thanks,

~Malcolm

From: Michael Lawrence [mailto:lawrence.michael@gene.com]
Sent: Monday, October 10, 2011 4:26 PM
To: Cook, Malcolm
Cc: bioc-devel@r-project.org; Michael Lawrence <lawrence.michael@gene.com> (lawrence.michael@gene.com); Hervé Pagès (hpages@fhcrc.org)
Subject: Re: c,RangesMatching function implemented so as to allow multicore vectorizing of findOverlaps

I'm wondering what you would do with the result of this pvec() call. The indices would in matchMatrix would not match those in the original "subject" (actually the query/pattern in the below). I guess a 'c' could rbind things and add offsets, increase the dimensions, etc, for some virtual set of ranges. That's actually what happens when when unlist()ing a RangesMatchingList.

One should be able to do something like this:

rm <- unlist(RangesMatchingList(pvec(..., function(i) findOverlaps(query[i], subject))))

To get the result you might want. Let me know if that does not work and we can work to fix it.

Michael
On Mon, Oct 10, 2011 at 12:16 PM, Cook, Malcolm <MEC@stowers.org<mailto:MEC@stowers.org>> wrote:
I think that defining c for RangesMatching to cbind the matchMatix would be a good addiition to IRanges.

Having it would allow using pvec from multicore to distribute findOverlaps like so:

I'd appreciate comments/criticisms from those who know better....

setMethod("c",
          signature(x = "RangesMatching"),
          function (x, ..., recursive = FALSE)
          {
### PURPOSE: implement c for RangesMatching so as to yield a single
### RangesMatching which refers to the rbind of the component
### matchMatrix.
### MOTIVATION: Doing this allows using `multicore:pvec` as in:
### EXAMPLE:
###   rm<-pvec(1:length(subject),function(i) {findOverlaps(subject[i],query)})
            rm <- list(x,...)
            rm <-
              ## TODO: understand why ... contains objects of class `try-error`
              rm[which(sapply(rm,class)=='RangesMatching')]
            mm <- Reduce(rbind,lapply(rm,as.matrix))
            ## TODO: Is this the best/only/correct way to contrive to return a
            ## new matchMatrix made out of the combined matrix?
            x@matchMatrix<-mm
            x
          }
          )


Cheers,

~Malcolm

From: Malcolm Cook [mailto:malcolm.cook@gmail.com<mailto:malcolm.cook@gmail.com>]
Sent: Monday, October 10, 2011 9:08 AM
To: Cook, Malcolm
Subject: c,MatchMatrix sought


Malcolm Cook
h - 913.642.5257<tel:913.642.5257>
c - 913.226.1542<tel:913.226.1542>
w - 816.926.4449<tel:816.926.4449>


	[[alternative HTML version deleted]]

