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

Add new BigBed adapter #944

Merged
merged 43 commits into from
Apr 17, 2018
Merged

Add new BigBed adapter #944

merged 43 commits into from
Apr 17, 2018

Conversation

cmdcolin
Copy link
Contributor

This PR adds a new class that can access BigBed files.

Luckily, basically all of the logic for parsing BigBed was already there in the bigwig code, so this simply adds a small class that adapts to that (e.g. BigBed doesn't use zoom levels) and fixes a couple things in the existing logic (e.g. "byteLength" instead of "length" for arraybuffer)

Here's a screenshot with a simple bed file

screenshot-localhost-8000-2017-11-30-13-55-45-061

Potentially there are some more intricacies to bigbed that need to be handled but for very simple bed files this sees to works ok

@ghost ghost assigned cmdcolin Nov 30, 2017
@ghost ghost added the in progress currently being worked on label Nov 30, 2017
Copy link
Contributor

@nathandunn nathandunn left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I haven't tested BigBed, but BigWig still works fine. Nice catch on the bytesLength.

@@ -97,7 +97,7 @@ return declare([ SeqFeatureStore, DeferredFeaturesMixin, DeferredStatsMixin ],
},

_load: function() {
this._read( 0, 512, lang.hitch( this, function( bytes ) {
this._read( 0, 2000, lang.hitch( this, function( bytes ) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should be 2048? Not sure it would make any difference.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The bigbed file I tested had a larger header than 512 so I arbitrarily increased it a little. There might be a better value to use but it doesn't hurt unless maybe there was a empty bigwig/bigbed file less than 2000bytes in length

@cmdcolin
Copy link
Contributor Author

cmdcolin commented Dec 6, 2017

Updated to add ability to render genes encoded in bigbed e.g. gencode

Used https://github.com/dasmoth/gtf2bed to convert gencode annotations to bigbed

screenshot-localhost-2017-12-06-10-49-36-099

Basically the blockstart/blockend defines exons and thickStart and thickEnd intersection with the blocks defines CDS that makes the gene glyph :)

@cmdcolin cmdcolin force-pushed the add_bigbed branch 3 times, most recently from 8c92c6e to e1309ab Compare January 18, 2018 18:16
@cmdcolin cmdcolin removed the in progress currently being worked on label Jan 19, 2018
@rbuels rbuels self-requested a review January 29, 2018 19:33
@rbuels rbuels added this to the 1.12.4 milestone Jan 29, 2018
@rbuels rbuels added the feature req this adds new functionality to JBrowse 1 label Jan 29, 2018
@ghost ghost assigned rbuels Jan 31, 2018
@ghost ghost added the in progress currently being worked on label Jan 31, 2018
@rbuels rbuels modified the milestones: 1.12.4, 1.13.0 Feb 2, 2018
@nathandunn nathandunn changed the base branch from master to dev February 7, 2018 21:29
@cmdcolin
Copy link
Contributor Author

cmdcolin commented Mar 1, 2018

The autosql parsing is now "robustified" and a sample track on the volvox sample data is available

@rbuels rbuels modified the milestones: 1.13.0, 1.14.0 Mar 14, 2018
@rbuels rbuels modified the milestone: 1.14.0 Mar 31, 2018
Copy link
Collaborator

@rbuels rbuels left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

code-wise, this looks great, just a couple of little nits to pick. I assume you have tested this on a variety of bigbed files?

expect( features[edenIndex].get('subfeatures').length ).toEqual( 8 );
});
}).call();

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the expect() calls above should be in an it() call, are you sure they are actually running?

have you tested this with larger bigbed files, like human ones?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

will be awesome to finally get bigbed support!

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 think expect() is the proper way to run assertions inside of the larger it() calls

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The main things I tested the bigbed code on were ENCODE BigBed files (simple box features) and I manually converted gencode GTF files into BigBed (gene features e.g. mRNA with exons and the thickStart/thickEnd attribute representing boundaries of CDS)

I could make those files available somewhere if there's interest but being human data they are fairly large

return false;
});
console.log(edenIndex);

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

could you remove this log statement?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removed :)

@rbuels
Copy link
Collaborator

rbuels commented Apr 3, 2018 via email

@cmdcolin
Copy link
Contributor Author

cmdcolin commented Apr 4, 2018

That should be fine to add some xit tests. I can try and find a place to out the test files, maybe jbrowse.org server?

@rbuels
Copy link
Collaborator

rbuels commented Apr 4, 2018 via email

@cmdcolin
Copy link
Contributor Author

cmdcolin commented Apr 4, 2018

Found some existing gencode bigbed on trackhubregistry that could work. Example

ftp://ngs.sanger.ac.uk/production/gencode/update_trackhub/mm10/trackDb.txt
ftp://ngs.sanger.ac.uk/production/gencode/update_trackhub/hg38/trackDb.txt

@rbuels
Copy link
Collaborator

rbuels commented Apr 11, 2018

Also, we can't have hardcoded 'mRNA' feature types. Need to have some kind of configuration scheme for that.

@cmdcolin
Copy link
Contributor Author

RE: hardcoded feature type

I guess if a autoSql contained a "type" field it could set the type of the feature implicitly (in the bed12 it does currently hardcode it mRNA anyways, but that could be reverted to allow otherwise).

In the wild (the gencode data for ex) it has geneBioType which doesn't necessarily map cleanly onto sequenceontology types

@rbuels
Copy link
Collaborator

rbuels commented Apr 11, 2018

Yeah we just need to make sure our track configuration system is powerful enough that people can achieve good results for each specific dataset.

For gencode, maybe a user would set something like:

description = Gene {geneName}, {geneBioType}

@rbuels
Copy link
Collaborator

rbuels commented Apr 12, 2018

@cmdcolin how did you generate docs/tutorial/data_files/volvox.bb? it's got the gencode autoSql schema, which isn't right for what it actually contains

@rbuels
Copy link
Collaborator

rbuels commented Apr 12, 2018

and i can't get bedToBigBed to accept an autosql that actually describes it

@cmdcolin
Copy link
Contributor Author

I used gtf2bed from https://github.com/dasmoth/gtf2bed and used that on the volvox gtf

@cmdcolin
Copy link
Contributor Author

Then i used bedToBigBed with the resulting bed file and the gencode.as in the gtf2bed repo (obviously that was wrong though!)

@cmdcolin
Copy link
Contributor Author

Is it actually incorrect though? It seems like there are 17 columns in the bed and 17 in the gencode.as. Is some field mismatching?

@rbuels rbuels merged commit bb400cd into dev Apr 17, 2018
@cmdcolin
Copy link
Contributor Author

Looks like EDEN.1 not showing up in sample data, I think due to an "id collision"

@rbuels
Copy link
Collaborator

rbuels commented Apr 17, 2018

@cmdcolin good catch, fixed in 99f3849

@cmdcolin cmdcolin deleted the add_bigbed branch May 9, 2018 15:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature req this adds new functionality to JBrowse 1 in progress currently being worked on
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants