[Bioc-devel] ordering GenomicRanges without regard for strand

Hervé Pagès hpages at fhcrc.org
Fri Jan 17 00:02:06 CET 2014


Hi,

Just a quick update on this.

I added unstrand() to BiocGenerics 0.9.3. Following the same approach
as for unname(), I didn't make it a generic function, just a convenience
wrapper to the generic strand setter (‘strand<-’):

   unstrand <- function(x)
   {
     strand(x) <- "*"
     x
   }

However I still decided to put it in BiocGenerics so it's close to the
generic strand getter and setter (and is documented in the same man 
page). Just seems the right place for it even though it's not a generic
function.

Still need to add the 'ignore.strand' arg to the "sort" method for
GRanges objects.

Cheers,
H.


On 12/17/2013 02:24 PM, Marcus Davy wrote:
> Hi,
> I noticed that gaps(), reduce() etc are conditioned by strand information in a GRanges object, so having functionality to unstrand(), would be good, as that was the workaround I used when finding gaps between repeat regions by removing strand information from the Granges object to mimic output from 'bedtools complement -i [FILE]'
>
> Marcus
>
> Note old installation tested.
>> sessionInfo()
> R version 2.15.0 (2012-03-30)
> Platform: x86_64-unknown-linux-gnu (64-bit)
>
> locale:
> [1] C
>
> attached base packages:
> [1] stats     graphics  grDevices utils     datasets  methods   base
>
> other attached packages:
> [1] lattice_0.20-10      car_2.0-19           plyr_1.8
> [4] rtracklayer_1.18.2   GenomicRanges_1.10.7 NGS_0.9.4
> [7] Biostrings_2.26.3    IRanges_1.16.6       BiocGenerics_0.4.0
>
> loaded via a namespace (and not attached):
>   [1] BSgenome_1.26.1  MASS_7.3-23      RCurl_1.95-4.1   Rsamtools_1.10.2
>   [5] XML_3.98-1.1     bitops_1.0-5     grid_2.15.0      nnet_7.3-6
>   [9] parallel_2.15.0  stats4_2.15.0    tools_2.15.0     zlibbioc_1.4.0
>
> -----Original Message-----
> From: bioc-devel-bounces at r-project.org [mailto:bioc-devel-bounces at r-project.org] On Behalf Of Hervé Pagès
> Sent: Tuesday, 17 December 2013 8:27 p.m.
> To: Kasper Daniel Hansen
> Cc: Michael Lawrence; bioc-devel at r-project.org
> Subject: Re: [Bioc-devel] ordering GenomicRanges without regard for strand
>
> OK. Let's go for unstrand() too. Will add this in the next few days.
>
> H.
>
>
> On 12/12/2013 05:07 PM, Kasper Daniel Hansen wrote:
>> we should have the argument for sort, but I also find unstrand() to be
>> a great idea.
>>
>>
>> On Thu, Dec 12, 2013 at 7:19 PM, Hervé Pagès <hpages at fhcrc.org
>> <mailto:hpages at fhcrc.org>> wrote:
>>
>>      Hi Michael,
>>
>>      Feels like Christmas is not far away ;-)
>>
>>      Right now only the "match" method in the GenomicRanges-comparison.R
>>      family supports the 'ignore.strand' arg and I think it would be a good
>>      thing to have other "comparison" methods support it. It's too bad
>>      for order() though (but maybe there is a way to hack the definition of
>>      the generic in BiocGeneric?). Should be easy for sort(). Will do.
>>
>>      Cheers,
>>      H.
>>
>>
>>
>>      On 12/12/2013 01:44 PM, Michael Lawrence wrote:
>>
>>          It is very common to want to order a GenomicRanges by *position*
>>          but not
>>          strand. Would be nice to have an ignore.strand argument for ordering
>>          GenomicRanges. I realize that this is not possible by the order
>>          generic.
>>          But it would be possible for sort().
>>
>>          I also realize that someone could do this:
>>
>>          gr2 <- gr
>>          strand(gr2) <- "*"
>>          gr[order(gr2)]
>>
>>          But that is long-winded. Perhaps there could be an unstrand()?
>>
>>          gr[order(unstrand(gr))]
>>
>>          But this is still better:
>>
>>          sort(gr, ignore.strand=TRUE)
>>
>>          Sound like a good thing?
>>
>>          Michael
>>
>>                   [[alternative HTML version deleted]]
>>
>>          _________________________________________________
>>          Bioc-devel at r-project.org <mailto:Bioc-devel at r-project.org>
>>          mailing list
>>          https://stat.ethz.ch/mailman/__listinfo/bioc-devel
>>          <https://stat.ethz.ch/mailman/listinfo/bioc-devel>
>>
>>
>>      --
>>      Hervé Pagès
>>
>>      Program in Computational Biology
>>      Division of Public Health Sciences
>>      Fred Hutchinson Cancer Research Center
>>      1100 Fairview Ave. N, M1-B514
>>      P.O. Box 19024
>>      Seattle, WA 98109-1024
>>
>>      E-mail: hpages at fhcrc.org <mailto:hpages at fhcrc.org>
>>      Phone: (206) 667-5791 <tel:%28206%29%20667-5791>
>>      Fax: (206) 667-1319 <tel:%28206%29%20667-1319>
>>
>>
>>      _________________________________________________
>>      Bioc-devel at r-project.org <mailto:Bioc-devel at r-project.org> mailing list
>>      https://stat.ethz.ch/mailman/__listinfo/bioc-devel
>>      <https://stat.ethz.ch/mailman/listinfo/bioc-devel>
>>
>>
>
> --
> Hervé Pagès
>
> Program in Computational Biology
> Division of Public Health Sciences
> Fred Hutchinson Cancer Research Center
> 1100 Fairview Ave. N, M1-B514
> P.O. Box 19024
> Seattle, WA 98109-1024
>
> E-mail: hpages at fhcrc.org
> Phone:  (206) 667-5791
> Fax:    (206) 667-1319
>
> _______________________________________________
> Bioc-devel at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/bioc-devel
> The contents of this e-mail are confidential and may be subject to legal privilege.
>   If you are not the intended recipient you must not use, disseminate, distribute or
>   reproduce all or any part of this e-mail or attachments.  If you have received this
>   e-mail in error, please notify the sender and delete all material pertaining to this
>   e-mail.  Any opinion or views expressed in this e-mail are those of the individual
>   sender and may not represent those of The New Zealand Institute for Plant and
>   Food Research Limited.
>

-- 
Hervé Pagès

Program in Computational Biology
Division of Public Health Sciences
Fred Hutchinson Cancer Research Center
1100 Fairview Ave. N, M1-B514
P.O. Box 19024
Seattle, WA 98109-1024

E-mail: hpages at fhcrc.org
Phone:  (206) 667-5791
Fax:    (206) 667-1319



More information about the Bioc-devel mailing list