visibility_lt (or other visibility functions) will not accept "zoomLevel" as a "measure" argument
sapoudel opened this issue · 2 comments
In the gosling website, there is an example of setting up visibility based on zoomLevel
instead of width|height.
If I try to set the visibility by passing zoomLevel
to the measure
parameter, I get schema validation error.
seq_info = seq_track.mark_text(
).encode(
text=gos.Text("seq:N"),
color=gos.value("black"),
stroke=gos.value("white"),
strokeWidth=gos.value(3),
x=gos.X("start:G", linkingId='detail-1'),
xe="end:G",
row=gos.value(80)
).visibility_le(
target="mark",
measure="zoomLevel",
threshold=10000,
transitionPadding=5,
)
The code above gives:
SchemaValidationError: Invalid specification
gosling.schema.core.VisibilityCondition->0->measure, validating 'enum'
'zoomLevel' is not one of ['width', 'height']
However, I can pass width
as a measure
which passes the schema validation, then manually edit the json to zoomLevel
and it will give me the exact behavior I am expecting i.e. mark appears when the zoomLevel is at < 10,000 bp. It would be nice to be able to use the function to set measure
as zoomLevel
instead of setting it up manually.
Hi @sapoudel,
It's odd that you are confronting the schema error. Unless you are using the |xe-x|
threshold, it should pass the schema validation. We have working demos on gos
documentation (https://gosling-lang.github.io/gos/gallery/multiscale_lollipop_plot.html?highlight=zoomlevel) and Google Colab Notebook (https://colab.research.google.com/github/gosling-lang/gos-example/blob/main/notebooks/clinvar.ipynb#scrollTo=2625018b) that uses zoomLevel
.
Could you share your Gos version as well as the full Gos code with the error?
Hey @sehilyi,
The gosling version might be the issue! I am currently using version:
gosling 0.0.11 pypi_0 pypi
gosling-widget 0.0.2 pypi_0 pypi
I am using this version due to issue #102 regarding non-human data which @manzt put together a quick fix for. If that has been pushed to main/latest version I will switch over. Thanks!