Hi Micheal and Steve

Thanks for giving me the pointers. Here is what I did(basically steps
suggested by you guys). I think I might need some hand holding. Not sure
how to find the components common in two findoverlaps output.


ir <- IRanges(c(10,10,11,9,10,11), width=c(190,190,190,190,180,180))
start = flank(ir,1,both=TRUE)
end=flank(ir,1,start=FALSE,both=TRUE)
start_overlaps = findOverlaps(start)
end_overlaps = findOverlaps(end)


If I do the following I get an error.
intersect(start_overlaps,end_overlaps)
Error in as.vector(y) : no method for coercing this S4 class to a vector

And the following, I belv gives me all the indexes.
intersect(as.matrix(findOverlaps(start)),as.matrix(findOverlaps(end)))
[1] 1 2 3 4 5 6

As Micheal said I still need to find the connected components, could you
please help me with that. Unfortunately I dont have much experience here.
Appreciate your time.


best,
-Abhi




On Tue, Apr 24, 2012 at 6:02 PM, Michael Lawrence <lawrence.michael@gene.com
> wrote:

> I think Steve is off to a good start. Maybe use flank(x, 1, both = TRUE)
> for the starts, and then flank(x, 1, start = FALSE, both = TRUE) for the
> ends.
>
> Then do findOverlaps(starts) and findOverlaps(ends). Use intersect(x, y)
> on the results to get the pairs that match at both the start and end.
>
> Then probably need RBGL and connComp function to find the connected
> components of that graph. Give each connected component a different seqname
> in a GRanges and call reduce.
>
> Maybe.
>
> Michael
>
>  On Tue, Apr 24, 2012 at 4:41 PM, Steve Lianoglou <
> mailinglist.honeypot@gmail.com> wrote:
>
>>  Quick thought.
>>
>> What if you think about doing two reduce-like operations on your data, but
>> you would resize them to width=1, fix="start" and do some findOverlaps
>> mojo
>> with those coords. Then do the same but play with width=1 transformations
>> web you fix at the end.
>>
>> I'm writing from my phone so can't really tease that out, but perhaps you
>> get the direction I'm going?
>>
>>
>>
>> On Tuesday, April 24, 2012, Abhishek Pratap wrote:
>>
>> > Hi Steve
>> >
>> > That's precisely correct. Thanks for rewording it.
>> >
>> > I am trying to merge all the rows which have a tiling distance of 1 bp
>> or
>> > less on both start and end.  If a range internal doesnt agree with that
>> > then it should not be collapsed.
>> >
>> > I agree it is somewhat related to clustering but not exactly it.
>> >
>> >  I will mention the data link again in case anyone else want to have
>> look
>> > without digging deep in the thread.
>> > http://pastebin.com/cccZby2t
>> >
>> > Thanks for your help guys,
>> > -Abhi
>> >
>> > On Tue, Apr 24, 2012 at 3:54 PM, Steve Lianoglou <
>> > mailinglist.honeypot@gmail.com <javascript:_e({}, 'cvml',
>>
>> > 'mailinglist.honeypot@gmail.com');>> wrote:
>> >
>> >> Hi,
>> >>
>> >> On Tue, Apr 24, 2012 at 6:43 PM, Kasper Daniel Hansen
>> >> <kasperdanielhansen@gmail.com <javascript:_e({}, 'cvml',
>> >> 'kasperdanielhansen@gmail.com');>> wrote:
>> >> >> ir <- IRanges(start = c(1,5), width = 3)
>> >> >> ir
>> >> > IRanges of length 2
>> >> >    start end width
>> >> > [1]     1   3     3
>> >> > [2]     5   7     3
>> >> >> reduce(ir)
>> >> > IRanges of length 2
>> >> >    start end width
>> >> > [1]     1   3     3
>> >> > [2]     5   7     3
>> >> >> reduce(ir, min.gapwidth = 2)
>> >> > IRanges of length 1
>> >> >    start end width
>> >> > [1]     1   7     7
>> >> >
>> >> > As far as I understand, this is exactly what you want.  If you have
>> >> > further questions, I suggest you read the help page.
>> >>
>> >> This actually isn't what he wants -- but what he wants isn't
>> >> answerable w/ `reduce`.
>> >>
>> >> All of the OP's ranges overlap eachother -- I think he's trying to
>> >> split his ranges into two groups because one group has ends that are
>> >> very close to each other and the other's are a bit different. Note
>> >> that the last two rows, the ends are a greater distance away from (but
>> >> still *within*) the ends of the first group of ranges he's trying to
>> >> group.
>> >>
>> >> It's almost trying to cluster groups of reads together, but again --
>> not
>> >> really.
>> >>
>> >> Not sure why you might want to do this, but ... just to say that
>> >> reduce isn't the answer here.
>> >>
>> >> -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
>> >>
>> >
>> >
>>
>> --
>> 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
>>
>>        [[alternative HTML version deleted]]
>>
>> _______________________________________________
>> Bioconductor mailing list
>> Bioconductor@r-project.org
>> https://stat.ethz.ch/mailman/listinfo/bioconductor
>> Search the archives:
>> http://news.gmane.org/gmane.science.biology.informatics.conductor
>>
>
>

	[[alternative HTML version deleted]]

