It's on the right track. The case where two ranges are produced is
problematic, because we would want this to be a parallel vector
operation, where the length of the input is the same as the length of
the output. So that last case I think might just ignore the leftend
and rightstart arguments with a warning, returning a result with the
gap filled.

Michael

On Mon, Sep 16, 2019 at 1:48 AM Bhagwat, Aditya
<aditya.bhag...@mpi-bn.mpg.de> wrote:
>
> Michael, actually, such a generic straddle() could be useful:
>
> straddle(leftstart=-100, rightend=100)  # extended range
> straddle(leftstart=-100, leftend=-1)       # left flank
> straddle(rightstart=1, rightend=100)     # right flank
> straddle(leftstart=-100, leftend=-1, rightstart=1, rightend=100) # left and 
> right flanks
>
> What do you think?
>
> Aditya
>
> ________________________________________
> From: Bioc-devel [bioc-devel-boun...@r-project.org] on behalf of Bhagwat, 
> Aditya [aditya.bhag...@mpi-bn.mpg.de]
> Sent: Monday, September 16, 2019 10:30 AM
> To: Michael Lawrence
> Cc: bioc-devel@r-project.org
> Subject: Re: [Bioc-devel] Extending GenomicRanges::`intra-range-methods`
>
> Hmm no that wouldn't work, it would become messy trying to figure out when 
> incompatible arguments are provided.
>
> Aditya
>
>
> ________________________________________
> From: Bioc-devel [bioc-devel-boun...@r-project.org] on behalf of Bhagwat, 
> Aditya [aditya.bhag...@mpi-bn.mpg.de]
> Sent: Monday, September 16, 2019 10:09 AM
> To: Michael Lawrence
> Cc: bioc-devel@r-project.org
> Subject: Re: [Bioc-devel] Extending GenomicRanges::`intra-range-methods`
>
> Hi Michael,
>
> Thank you for the pointer to plyranges - looks very useful!
>
> > Maybe a better name is "straddle" for when ranges
> > straddle one of the endpoints? In keeping with the current pattern of
> > Ranges API, there would be a single function: straddle(x, side, left,
> > right, ignore.strand=FALSE). So straddle(x, "start", -100, 10) would
> > be like promoters(x, 100, 10) for a positive or "*" strand range.
>
> Cool suggestion, and a really fitting verb :-)
> Just slightly modifying your suggestion makes the API fully generic (waaw!), 
> generalizing over left_flank, right_flank, as well as slop:
>
> straddle(leftstart, leftend, rightstart, rightend)
>
> Would it be worth having such functionality in GenomicRanges or plyranges, 
> rather than multicrispr<https://gitlab.gwdg.de/loosolab/software/multicrispr>?
>
>
> > That brings up strandedness, which needs to be considered here. For
> > unstranded ranges, it may be that direct start() and end()
> > manipulation is actually more transparent than a special verb.
>
> I ended up using left/right for unstranded, and up/down for stranded 
> operations.
>
>
> > The functions that involve reduce() wouldn't fit into the intrarange
> > operations, as they are summarizing ranges, not transforming them.
> > They may be going too far.
>
> True. Actually, the functions would be cleaner without the reduce(), I think 
> I'll take that out.
>
> Cheers,
>
> Aditya
>
>
> [[alternative HTML version deleted]]
>
> _______________________________________________
> Bioc-devel@r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/bioc-devel
>
> _______________________________________________
> Bioc-devel@r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/bioc-devel



-- 
Michael Lawrence
Scientist, Bioinformatics and Computational Biology
Genentech, A Member of the Roche Group
Office +1 (650) 225-7760
micha...@gene.com

Join Genentech on LinkedIn | Twitter | Facebook | Instagram | YouTube

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

Reply via email to