Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Filter for tags in sam/bam track #3

Closed
wants to merge 7 commits into from
Closed

Conversation

baj12
Copy link

@baj12 baj12 commented May 29, 2012

Hi,

this fork of IGV introduces filtering to sam/bam tracks. I have added menu item in the right click menu of the sam/bam track under "Group alignment by" and before "Sort alignments by".

A new window will show. One can create as many filters as desired. The filters work only on the tags of SAM/BAM files (e.g. NM:i:2). One can search for numerical ranges, strings having wild cards, regular expressions or just match a given string. Missing values can also be excluded or included.

The procedure is as follows: The filters are being applied to each read from top to bottom. If a filter matches it is either excluded or included in the display, depending on the settings ("include alignments" or "exclude alignments". If a read does not match a filter, the next filter is applied. If no filter matches the read is being displayed.

One has to explicitly "create" and "apply" a filter AND also click "save filters" to use them otherwise they might get lost.

Obviously you will see that I am not a swing nor a JAVA expert, please feel free to optimize the design.

Currently, I have to move to a different region in the genome and then back to redraw the alignment as I don't know how to call the appropriate function from my filter class..

Hope this works for you and please feel free to send me any comments or suggestions...

Best,

Bernd

@jsilter
Copy link
Contributor

jsilter commented May 29, 2012

Thanks for contributing this. I do have some comments. From looking at the back end, I don't see too many problems. There are a few issues though:

  1. The UI doesn't look too friendly. I was thinking something like the "Filter Track" interface, you can see that in the "Tracks" -> Filter Tracks menu.
  2. The "WildcardMatcher" class is GPL, which isn't compatible with IGVs license (LPGL), so we would need a substitute.
  3. It would be better to delete code rather than comment it out, as the diffs will be more meaningful.

@baj12
Copy link
Author

baj12 commented May 30, 2012

Thanks for the comments:

1: agreed doesnt look nice and I will try to implement the Filter Tracks version
2: I will contact the author and see if he want to change this...
3: OK, will try to do in the future...

@baj12
Copy link
Author

baj12 commented May 30, 2012

I am just going through the code of the TrackFilter functionality and would really like to use that code. The only problem/concern I am having is that I would have to collect all available tags from all the displayed reads to populate the itemComboBox. This is done using the AttributeManager.getInstance().getAttributeNames() for the filterTracks...

Is there a similar function for tags? We can have a few million reads in a given window and I guess it would take some time to parse them or do you think I should try this?

Any comments/sugestions are more than welcome.

Thanks,
Bernd

@jsilter
Copy link
Contributor

jsilter commented May 30, 2012

It doesn't have to be exactly like the TrackFilter, you could have a text
entry box for tags. I don't believe there is a way to get all the tags, for
the sort/group/color options we have the user manually enter a tag.

-Jacob

On Wed, May 30, 2012 at 7:10 AM, baj12 <
reply@reply.github.com

wrote:

I am just going through the code of the TrackFilter functionality and
would really like to use that code. The only problem/concern I am having is
that I would have to collect all available tags from all the displayed
reads to populate the itemComboBox. This is done using the
AttributeManager.getInstance().getAttributeNames() for the filterTracks...

Is there a similar function for tags? We can have a few million reads in
a given window and I guess it would take some time to parse them or do you
think I should try this?

Any comments/sugestions are more than welcome.

Thanks,
Bernd


Reply to this email directly or view it on GitHub:
#3 (comment)

Jacob Silterra
Software Engineer
Broad Institute

baj12 and others added 3 commits May 31, 2012 17:24
still not finished
problems:
1. filters are not saved in session
2. tooltip doesn't show for reads anymore directly
3. need to reload data if filter is changed.
still not happy with the UI, should probably be a JTabble
but before working on this I would need to verify that the concept is working...
For this I need to know how to reload and repaint a track...
This seems to be too difficult for me to find out on my own...
Please advise!!!
thx
bernd
@baj12
Copy link
Author

baj12 commented Jun 5, 2012

Hi Jacob,

I updated the UI... I am still not very happy, but I would like to first
verify the functionality. For this I would need to know how to initiate
a re-reading for the data (SequenceTrack and CoverageTrack)... I looked
for quite some time but wasn't successful...
I would like to initiate a re-reading of the bam/sam file from within
the AlignmentTrack.java - FilterOptions class - selectedFilters. This
would also rebuild the coverageTrack, ideally...

Currently, I am seeing very strange behavior that doesn't seem to be
reproducible... Or at least it is not reacting as I expect it to behave...

Could you please point me to the right direction on how to implement
this? I tried using the repackAlignments but firstly it is not working
and secondly I am not even sure if I am looking the right neighborhood...

Thanks a lot for your kind help.

Bernd

On 30.05.2012 15:49, Jacob Silterra wrote:

It doesn't have to be exactly like the TrackFilter, you could have a text
entry box for tags. I don't believe there is a way to get all the tags, for
the sort/group/color options we have the user manually enter a tag.

-Jacob

On Wed, May 30, 2012 at 7:10 AM, baj12<
reply@reply.github.com

wrote:
I am just going through the code of the TrackFilter functionality and
would really like to use that code. The only problem/concern I am having is
that I would have to collect all available tags from all the displayed
reads to populate the itemComboBox. This is done using the
AttributeManager.getInstance().getAttributeNames() for the filterTracks...

Is there a similar function for tags? We can have a few million reads in
a given window and I guess it would take some time to parse them or do you
think I should try this?

Any comments/sugestions are more than welcome.

Thanks,
Bernd


Reply to this email directly or view it on GitHub:
#3 (comment)

@jsilter
Copy link
Contributor

jsilter commented Jun 5, 2012

I made some changes and pushed them to my fork at
https://github.com/jsilter/IGV/tree/baj12-master. Basic functionality is
the same. The version there updates viewed alignments when the filter is
changed the first time, although there are persistence issues (changing the
filter doesn't seem to work right)

I think soft filtering might be easier to start with, we may or may not
want to do that in the long run. Storing alignments but only displaying a
subset will be much faster when a user changes the filtering, but will
require much more memory. repackAlignments would be the thing to do, but
there is also repainting which needs to be done.

-Jacob

On Tue, Jun 5, 2012 at 5:39 AM, baj12 <
reply@reply.github.com

wrote:

Hi Jacob,

I updated the UI... I am still not very happy, but I would like to first
verify the functionality. For this I would need to know how to initiate
a re-reading for the data (SequenceTrack and CoverageTrack)... I looked
for quite some time but wasn't successful...
I would like to initiate a re-reading of the bam/sam file from within
the AlignmentTrack.java - FilterOptions class - selectedFilters. This
would also rebuild the coverageTrack, ideally...

Currently, I am seeing very strange behavior that doesn't seem to be
reproducible... Or at least it is not reacting as I expect it to behave...

Could you please point me to the right direction on how to implement
this? I tried using the repackAlignments but firstly it is not working
and secondly I am not even sure if I am looking the right neighborhood...

Thanks a lot for your kind help.

Bernd

On 30.05.2012 15:49, Jacob Silterra wrote:

It doesn't have to be exactly like the TrackFilter, you could have a text
entry box for tags. I don't believe there is a way to get all the tags,
for
the sort/group/color options we have the user manually enter a tag.

-Jacob

On Wed, May 30, 2012 at 7:10 AM, baj12<
reply@reply.github.com

wrote:
I am just going through the code of the TrackFilter functionality and
would really like to use that code. The only problem/concern I am
having is
that I would have to collect all available tags from all the displayed
reads to populate the itemComboBox. This is done using the
AttributeManager.getInstance().getAttributeNames() for the
filterTracks...

Is there a similar function for tags? We can have a few million reads
in
a given window and I guess it would take some time to parse them or do
you
think I should try this?

Any comments/sugestions are more than welcome.

Thanks,
Bernd


Reply to this email directly or view it on GitHub:
#3 (comment)


Reply to this email directly or view it on GitHub:
#3 (comment)

Jacob Silterra
Software Engineer
Broad Institute

@baj12
Copy link
Author

baj12 commented Feb 5, 2013

Hi,

after I have been distracted for quite some time from this project, it seems that it not be feasible for me to complete this task. Thus I would like to close/dismiss this pull request and leave this work to the people who know much more about this... ;)
Thanks for your kind help and maybe until later...

Best,

Bernd

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants