dasmoth / dalliance

Interactive web-based genome browser.
http://www.biodalliance.org/
BSD 2-Clause "Simplified" License
226 stars 68 forks source link

Coloring BAM reads by strand with mismatch highlights #72

Closed ymen closed 10 years ago

ymen commented 10 years ago

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

Sorry for taking such a long time for the PR, and definitely let us know your opinions and suggestions. We would love to work with you to improve implementations and design choices, and make sure the changes align to the overall roadmap of Dalliance!

Changes

This PR implements coloring of BAM reads by strand, rendered using _SEQUENCE glyphs.

The option to color BAM reads is turned on by the option Highlight mismatches & strands, piggybacking on the previous option Color mismatches. This option is currently not turned on by default, but I believe it might be reasonable to make this turned on by default for Bam files.

Specific changes as follows:

image

At high zoom without closeup (defined as zoom=high & scale < 8), reads are first drawn as a solid rectangle based on strand direction with height corresponding to half of the tier height. Non-ref bases are drawn over with full height. From working with the browser, we have found this to 1) improve visibility of non-ref bases and 2) reduce rendering time, especially for high depth (>1000) sequencing results. Ref bases are fully opaque and not adjusted based on qual score.

image

image

dasmoth commented 10 years ago

Thanks very much for this contribution.

A few minor things:

Are you happy to make those changes, or shall I?

Slightly longer-term things I think we should be considering (but let's not hold up this PR, which is clearly useful as is):

I've just realized that this Dalliance-specific stylesheet extension never made it into the docs (my bad, will fix shortly). Doing things this way is more general, at the expense of making it a little harder to hook everything up in the track editor. Just something to consider in the future.

mdrasmus commented 10 years ago

Is there any particular reason for changing the default colour for "G"s from black to orange?

@ymen correct me if I'm wrong, but I believe we made this change because using black for the characters was better for readability. https://github.com/dasmoth/dalliance/pull/72/files#diff-da2a15b516d657a0793c92a72ded3428R1105

dasmoth commented 10 years ago

It's this change I was talking about:

https://github.com/dasmoth/dalliance/pull/72/files#diff-0d966b7245df74fbb0a38172982c9717L107

On Thu, Jul 17, 2014 at 4:46 PM, Matt Rasmussen notifications@github.com wrote:

Is there any particular reason for changing the default colour for "G"s from black to orange?

@ymen https://github.com/ymen correct me if I'm wrong, but I believe we made this change because using black for the characters was better for readability.

https://github.com/dasmoth/dalliance/pull/72/files#diff-da2a15b516d657a0793c92a72ded3428R1105

— Reply to this email directly or view it on GitHub https://github.com/dasmoth/dalliance/pull/72#issuecomment-49325020.

ymen commented 10 years ago

Thanks Thomas for your feedback. I'll make the changes and push it back to you later today.

Is there any particular reason for changing the default colour for "G"s from black to orange? Black seems to be the common choice in chromatogram-viewing software.

I was following the colours from IGV, but this is pretty much arbitrary. Another consideration was that we had to change the font color for G if the base fill color for G is set to black, which was somewhat inconsistent visually. But if you think black for G works better I can just change it back, and label on it with white characters.

I'd just add an extra argument to the SequenceGlyph constructor?

Sounds good, I'll make the adjustment!

ymen commented 10 years ago

Pushed the correction for the typo and adjusted the SequenceGlyph constructor as suggested.

If you prefer the original base color for G, I'd be happy to make that change as well.