-
Notifications
You must be signed in to change notification settings - Fork 44
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
Bigwig parsing and rendering support added #42
Conversation
…or variableStep wiggle and made the loop more efficient )
js/Track/Model/File/BIGWIG.js
Outdated
bw.getValues(chr, start, end, function(features){ | ||
model.receiveData(features, chr, start, end); | ||
deferred.resolveWith(model); | ||
}); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please replace tabs with spaces
js/Track/Model/File/BIGWIG.js
Outdated
var deferred = $.Deferred(); | ||
|
||
if(!this.url) this.data = new dallianceLib.BlobFetchable(this.track.dataFile); | ||
else this.data = new dallianceLib.URLFetchable(this.url); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Replace the above two lines with
this.bigwigFile = this.bigwigFile || (this.url ? new dallianceLib.URLFetchable(this.url) : new dallianceLib.BlobFetchable(this.track.dataFile));
so that we don't make a new dallianceLib object every time getData is called
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ohh right I will do that
js/Track/Model/File/BIGWIG.js
Outdated
if(!this.url) this.data = new dallianceLib.BlobFetchable(this.track.dataFile); | ||
else this.data = new dallianceLib.URLFetchable(this.url); | ||
|
||
new BWReader(this.data, this.name, function(bw){ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- Replace this.data with this.bigwigFile
- We need to cache the BWReader (like the VCFReader is cached) to avoid making requests for the header of the file every time getData is called
js/lib/BWReader.js
Outdated
@@ -0,0 +1,569 @@ | |||
(function(){ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please replace tabs with spaces
js/lib/BWReader.js
Outdated
@@ -0,0 +1,569 @@ | |||
(function(){ | |||
var BWReader = function(data, name, callback){ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the "name" argument is never used, so can be removed
js/lib/BWReader.js
Outdated
var vals = []; | ||
var chromid = bbi.chroms.indexOf(chrom); | ||
if(chromid == -1) chromid = bbi.chroms.indexOf("chr" + chrom); | ||
if(chromid == -1) cb(null, "chrom not found"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This needs to be cb([], "chrom not found")
- currently it causes an error to be thrown in parseData if you go to a chromosome not present in the file
js/Track/Model/File/BIGWIG.js
Outdated
|
||
return deferred; | ||
} | ||
}) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please add ; to the end of the file
js/Track/library/File/BIGWIG.js
Outdated
model : Genoverse.Track.Model.File.BIGWIG, | ||
name : 'bigwig', | ||
height : 100 | ||
}) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- Please add ; to the end of the file
- Also add the line
Genoverse.Track.File.BW = Genoverse.Track.File.BIGWIG;
to allow drag/drop to work (the file ending is .bw rather than .bigwig)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have seen files with both so adding this line will then allow suppor for both extensions
js/Track/Model/File/BIGWIG.js
Outdated
else this.data = new dallianceLib.URLFetchable(this.url); | ||
|
||
new BWReader(this.data, this.name, function(bw){ | ||
bw.getValues(chr, start, end, function(features){ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is possible for bw to be null - need to check for this and immediately resolve the deferred if it is the case
In addition to the changes requested above, there is a bug where features are missing when zooming out. Start at r=21:32684639-32684726, then press the zoom out button three times (you should end up at r=21:32684334-32685030). The third time causes more data to be loaded, but the features are drawn with a gap where the data from the original load should be present. This happens at all zoom levels. |
… requested region Returning all the data in the fetched blocks allows for a reduction in future read requests
Hey simon I have fixed BEDParser and enabled support for BigBed , can you please merge this PR now ? |
I have manually merged this PR with 0be9386 (along with some changes I made on top) |
Output preview :
http://i.imgur.com/354nOdu.png