CanvasFeatures Gene glyph sometimes does not layout features correctly #686

Closed
cmdcolin opened this Issue Feb 12, 2016 · 4 comments

Comments

Projects
None yet
2 participants
@cmdcolin
Contributor

cmdcolin commented Feb 12, 2016

GMOD/Apollo#825 on Apollo reported this bug displaying gene glyphs (in which a single feature was "broken" across blocks) under CanvasFeatures

I am attaching the GFF used (formatted with tabs)

test.gff

Screenshot

@cmdcolin

This comment has been minimized.

Show comment
Hide comment
@cmdcolin

cmdcolin Feb 12, 2016

Contributor

Note: @erasche I also experimented with adding a "Name" field to column 9 for that mRNA and it ended up sort of fixing it. That could be a clue.

Contributor

cmdcolin commented Feb 12, 2016

Note: @erasche I also experimented with adding a "Name" field to column 9 for that mRNA and it ended up sort of fixing it. That could be a clue.

@cmdcolin

This comment has been minimized.

Show comment
Hide comment
@cmdcolin

cmdcolin Feb 12, 2016

Contributor

screenshot-localhost 2016-02-12 09-14-28 png resize

Contributor

cmdcolin commented Feb 12, 2016

screenshot-localhost 2016-02-12 09-14-28 png resize

@erasche

This comment has been minimized.

Show comment
Hide comment
@erasche

erasche Feb 12, 2016

Contributor

@cmdcolin ooooh. That looks like something I can implement locally to fix this. Thanks!

Contributor

erasche commented Feb 12, 2016

@cmdcolin ooooh. That looks like something I can implement locally to fix this. Thanks!

@cmdcolin

This comment has been minimized.

Show comment
Hide comment
@cmdcolin

cmdcolin Feb 12, 2016

Contributor

In the code, it shows how this issue might have come about "// sort the children by name"

Potential fix:

diff --git a/src/JBrowse/View/FeatureGlyph/Gene.js b/src/JBrowse/View/FeatureGlyph/Gene.js
index 5c37a21..50e1cef 100644
--- a/src/JBrowse/View/FeatureGlyph/Gene.js
+++ b/src/JBrowse/View/FeatureGlyph/Gene.js
@@ -57,8 +57,8 @@ _getFeatureRectangle: function( viewArgs, feature ) {
         glyph: this
     };
     if( subfeatures && subfeatures.length ) {
-        // sort the children by name
-        subfeatures.sort( function( a, b ) { return (a.get('name') || '').localeCompare( b.get('name')||'' ); } );
+        // sort the children by name or id
+        subfeatures.sort( function( a, b ) { return (a.get('name') || a.get('id') || '').localeCompare( b.get('name') || b.get('id') || '' ); } );
Contributor

cmdcolin commented Feb 12, 2016

In the code, it shows how this issue might have come about "// sort the children by name"

Potential fix:

diff --git a/src/JBrowse/View/FeatureGlyph/Gene.js b/src/JBrowse/View/FeatureGlyph/Gene.js
index 5c37a21..50e1cef 100644
--- a/src/JBrowse/View/FeatureGlyph/Gene.js
+++ b/src/JBrowse/View/FeatureGlyph/Gene.js
@@ -57,8 +57,8 @@ _getFeatureRectangle: function( viewArgs, feature ) {
         glyph: this
     };
     if( subfeatures && subfeatures.length ) {
-        // sort the children by name
-        subfeatures.sort( function( a, b ) { return (a.get('name') || '').localeCompare( b.get('name')||'' ); } );
+        // sort the children by name or id
+        subfeatures.sort( function( a, b ) { return (a.get('name') || a.get('id') || '').localeCompare( b.get('name') || b.get('id') || '' ); } );

@cmdcolin cmdcolin closed this in fdc18b1 Apr 4, 2016

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment