Skip to content

Conversation

sehilyi
Copy link
Member

@sehilyi sehilyi commented Apr 2, 2025

This PR implements the ability to specify a view to use a spatial layout. This allows the user to supply a "model" file that associates genomic regions with xyz coordinates in space.

Prototypical version of the editor with these capabilities is deployed at https://3d.gosling-lang.org

image

basic use

{
  "views": [
    {
      "layout": {
        "type": "spatial",
        "model": {
          "type": "csv",
          "url": "https://.../yeast_model.csv",
          "xyz": ["x", "y", "z"],
          "chromosome": "chr",
          "position": "coord"
        }
      },
      "tracks": [
        { /* ... */ }
      ]
    }
  ]
}

TODO (MVP)

When these are resolved, we should be able to merge

  • switch to using uchimata (+ use the new unified API)
    • fix: filtering only works on first refresh, not when switching to subsequent examples in the editor UI
  • fix types (pnpm build-types should run without issues)
  • Better solution for the hard-coded data.sampleLength = 30000 (in demo/renderer/main.ts, line ~163)

TODO (extras)

Document here but likely work on in separate PRs after merging this one

  • simple linking of views via synchronized camera

Change List

  • adds two new dependencies: uchimata, to facilitate rendering of 3D data; and flechette for working with Arrow IPC format.

Checklist

  • Ensure the PR works with all demos on the online editor
  • Unit tests added or updated
  • Examples added or updated
  • Documentation updated (e.g., added API functions)
  • Screenshots for visual changes (e.g., new encoding support or UI change on Editor)

@sehilyi sehilyi marked this pull request as draft April 2, 2025 18:38
@sehilyi sehilyi changed the title [draft] spatial layout spatial layout Apr 2, 2025
dvdkouril and others added 14 commits August 4, 2025 09:59
* feat: minimal join data transform

* chore: add a todo statement

* first working demo

* more work on bigwig join

* first demo to load bigwig and full chromosomes

* all d3 models drawn

* chore: remove console log statements and clean up code

* chore: fix typo in the comment statement

* chore: more clean up

* chore: compact axis

* fix: fix loading json-based track

* feat: grammar extension for 3D layout (#1136)

feat: better grammar extension for 3d vis
…e specs (#1139)

chore: move the 3d examples to the top; use the new grammar in examples
…options (#1140)

* feat: add a Yeast model example

* add thumbnail for yeast example

* make the yeast example the default

at least for now

---------

Co-authored-by: David Kouril <[email protected]>
* chore: minimal example

replaced the default (draft) thumbnail, also removed the very early example i used (with linked views) and the thumbnail

* chore: remove the multiple tracks example for now

still needs some implementation to be able to show that
* feat: remove data requirement for 3D tracks

* comment statement

* chore: update demo examples
…not specified (#1143)

* fix: parse genomic coordinates properly even if assembly is incorrectly defined

* remove console logs

* join correctly when there is only a single genomic field
* feat: add example of different coloring strategies

constant vs nominal vs quantitative

* chore: remove data fields in tracks since it's not needed anymore

* chore: change the default model for minimal to stevens

also reverted back to being really 'minimal'
… view (#1147)

* wip: combining multiple tracks within a single spatial view

very very bad so far, just a first checkpoint toward something sorta working

* feat: add a new example for superimposition

* wip: multiple overlaid track

* feat: (wip)example for composing multiple tracks within one spatial view

touches the join implementation a bit

* chore: remove computation of parent views

* chore: clean up of unused properties

* chore: clean up (log, unused var)

* chore: delete commented line

* chore: delete log and commented out line
@dvdkouril dvdkouril changed the title spatial layout feat: add capabilities for spatial layout type Aug 4, 2025
@dvdkouril dvdkouril added the v2 Issues related to Gosling v2 label Aug 4, 2025
@dvdkouril dvdkouril marked this pull request as ready for review October 9, 2025 13:26
@dvdkouril
Copy link
Member

@sehilyi Since you opened this PR, I can't assign you as reviewer. Could you take a look if there's anything critical that would prevent from merging this so that we can start using it in GD?

It's not perfect, but the CI checks are green, and we can iron out the other issues while working on the GD UI integration, since this will still end up in the alpha version of Gosling.

@sehilyi
Copy link
Member Author

sehilyi commented Oct 12, 2025

Thanks for letting me know - I somehow did not notice that the PR is ready to review. I will review this now and let you know here.

Comment on lines +457 to +464
spatial?: {
x: string;
y: string;
z: string;
chr: string;
coord: string;
};

Copy link
Member Author

@sehilyi sehilyi Oct 12, 2025

Choose a reason for hiding this comment

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

It makes sense to have this here, especially given the tight timeline.

But, given that we now have more layout options, and some of them have specialized properties (circular layouts also have some properties, like innerRadius), I think we should consider having more scoped types in the future. For example, several circular-specific properties are defined in CommonTrackDef that will also need to be moved out, in addition to locus and spatial, e.g.,

type SingleTrackBase = SingleTrackBaseLinear | SingleTrackBaseCircular | SingleTrackBaseSpatial;

Copy link
Member

Choose a reason for hiding this comment

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

Yea, I definitely took the easy way right now. Will be happy to revisit the types when there's some more time.

Copy link
Member Author

@sehilyi sehilyi left a comment

Choose a reason for hiding this comment

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

@dvdkouril I tested locally, and I can confirm that this works in VEC. Thanks for making this change - I'm excited to include this in our alpha version.

Please feel free to merge this when you feel ready. Also, after you merged it, can you try releasing a new alpha version based on the description I wrote on v2/CONTRIBUTING.md?

@dvdkouril dvdkouril merged commit b8f6d6d into v2 Oct 15, 2025
4 checks passed
@dvdkouril dvdkouril deleted the spatial branch October 15, 2025 15:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

v2 Issues related to Gosling v2

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants