Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GFF3Tabix gets really slow if there is a "whole chromosome feature" #1076

Closed
cmdcolin opened this Issue Jun 25, 2018 · 3 comments

Comments

Projects
None yet
2 participants
@cmdcolin
Copy link
Contributor

cmdcolin commented Jun 25, 2018

This issue is sort of particular to NCBI gff, which will probably have a "region" feature that covers the whole chromosome. If you load this into a GFF3Tabix track then this results in extensive refetching to get the whole chromosome data and makes it too slow.

It would be pretty good to avoid refetching for the region feature using some sort of filter mechansim (could be configurable or just assume type=region does not have subfeatures and hence does not require refetching)

@rbuels

This comment has been minimized.

Copy link
Collaborator

rbuels commented Jun 25, 2018

Yeah, that would be good to have. Whatever it is needs to be configurable though, can’t hard code types. And probably needs to be off by default.

@cmdcolin

This comment has been minimized.

Copy link
Contributor Author

cmdcolin commented Jun 25, 2018

Maybe something like this? It allows configurable dontRedispatch to be a comma separated list of types (similar to the subParts config) so you can set dontRedispatch=region in config

diff --git a/src/JBrowse/Store/SeqFeature/GFF3Tabix.js b/src/JBrowse/Store/SeqFeature/GFF3Tabix.js
index 6a91873..555e3a8 100644
--- a/src/JBrowse/Store/SeqFeature/GFF3Tabix.js
+++ b/src/JBrowse/Store/SeqFeature/GFF3Tabix.js
@@ -35,6 +35,7 @@ return declare( [ SeqFeatureStore, DeferredStatsMixin, DeferredFeaturesMixin, Gl
     supportsFeatureTransforms: true,

     constructor( args ) {
+        this.dontRedispatch = (this.config.dontRedispatch||"").split( /\s*,\s*/ );
         var tbiBlob = args.tbi ||
             new XHRBlob(
                 this.resolveUrl(
@@ -119,9 +120,11 @@ return declare( [ SeqFeatureStore, DeferredStatsMixin, DeferredFeaturesMixin, Gl
                             let minStart = Infinity
                             let maxEnd = -Infinity
                             lines.forEach( line => {
-                                let start = line.start-1 // tabix indexes are 1-based
-                                if (start < minStart) minStart = start
-                                if (line.end > maxEnd) maxEnd = line.end
+                                if(!this.dontRedispatch.includes(line.fields[2])) {
+                                    let start = line.start-1 // tabix indexes are 1-based
+                                    if (start < minStart) minStart = start
+                                    if (line.end > maxEnd) maxEnd = line.end
+                                }
                             })
                             if (maxEnd > query.end || minStart < query.start) {
                                 let newQuery = Object.assign({},query,{ start: minStart, end: maxEnd })

@rbuels rbuels added this to the 1.15.0 milestone Jun 30, 2018

@rbuels

This comment has been minimized.

Copy link
Collaborator

rbuels commented Jul 5, 2018

closed with the merge of #1084

@rbuels rbuels closed this Jul 5, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.