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

Make the left and right buttons go to the previous/next BED region when a BED file is selected #354

Closed
adamnovak opened this issue Oct 11, 2023 · 4 comments · Fixed by #387
Assignees

Comments

@adamnovak
Copy link
Member

If a BED subregion contains a tracks.json that doesn't point at files the server is allowed to use (because e.g. it was extracted from a larger graph that is not available on the web), we should figure this out and stop the user from trying to use that file.

For example, we should turn off the left and right buttons, because we know we won't be able to fetch a different set of coordinates (or we could make them go left/right to the next/previous region in the BED file).

We should also stop the user from going to coordinates not represented in the BED with a premade chunk, if they don't actually have a set of tracks that we could fetch the region from.

(Maybe we want to handle this by allowing empty/null track files in tracks.json in a BED region? Then we can use null by default in the extraction scripts, and you could make sure to fill in the paths manually if you want a BED with pre-extracted regions but also a real backing graph.)

@adamnovak adamnovak converted this from a draft issue Oct 11, 2023
@adamnovak
Copy link
Member Author

I need to add a sequence of steps that can be used to reproduce this issue before it can actually be fixed.

@adamnovak
Copy link
Member Author

To reproduce this issue:

  1. Pull in changes from the master branch now that Add example needed to reproduce panning issue (without crashing) #375 is merged.
  2. Start the tube map.
  3. Set Data to custom.
  4. Set BED file to no_source.bed.
  5. Set Region to ref:2000-3000.
  6. Click Go.
  7. Click the left button or the right button.

You will get an error:

vg chunk failed: error:[vg chunk] unable to load graph / xg index file exampleData/nonexistent.vg 

Instead of letting this happen, we should probably look in the BED file for a next or previous region, and jump to that instead. In this particular BED file there is just one region, so we should grey out the next/previous buttons since we are at the first region and we are at the last region.

We also get the same error if, having visited ref:2000-3000, you type some other region manually like ref:123-456 and hit Go. Instead of letting the server complain that the graph file doesn't exist, we might want to somehow know that there's no full backing graph and disable free region entry, and make you pick from the available regions. To make that work, we might have to change the tracks.json format a little bit, and maybe use an empty track filename or something when the full graph isn't meant to be available, and then detect that and change the region select behavior.

@adamnovak adamnovak changed the title Disable left and right buttons and free region selection when viewing a BED region that doesn't have real tracks Make the left and right buttons go to the previous/next BED region when a BED file is selected Dec 5, 2023
@adamnovak
Copy link
Member Author

The BED regions are stored in the state here:

// This tracks several arrays of BED region data, stored by data type, with
// one entry in each array per region.
regionInfo: {},

We need to add a better comment, but this holds desc, chr, start, and end arrays. Each of them holds the corresponding property for each region, numbered 0 to however many regions there are. So this.state.regionInfo["chr"][5] is the contig name (like ref or chr1) for region 5 in the BED file.

We would want to see if a region from the BED is selected by matching the region field against the regions (maybe with the same logic we use to know to show the tooltip description), and move to the next region in the file. (Maybe by incrementing/decrementing the index, but we could also try and do a search in genome coordinates.)

Maybe we should lift some code out of RegionInput and being it up to HeaderForm to help with this.

@adamnovak
Copy link
Member Author

For implementation, so far we have a function from region string to index in the collection of available regions, if present.

The buttons need to:

  1. Go from current region string to region index number (with function that is written)
  2. Increment or decrement it as appropriate (unless the region wasn't in the list, in which case we use the existing behavior of adjusting the region coordinates and trying to go to those coordinates)
  3. Get the region string for that number (new function)
  4. Plug that in to the region field
  5. Re-render with the new region

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

Successfully merging a pull request may close this issue.

2 participants