broadinstitute / genetic-prevalence-estimator

https://genie.broadinstitute.org/
BSD 3-Clause "New" or "Revised" License
1 stars 0 forks source link

Save which variants are selected in a variant list #89

Open nawatts opened 2 years ago

nawatts commented 2 years ago

So that multiple people can collaborate on a shared variant list.

sambaxter commented 1 year ago

When I tested this out it seems like the default is for none of the variants to be included. When I went into old lists all the variants were unchecked, and then when I created a new list they were all selected, but if I closed the list and reopened they were all unselected. The default should be to include all until someone unselects a variant.

When I first created the list: image (18)

After I reloaded the list: image

nawatts commented 1 year ago

When the variant list becomes ready, the UI auto selects all its variants. But it doesn't save that.

https://github.com/broadinstitute/genetic-prevalence-estimator/blob/a12d0ee665d6d57c5d650350ed760ba5048e5ff9/frontend/src/components/VariantListPage/VariantListPage.tsx#L110-L121

Also, if the variant list is ready when the annotation is created, it should be created with all variant selected. This would help users besides the list creator who get access to the variant list after it's already created.

https://github.com/broadinstitute/genetic-prevalence-estimator/blob/a12d0ee665d6d57c5d650350ed760ba5048e5ff9/website/src/website/views/variant_list_views.py#L175-L178

There's still a gap if a user views the variant list (which would create the annotation) before it's ready and then closes the UI before it's ready. Maybe the worker should update annotations for all users the list is shared with? Though that also gets complicated if the list is being reprocessed (we probably wouldn't want to clear users' settings then).

sambaxter commented 1 year ago

This is still an issue, but only when the variants are loading. When I tried adding variants to an existing list it seemed to have issues recalculating and stuck the loading page. I reloaded the page and the variants were there but deselected. I also navigated off a page while a list was being generated and when I re-click on the list variants were all there but deselected. I get why this might be coming up if the user reloads the page while the variants are being added or the list is being generated. Should we add a warning saying "if you reload or close this page while the variants are being added this could result in the variants being added to the list but de-selected from being included in the calculations?"

nawatts commented 1 year ago

There are still a few gaps (described in https://github.com/broadinstitute/genetic-prevalence-estimator/issues/89#issuecomment-1458311004) where the variants won't be auto-selected. The one a variant list creator is likely to encounter is if they don't have the variant list page open when the variant list becomes ready (either because they navigated away or reloaded the page between when the variant list actually became ready and the frontend polled its status). That can be resolved by having the worker update the annotation record in the database.