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

Bigwig parsing and rendering support added #42

Closed
wants to merge 24 commits into from

Conversation

sourabh2k15
Copy link
Contributor

bw.getValues(chr, start, end, function(features){
model.receiveData(features, chr, start, end);
deferred.resolveWith(model);
});
Copy link
Contributor

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

var deferred = $.Deferred();

if(!this.url) this.data = new dallianceLib.BlobFetchable(this.track.dataFile);
else this.data = new dallianceLib.URLFetchable(this.url);
Copy link
Contributor

@simonbrent simonbrent Aug 17, 2017

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

Copy link
Contributor Author

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

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){
Copy link
Contributor

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

@@ -0,0 +1,569 @@
(function(){
Copy link
Contributor

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

@@ -0,0 +1,569 @@
(function(){
var BWReader = function(data, name, callback){
Copy link
Contributor

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

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");
Copy link
Contributor

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


return deferred;
}
})
Copy link
Contributor

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

model : Genoverse.Track.Model.File.BIGWIG,
name : 'bigwig',
height : 100
})
Copy link
Contributor

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)

Copy link
Contributor Author

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

else this.data = new dallianceLib.URLFetchable(this.url);

new BWReader(this.data, this.name, function(bw){
bw.getValues(chr, start, end, function(features){
Copy link
Contributor

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

@simonbrent
Copy link
Contributor

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.

@sourabh2k15
Copy link
Contributor Author

Hey simon I have fixed BEDParser and enabled support for BigBed , can you please merge this PR now ?

@simonbrent
Copy link
Contributor

I have manually merged this PR with 0be9386 (along with some changes I made on top)

@simonbrent simonbrent closed this Aug 29, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants