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

Allow filtering for several chromosomes #3007

Merged
merged 54 commits into from
Feb 3, 2022
Merged

Allow filtering for several chromosomes #3007

merged 54 commits into from
Feb 3, 2022

Conversation

dnil
Copy link
Collaborator

@dnil dnil commented Nov 30, 2021

This PR adds a functionality or fixes a bug.

Fix #2971 part 1 (part 2 was solved in another PR).

How to test:

  1. how to test it, possibly with real cases/data

Expected outcome:
The functionality should be working
Take a screenshot and attach or copy/paste the output.

Review:

  • code approved by CR
  • tests executed by DN

@dnil dnil marked this pull request as draft November 30, 2021 14:49
@coveralls
Copy link

coveralls commented Nov 30, 2021

Coverage Status

Coverage decreased (-0.03%) to 83.591% when pulling f247772 on multi_chrom_select into b5917b7 on main.

@dnil
Copy link
Collaborator Author

dnil commented Nov 30, 2021

Ok, it now has the base functionalities:

  • filtering for multiple chr works
  • selectable coords are populated from all selected chr (though in honesty we can't really use that yet, so perhaps it is just bloat..)

I think I will call it a day here, but there are some open questions to consider, like how to treat the "All" option?

Screenshot 2021-11-30 at 16 22 04

Screenshot 2021-11-30 at 16 26 05

@dnil dnil marked this pull request as ready for review December 10, 2021 16:11
@dnil
Copy link
Collaborator Author

dnil commented Dec 10, 2021

This is more or less ready for review, but no rush. I might fix the complex function on a better time of day.. 😬

@northwestwitch
Copy link
Member

This is more or less ready for review, but no rush. I might fix the complex function on a better time of day.. 😬

I can review next week!

@codecov-commenter
Copy link

codecov-commenter commented Dec 20, 2021

Codecov Report

Merging #3007 (264f180) into main (92753c7) will decrease coverage by 0.03%.
The diff coverage is 50.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #3007      +/-   ##
==========================================
- Coverage   83.87%   83.84%   -0.04%     
==========================================
  Files         287      287              
  Lines       16474    16484      +10     
==========================================
+ Hits        13818    13821       +3     
- Misses       2656     2663       +7     
Impacted Files Coverage Δ
scout/adapter/mongo/query.py 83.80% <30.00%> (-2.33%) ⬇️
scout/server/blueprints/variants/controllers.py 73.86% <100.00%> (ø)
scout/server/blueprints/variants/forms.py 97.95% <100.00%> (ø)
scout/server/blueprints/variants/views.py 75.77% <100.00%> (+0.10%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 92753c7...264f180. Read the comment docs.

Copy link
Member

@northwestwitch northwestwitch left a comment

Choose a reason for hiding this comment

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

I have a few comments, pre-code review! :)

scout/server/blueprints/variants/forms.py Show resolved Hide resolved
scout/server/blueprints/variants/static/form_scripts.js Outdated Show resolved Hide resolved
scout/server/blueprints/variants/static/form_scripts.js Outdated Show resolved Hide resolved
scout/adapter/mongo/query.py Show resolved Hide resolved
@dnil
Copy link
Collaborator Author

dnil commented Jan 28, 2022

No rush, but this should be ready for re-review. I cleaned up the js to decrease complexity, and moved most to a macro, so while it looks like a lot of changes, this is mostly due to the moving of nearly identical scripts from all variantS pages to one macro.

@northwestwitch
Copy link
Member

I'll re-review now!

Copy link
Member

@northwestwitch northwestwitch left a comment

Choose a reason for hiding this comment

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

The functionality is improving but there are a couple of things to fix I think. The first one is described in my comment (having to manually deselect "All" when you select single chromosomes). This is not something that doesn't work, but an annoying thing that is not going to be appreciated I'm afraid.

One thing that doesn't work is populating the cytobands once you select single chromosomes, have you checked?

Consider using a jquery solution, you could avoid many lines of code and potential errors..

scout/server/blueprints/variants/static/form_scripts.js Outdated Show resolved Hide resolved
scout/server/blueprints/variants/static/form_scripts.js Outdated Show resolved Hide resolved
scout/adapter/mongo/query.py Show resolved Hide resolved
@@ -192,7 +192,7 @@ text{
}

]]></style>
<script type="text/javascript" xlink:href="javascript/madeline.js"></script>
<script type="text/javascript" xlink:href="/cases/static/madeline.js"></script>
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I just wanted to keep the console error free by default.. and this should be correct currently, though Im not so sure it is what cg does..

Copy link
Member

Choose a reason for hiding this comment

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

I'm not sure what that line does 🤔

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

It imports some scripts that the svg uses: init() is the one that gets called and reported missing on the console. We serve it as a static from scout, but I think the path might have changed in cg without that being reflected in scout. Regardless, this works, and removes an error when running demo data. The other part would need some investigation on a live case and an issue to cg.

@dnil
Copy link
Collaborator Author

dnil commented Feb 2, 2022

I think you will like this one! I swapped from the custom stuff to using the select picker databox select all.
Screenshot 2022-02-02 at 18 21 10
Let me just layout that on all the pages first.. 😅

Copy link
Member

@northwestwitch northwestwitch left a comment

Choose a reason for hiding this comment

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

Great improvement! Now it works perfectly and it's user-friendly as well!

I have a comment regarding what you pass to the mongo query function, that code-wise would be simpler to just pass a list, even when it contains only one chrom, but if you like it this way it'f fine by me!

Nice new functionality! 🥇

@@ -248,9 +247,19 @@ def build_query(
continue

if criterion == "chrom" and query.get("chrom"): # filter by coordinates
query_chrom = query.get("chrom")
if isinstance(query_chrom, list):
Copy link
Member

Choose a reason for hiding this comment

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

Wouldn't be easier to just pass a list here, also when there is only one chromosome?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

It would. The only thing is Im reluctant to put in the work to find all places it is called. Maybe I could use like pydantic to recast it. 😁

Copy link
Member

Choose a reason for hiding this comment

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

Maybe I could use like pydantic to recast it.

You could ask @mikaell that is very familiar with the library 🤣

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

If you don't mind I will leave it for another time. I reread the criterion, and it would only shorten that very slightly, as there still is a need for different coordinate handling for SNV and SV on one hand, and for single and multiple chromosomes, with the latter not consistent with start-end coordinates. Looking at it again, I realised we were missing "cancer" in there, so they were always going as SV-overlaps. Should improve performance a little!

Copy link
Collaborator Author

@dnil dnil Feb 3, 2022

Choose a reason for hiding this comment

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

To justify the laziness, the places to look for changes is not trivial. It's not just the forms, its all variants queries e.g.

query = {"chrom": "MT"}
. Also stored filters would be affected and would probably need resetting or script updating.

Copy link
Member

Choose a reason for hiding this comment

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

I don't mind! 😆

@@ -192,7 +192,7 @@ text{
}

]]></style>
<script type="text/javascript" xlink:href="javascript/madeline.js"></script>
<script type="text/javascript" xlink:href="/cases/static/madeline.js"></script>
Copy link
Member

Choose a reason for hiding this comment

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

I'm not sure what that line does 🤔

@dnil dnil merged commit 7e19c37 into main Feb 3, 2022
@northwestwitch northwestwitch deleted the multi_chrom_select branch February 4, 2022 07:00
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.

SVFilters
4 participants