dasmoth/dalliance — pull request #80 by ymen (2014-07-22 16:43:48+00:00)
Title: 49 Translate Genes

@dasmoth cc @mdrasmus

Addresses https://github.com/dasmoth/dalliance/issues/49

## Summary

Show translation of genes to amino acids at high magnifications in the genome browser.

- Translation is activated at:
1. sufficiently high magnification and
2. when grouping/collapsing of transcripts is turned off.

Again, please let us know your feedback or suggestions about design choices and implementation, we're most keen to work with you to make sure this PR aligns well with the overall road map of Dalliance!

## Illustration

- At low magnification, gene transcripts are shown as boxes/lines (no change from current implementation).
![screen shot 2014-07-21 at 10 55 34 pm](https://cloud.githubusercontent.com/assets/7988161/3661169/2f922cd4-11be-11e4-9ff7-75cb5ddc8ace.png)

I changed the color for glyphs of type `translation` to `blue` instead of the current default `red` for better contrast with stop codons (see next point).

- At moderately closeup magnifications (defined arbitrarily as 0.5 < `scale` < 8) , the amino acids are not shown, but colored boxes corresponding to amino acids are drawn. Amino acids are drawn in alternating shades of color that is similar to the box color for genes to provide smooth visual transition, with Methionine shown in `yellowgreen` and STOP codons shown in `crimson`. If the box color for gene is one of `blue`, `red`, `green` or `purple`, I default to the 2 purple hues used by UCSC.

![screen shot 2014-07-21 at 10 55 26 pm](https://cloud.githubusercontent.com/assets/7988161/3661188/61bbd106-11be-11e4-9ff5-6bf41da7dbc5.png)

- At max magnification (`scale` > 8), the translation of amino acids is shown for transcripts using 1 letter code.

![screen shot 2014-07-21 at 10 55 13 pm](https://cloud.githubusercontent.com/assets/7988161/3661208/82d492d8-11be-11e4-85a3-f1c7e9befa08.png)

![screen shot 2014-07-21 at 11 06 05 pm](https://cloud.githubusercontent.com/assets/7988161/3661200/7364485c-11be-11e4-8cbf-3a73b13f9848.png)

## Of note
If an amino acid is spread over 2 exons (ie it's at the splice site and some part of the codon is at one exon, and some part at the next exon), the translation of the amino acid is not given. An appropriately colored block with no letter labeling will be drawn (e.g. below, to the left of the A amino acid).

![screen shot 2014-07-21 at 11 02 07 pm](https://cloud.githubusercontent.com/assets/7988161/3661213/90c3672a-11be-11e4-982f-26c2c14a70a2.png)

I have not found a trivial way of fetching of non-contiguous sequence information (which may not be in the viewing range). If you have any ideas on how this can be implemented I'd love to refine this!

## Testing

I did sanity check for the translation based on
1. Scanning through the browser and ensuring there are minimal stop codons in the middle of ORFs
2. Comparing the translation results to the GeneCode 19 track on UCSC genome browser.