twsaari / FeatureSequence

JBrowse plugin to view the sequence of features
GNU General Public License v3.0
7 stars 3 forks source link

Need to disable overlapping sub-features warning #20

Open vaneet-lotay opened 4 years ago

vaneet-lotay commented 4 years ago

Hello,

Thank you for your wonderful plugin, it is a great option to explore the sub parts of the gene and mRNA sequences in JBrowse

I understand the need for the overlapping sub-features warning pop up box that comes up, but is there a way to disable it in the code?

feat_seq_warnings

The issue is I believe I know in my situation why it keeps popping up because I do have overlapping segments but they're meant to be overlapping as they signify the presence of the UTR regions in the gene models via the jbrowse configuration attribute:

'impliedUTRs' : true

I've noticed whenever these 'implied' UTRs are displayed this warnings box gets activated. So is there a way I can disable this alert in the javascript code. I tried to comment out this alert line in the main.js file like so (FeatureSequence/js/main.js):

    /**
     * Overlapping subfeatures will interfere with the use of FeatureSequence.
     * An older method will more accurately display overlapping features,
     * but this will suffer a major performance penalty.
     */
        var persistingOverlaps = self._checkForOverlap(feat._subfeatures);
        if ( persistingOverlaps === -1 ) {
            var FeatSeq = new FeatureSequence(feat, seq, opt);
        } else {
            var warnings = "";
            persistingOverlaps.forEach(function(pair) {
                warnings += "Warning: overlap between subfeatures "
                    +pair[0].id
                    +" and "
                    +pair[1].id
                    +"\n"
                ;
            });
            warnings += "Overlapping subfeatures will cause problems in viewing their boundaries.\nThis may also cause the Feature Sequence Viewer to respond slowly."
            /** alert(warnings); */
            var FeatSeq = new FeatureSequenceOld(feat, seq, opt);
        }

    });
},

However this doesn't seem to work as the box keeps popping up, or perhaps I'm not refreshing the Javascript code in the right way, can you help with this please?

Thanks.

twsaari commented 4 years ago

Hi. Commenting out the alert(warnings) line does indeed disable the warning pop-up. You must have to do a hard refresh so that your browser sees the changes. I know that Firefox on Linux or Windows is Ctrl + Shift + R.

That said, note that in those cases it launches an old (and not recommended) FeatureSequence Viewer. I'm going to work on this plugin in the next few months, and this is one of the things I'd like to address.

vaneet-lotay commented 4 years ago

Hello,

I am using Chrome but have tested it on Firefox as well after doing a hard refresh and clearing cache several times. It never updates after I have commented that line. It's as if it is not reading js/main.js to execute the Javascript code, am I editing the wrong file or can you think of any other reason why it wouldn't show that or any other change I make to the main.js file?

Thanks,

Vaneet