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

Dynamic track API via genomic range (ie. skip index lookup) #1666

Closed
bartgrantham opened this issue Jul 28, 2023 · 7 comments
Closed

Dynamic track API via genomic range (ie. skip index lookup) #1666

bartgrantham opened this issue Jul 28, 2023 · 7 comments
Assignees
Milestone

Comments

@bartgrantham
Copy link

Would it be possible for igv.js to request track data based on a genomic coordinate range instead of a file's bytes range? To support this a webservice would have to synthesize and serve the gzipped track contents on the fly, as if it were an HTTP range query generated from an index lookup.

Conceptually this would actually be less work for igv.js as it's short-circuiting across the index lookup. Instead of consulting the tbi/bai/csi first to translate the genomic coordinates to a range of bytes it just calls a webservice directly with the genomic range as query parameters. The returned data would be track contents in the same form as usual (gtf/gff lines, bcf records, bam records, etc.) covering that range, and it would be the responsibility of the web service to provide the data so that it could be transparently consumed by igv.js' track drawing routines as if it had come from an HTTP range query.

An example use case for this would be an annotation track that could be configured to show or hide features dynamically, but it seems like it could be useful for any indexed track.

@jrobinso
Copy link
Contributor

This is already supported, see examples/custom-webservice.html.

@bartgrantham
Copy link
Author

Excellent! I'll take a look at that. Does it only support application/json for the contentType parameter, or can we return bcf records, bam records, etc.?

@jrobinso
Copy link
Contributor

You'l have to look at the code or wait until I have time to, its all very flexible being javascript. Also look at the "custom reader" example, it is even more flexible.

@bartgrantham
Copy link
Author

Thanks, one last question: is the JSON schema for the various track types documented somewhere? I can look in the code if necessary, but I'd prefer docs.

@jrobinso
Copy link
Contributor

No they are not, and technically this is not a json schema, although simple features can be mapped directly to a flat JSON structure many are too complex for that. If you have questions about specific track types I will try to answer them here.

@bartgrantham
Copy link
Author

I think the only ones that I'd need for now are: annotation, alignment, and variant. Thank you!

@jrobinso
Copy link
Contributor

First I think I've thrown us off on a tangent, your original request to return data in a standard format is the most flexible and should be supported, surprisingly it doesn't seem to be, with the exception of the htsget protocol for bam and vcf formats. This won't be hard to implement when I find time to do so, so leave this open. I think that is the way to go.

Having said that, for annotations you can see the expected properties from the parsers in js/feature/decode, especially the "bed" parser in ucsc.js. Basic properties are

  • chr
  • start -- 0 based UCSC style convention
  • end
  • name
  • strand -- optional, either - or +

@jrobinso jrobinso self-assigned this Dec 8, 2023
@jrobinso jrobinso added this to the 3.0 milestone Jun 21, 2024
jrobinso added a commit that referenced this issue Jul 10, 2024
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

No branches or pull requests

2 participants