Skip to content

Commit

Permalink
feat: Upgrade to Gosling v0.9.31 (#137)
Browse files Browse the repository at this point in the history
* feat: Upgrade to Gosling v0.9.30

* feat: add gos.bed

* chore: bump gosling.js v0.9.31
  • Loading branch information
manzt authored Jun 12, 2023
1 parent 74f8b2d commit f9898ca
Show file tree
Hide file tree
Showing 8 changed files with 84 additions and 8 deletions.
1 change: 1 addition & 0 deletions doc/user_guide/API.rst
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ Low-Level Schema Wrappers
Assembly
AxisPosition
BamData
BedData
BeddbData
BigWigData
BinAggregate
Expand Down
1 change: 1 addition & 0 deletions gosling/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
from gosling.data import (
GoslingDataServer,
bam,
bed,
beddb,
bigwig,
csv,
Expand Down
1 change: 1 addition & 0 deletions gosling/data/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,7 @@ def json(values: list[dict[str, typing.Any]], **kwargs):
bam = _create_loader("bam")
csv = _create_loader("csv")
bigwig = _create_loader("bigwig")
bed = _create_loader("bed")

# tileset resources
beddb = _create_loader("beddb", tilesets.beddb)
Expand Down
4 changes: 2 additions & 2 deletions gosling/schema/__init__.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# flake8: noqa
from .core import *
from .channels import *
SCHEMA_VERSION = 'v0.9.29'
SCHEMA_URL = 'https://raw.githubusercontent.com/gosling-lang/gosling.js/v0.9.29/schema/gosling.schema.json'
SCHEMA_VERSION = 'v0.9.31'
SCHEMA_URL = 'https://raw.githubusercontent.com/gosling-lang/gosling.js/v0.9.31/schema/gosling.schema.json'
THEMES = {'dark', 'ensembl', 'excel', 'ggplot', 'google', 'igv', 'jbrowse', 'light', 'ucsc', 'warm', 'washu'}
42 changes: 38 additions & 4 deletions gosling/schema/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -174,9 +174,9 @@ def __init__(self, domain=Undefined, field=Undefined, legend=Undefined, range=Un
class DataDeep(GoslingSchema):
"""DataDeep schema wrapper
anyOf(:class:`JsonData`, :class:`CsvData`, :class:`BigWigData`, :class:`MultivecData`,
:class:`BeddbData`, :class:`VectorData`, :class:`MatrixData`, :class:`BamData`,
:class:`VcfData`)
anyOf(:class:`JsonData`, :class:`CsvData`, :class:`BedData`, :class:`BigWigData`,
:class:`MultivecData`, :class:`BeddbData`, :class:`VectorData`, :class:`MatrixData`,
:class:`BamData`, :class:`VcfData`)
"""
_schema = {'$ref': '#/definitions/DataDeep'}
_rootschema = GoslingSchema._rootschema
Expand Down Expand Up @@ -223,6 +223,39 @@ def __init__(self, indexUrl=Undefined, type=Undefined, url=Undefined, extractJun
maxInsertSize=maxInsertSize, **kwds)


class BedData(DataDeep):
"""BedData schema wrapper
Mapping(required=[type, url, indexUrl])
BED file format
Attributes
----------
indexUrl : string
Specify the URL address of the data file index.
type : string
url : string
Specify the URL address of the data file.
customFields : List(string)
An array of strings, where each string is the name of a non-standard field in the
BED file. If there are `n` custom fields, we assume that the last `n` columns of the
BED file correspond to the custom fields.
sampleLength : float
Specify the number of rows loaded from the URL.
__Default:__ `1000`
"""
_schema = {'$ref': '#/definitions/BedData'}
_rootschema = GoslingSchema._rootschema

def __init__(self, indexUrl=Undefined, type=Undefined, url=Undefined, customFields=Undefined,
sampleLength=Undefined, **kwds):
super(BedData, self).__init__(indexUrl=indexUrl, type=type, url=url, customFields=customFields,
sampleLength=sampleLength, **kwds)


class BeddbData(DataDeep):
"""BeddbData schema wrapper
Expand Down Expand Up @@ -309,7 +342,8 @@ class CsvData(DataDeep):
chromosomeField : string
Specify the name of chromosome data fields.
chromosomePrefix : string
experimental
Specify the chromosome prefix if chromosomes are denoted using a prefix besides
"chr" or a number
genomicFields : List(string)
Specify the name of genomic data fields.
genomicFieldsToConvert : List(Mapping(required=[chromosomeField, genomicFields]))
Expand Down
40 changes: 39 additions & 1 deletion gosling/schema/gosling-schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,41 @@
],
"type": "object"
},
"BedData": {
"additionalProperties": false,
"description": "BED file format",
"properties": {
"customFields": {
"description": "An array of strings, where each string is the name of a non-standard field in the BED file. If there are `n` custom fields, we assume that the last `n` columns of the BED file correspond to the custom fields.",
"items": {
"type": "string"
},
"type": "array"
},
"indexUrl": {
"description": "Specify the URL address of the data file index.",
"type": "string"
},
"sampleLength": {
"description": "Specify the number of rows loaded from the URL.\n\n__Default:__ `1000`",
"type": "number"
},
"type": {
"const": "bed",
"type": "string"
},
"url": {
"description": "Specify the URL address of the data file.",
"type": "string"
}
},
"required": [
"type",
"url",
"indexUrl"
],
"type": "object"
},
"BeddbData": {
"additionalProperties": false,
"description": "Regular BED or similar files can be pre-aggregated for the scalable data exploration. Find our more about this format at [HiGlass Docs](https://docs.higlass.io/data_preparation.html#bed-files).",
Expand Down Expand Up @@ -420,7 +455,7 @@
"type": "string"
},
"chromosomePrefix": {
"description": "experimental",
"description": "Specify the chromosome prefix if chromosomes are denoted using a prefix besides \"chr\" or a number",
"type": "string"
},
"genomicFields": {
Expand Down Expand Up @@ -495,6 +530,9 @@
{
"$ref": "#/definitions/CsvData"
},
{
"$ref": "#/definitions/BedData"
},
{
"$ref": "#/definitions/BigWigData"
},
Expand Down
1 change: 1 addition & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -63,3 +63,4 @@ features = ["dev", "all"]
test = "pytest --ignore gosling/examples --ignore tools/altair --doctest-modules gosling"
clean = "rm -rf doc/_build doc/user_guide/generated/ doc/gallery"
docs = "sphinx-build -b html doc dist"
generate-schema-wrapper = "python tools/generate_schema_wrapper.py"
2 changes: 1 addition & 1 deletion tools/generate_schema_wrapper.py
Original file line number Diff line number Diff line change
Expand Up @@ -411,7 +411,7 @@ def generate_mark_mixin(schemafile: pathlib.Path, mark_enum: str, style_def: str

def main(skip_download: Optional[bool] = False):
library = "gosling.js"
version = "v0.9.29"
version = "v0.9.31"

schemapath = here.parent / ".." / "gosling" / "schema"
schemafile = download_schemafile(
Expand Down

0 comments on commit f9898ca

Please sign in to comment.