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

Feature request: filtering of tracks (particularly alignment) #1606

Open
jamestwebber opened this issue Mar 13, 2023 · 5 comments
Open

Feature request: filtering of tracks (particularly alignment) #1606

jamestwebber opened this issue Mar 13, 2023 · 5 comments

Comments

@jamestwebber
Copy link

I've found igv.js and igv-notebook to be super useful for visualizing novel transcriptomes and the read support for them. One thing that I've repeatedly found myself doing: I take the input for a track I've visualizing (could be a gff3, genePred, BAM, etc) and filter it down to a specific subset so that it's easier to visualize e.g. only certain genes in the gff3, or only reads that map to a specific transcript, and so on.

It would be amazing if I could do this in the igv.js browser, or via a callback in my notebook. Being able to write a custom callback is more powerful, but I don't know how complex it would be to implement. But just the ability to filter by exact match for a given field (or BAM tag) would still be very useful.

@jrobinso
Copy link
Contributor

I'm not entirely sure I understand what you mean by "filter". Do you want to filter reads from the bam file? The reference to genes in a gff3 is confusing, I'm not sure what that has to do with reads in the file. If you want to look at specific loci of course that is supported.

Perhaps a screenshot would help, or a detailed description of what you are currently doing would help. Or both.

@jamestwebber
Copy link
Author

Apologies, I was trying to abstract the feature over different tracks while describing it which made the whole thing confusing. I'll break it up into a couple versions.

Filtering reads while displaying an alignment track

In a single-cell experiment we'll have reads from many different cells at a given locus. If I only want to look at the reads from a specific cell, I could make a new BAM that only has reads with a certain CB:Z tag (in 10x Genomics data, this is the cell barcode).

In the context of long-read transcriptomics, a common thing I've been doing is to look at the various transcripts predicted for a particular gene, and inspect the read support for each one. Sometimes the software will construct a "novel" transcript but a lot of evidence is ambiguous (like, a single exon) and we don't trust that so much.

There can be lots of transcripts in the constructed annotation, so it's useful to filter to only the specific isoform when inspecting it. Right now I make a new BAM file for that. Alternatively I can put the isoform assignment info into a BAM tag and sort on that tag, but the visualization is less clean because it will fit in other reads where it can.

Filtering transcripts from an annotation track

This is maybe more of a niche, but again relates to deriving novel transcript annotations from long-read data. Depending on the software used, there can be a lot of isoforms identified. I've found it useful to filter that down to the subset with a large number of counts (many isoforms are represented by a single read and I doubt they're real).

A filter tool could work in this context as well, if e.g. I customized the annotation file with additional metadata, to filter to isoforms with a count above some threshold. Or I could filter on the name to only look at known or novel isoforms.

I think the BAM filtering is more clearly useful, but I'm not familiar with the architecture of igv.js and thought it might be possible to build a more generic filtering widget.

@jrobinso
Copy link
Contributor

OK, got it. Filtering could be static, specified in the track configuration and applied when the file is read, or dynamic from a menu (as sorting or coloring is currently done). I assume dynamic would be more useful for your case, correct? Static might be easier to implement. Both are probably useful.

I'm just gather information, not sure when I will get to this.

@jamestwebber
Copy link
Author

Yeah dynamic would be best because we could look at multiple cases in the same session without reloading. But static is still nice, it's basically just replacing a manual step where I make the BAM myself.

I'm just gather information, not sure when I will get to this.

No worries! It's kind of a niche feature for sure but it'd be helpful for our visualization. I might look into the code myself to see if I can figure out where this could fit in, but I'm not a JS expert.

@jrobinso
Copy link
Contributor

There's another concept from IGV-desktop, not implemented in igv.js yet, that might be useful here -- grouping. Then you could group alignments, for example, by CB:Z or other tag.

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