graph-genome/Schematize

Change endBin behavior to be automatic

Closed this issue · 1 comments

Schematize should automatically show as much content as will fit on the screen given the current settings. The only user-settable parameter close to endBin should be a zoom level. Zoom (eventually) can be inferred from start-stop range. Removing endBin as a watched variable will simplify render triggers.

  • beginBin and endBin should be in a single array element so that they always update simultaneously.
  • Change endBin input widget to be read-only
  • switchChunkURLs takes one argument that is an array
  • openRelevantChunk reads in more than two chunks
  • rewrite loadSecondJson to work with an array
  • modify every reference to lastChunk to process an array
  • remove openRelevantChunk restriction on EndBin

Assignee: Eloi Durant has generated a PR on this issue, but it still needs work from someone else.

Implementation Details:

  • When the chunkURL array is updated, an observer triggers fetchAllChunks()
  • fetchAllChunks() dispatches one promised function call for each element in the array: jsonFetch for that URL
  • fetched data is placed in a new data structure:
    jsonCache = {chunk05: [json literal], chunk01: [json literal], chunk03: [json literal]}
  • Every time there's an update to the jsonCache, an observer (or a promised function call) trigger a check of the state in updateSchematicMetadata() which calls processArray()
    • the data must be processed in the order listed in chunkURLs from left to right. Starting at the first, process json into pre-render and keep proceeding right until you run into a chunk that hasn't been cached yet and stop
    • keep track of the index of the next chunk you're waiting on
    • A chunk arrival can trigger the processing of multiple chunks that had queued up behind it
    • It's possible that calling updateSchematicMetadata() does nothing when a far right chunk arrives but the upstream chunks haven't arrived yet.
    • Updates to the preRendered processArray() should cause rendering updates
  • If done well, the jsonCache doesn't need to be cleared when chunkURLs updates. Often this will be side to side scrolling with overlaps in the new and old chunks. You can simply fetch only the new chunks, drop the entire processArray result (which has the wrong x values now) and updateSchematicMetadata() from the existing jsonCache.
    • This has the side effect that scrolling to the right will be slightly faster than scrolling to the left, since the first chunk file will already be loaded in the browser when scrolling right.
    • jsonCache will gradually get bigger as it remembers all chunks ever seen. This will need to be purged based on some criteria of total size.

We're seeing serious performance issues in i22_chunk_url_array. One thing we'll change to fix this will be precomputing all component X values in bin2file.json ahead of time. graph-genome/component_segmentation#43