[BioC] GViz Annotation Track Stacking

Lance Parsons lparsons at princeton.edu
Thu May 22 21:00:41 CEST 2014


Thanks for the pointer Florian.  I've attached the patch I came up with 
that seems to do the trick.

  - Lance

Hahne, Florian wrote:
> Hi Lance,
> All of this should be happening in the .computeGroupRange function in
> Gviz.R.
> The following switch statement seems to do something reasonable for the
> left or right justification, but ignores any extra space for above and
> below. Should be trivial to fix:
>   switch(as.character(just),
>                         "left"={
>                             if(!rev){
>                                 start(finalRanges)<- start(finalRanges) -
> (spaceBefore + labelWidths + spaceAfter)
>                             }else{
>                                 end(finalRanges)<- end(finalRanges) +
> spaceAfter + labelWidths + spaceBefore
>                             }
>                             sb<- spaceBefore
>                             sa<- spaceAfter
>                         },
>                         "right"={
>                             if(!rev){
>                                 end(finalRanges)<-  end(finalRanges) +
> spaceAfter + labelWidths + spaceBefore
>                             }else{
>                                 start(finalRanges)<- start(finalRanges) -
> (spaceBefore + labelWidths + spaceAfter)
>                             }
>                             sb<- spaceBefore
>                             sa<- spaceAfter
>                         },
>                         "above"={
>                             sa<- sb<- 0
>                         },
>                         "below"={
>                             sa<- sb<- 0
>                         },
>                         stop(sprintf("Unknown label justification '%s'",
> just)))
>
>
>
>
>
> On 19/05/14 17:05, "Lance Parsons"<lparsons at princeton.edu>  wrote:
>
>> I've recently started using the option to put group labels below the
>> features in Gviz 1.8.1 AnnotationTracks (just.group="below").  However,
>> I have noticed that when the label is larger than the feature, the
>> stacking algorithm does not move the features onto a separate line as it
>> does when justification is to the left.  See the example photos:
>>
>> just.group="left": http://imgur.com/VfUN3G0
>>
>> just.group="below": http://imgur.com/zmRGtxD
>>
>> I have been putting the labels below since that often makes it clearer
>> which feature is being labeled (at least in my cases with small
>> features). I'd be willing to help work on a patch for this, but could
>> use a little help finding the relevant code.  It'd be great to update
>> the stacking code to account for label widths below the feature as well
>> as to have an option to control the spacing when a label is to the left
>> (or right) of a feature.
>>
>> -- 
>> Lance Parsons - Scientific Programmer
>> 134 Carl C. Icahn Laboratory
>> Lewis-Sigler Institute for Integrative Genomics
>> Princeton University
>>
>
>

-- 
Lance Parsons - Scientific Programmer
134 Carl C. Icahn Laboratory
Lewis-Sigler Institute for Integrative Genomics
Princeton University

-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: label_width_fix.patch
URL: <https://stat.ethz.ch/pipermail/bioconductor/attachments/20140522/a7c7e4b8/attachment.pl>


More information about the Bioconductor mailing list