Skip to content

Commit

Permalink
Merge branch 'develop' into rjchallis/issue44
Browse files Browse the repository at this point in the history
  • Loading branch information
rjchallis committed Apr 8, 2021
2 parents b03e3ca + f8897a0 commit dd1bf3c
Show file tree
Hide file tree
Showing 24 changed files with 1,126 additions and 419 deletions.
9 changes: 5 additions & 4 deletions .bumpversion.cfg
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
[bumpversion]
current_version = 2.0.5
current_version = 2.0.7
commit = True
tag = True
message = 'Bump version: {current_version} → {new_version}'
tag_name = {new_version}
message = "Bump version: {current_version} → {new_version}"

[bumpversion:file:setup.py]
search = version="{current_version}"
Expand All @@ -13,8 +14,8 @@ search = version = "{current_version}"
replace = version = "{new_version}"

[bumpversion:file:README.rst]
search = v{current_version}.
replace = v{new_version}.
search = {current_version}.
replace = {new_version}.

[bumpversion:file:docs/conf.py]
search = version = release = "{current_version}"
Expand Down
4 changes: 2 additions & 2 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,9 @@ GenomeHubs
:alt: Conda platforms
:target: https://anaconda.org/tolkit/genomehubs

.. |commits-since| image:: https://img.shields.io/github/commits-since/genomehubs/genomehubs/v2.0.5.svg
.. |commits-since| image:: https://img.shields.io/github/commits-since/genomehubs/genomehubs/2.0.7.svg
:alt: Commits since latest release
:target: https://github.com/genomehubs/genomehubs/compare/v2.0.5...main
:target: https://github.com/genomehubs/genomehubs/compare/2.0.7...main

.. |license| image:: https://anaconda.org/tolkit/genomehubs/badges/license.svg
:alt: MIT License
Expand Down
4 changes: 2 additions & 2 deletions conda-recipe/meta.yaml
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
{% set name = "genomehubs" %}
{% set version = "2.0.5" %}
{% set version = "2.0.7" %}

package:
name: {{ name }}
version: {{ version }}

source:
git_rev: v{{ version }}
git_rev: {{ version }}
git_url: https://github.com/genomehubs/genomehubs.git

build:
Expand Down
2 changes: 1 addition & 1 deletion docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
version = release = get_distribution("genomehubs").version
except Exception:
traceback.print_exc()
version = release = "2.0.5"
version = release = "2.0.7"

pygments_style = "trac"
templates_path = ["."]
Expand Down
2 changes: 1 addition & 1 deletion scripts/conda_build.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/usr/bin/env bash

VERSION=2.0.5
VERSION=2.0.7

case $(uname | tr '[:upper:]' '[:lower:]') in
linux*)
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ def read(*names, **kwargs):

setup(
name="genomehubs", # Required
version="2.0.5",
version="2.0.7",
description="GenomeHubs", # Optional
long_description="%s\n%s"
% (
Expand Down
50 changes: 32 additions & 18 deletions src/genomehubs/lib/attributes.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,42 +12,56 @@
LOGGER = tolog.logger(__name__)


def index_template(opts):
def index_template(opts, *, index_type="attribute"):
"""Index template (includes name, mapping and types)."""
parts = ["attributes", opts["hub-name"], opts["hub-version"]]
parts = ["%ss" % index_type, opts["hub-name"], opts["hub-version"]]
template = index_templator(parts, opts)
return template


def stream_attributes(group, attributes):
def stream_attributes(group, attributes, *, index_type="attribute"):
"""Stream attributes for indexing."""
for name, obj in attributes.items():
ret = {"group": group, "name": name}
for prop, value in obj.items():
if not prop.startswith("taxon_"):
ret.update({prop: value})
yield "attribute-%s-%s" % (group, name), ret
yield "%s-%s-%s" % (index_type, group, name), ret


def index(es, group, attributes, opts):
"""Index a set of attributes."""
LOGGER.info("Indexing attributes")
template = index_template(opts)
stream = stream_attributes(group, attributes)
def index(es, group, attributes, opts, *, index_type="attribute"):
"""Index a set of attributes or names."""
LOGGER.info("Indexing %s" % index_type)
template = index_template(opts, index_type=index_type)
stream = stream_attributes(group, attributes, index_type=index_type)
return template, stream


def index_types(es, types_name, types, opts):
"""Index types into Elasticsearch."""
if "attributes" not in types:
return
if "defaults" in types:
for key, value in types["attributes"].items():
value = {**types["defaults"]["attributes"], **value}
types["attributes"][key] = value
template, stream = index(es, types_name, types["attributes"], opts)
load_mapping(es, template["name"], template["mapping"])
index_stream(es, template["index_name"], stream)
if "attributes" in types:
if "defaults" in types and "attributes" in types["defaults"]:
for key, value in types["attributes"].items():
value = {**types["defaults"]["attributes"], **value}
types["attributes"][key] = value
template, stream = index(
es, types_name, types["attributes"], opts, index_type="attribute"
)
load_mapping(es, template["name"], template["mapping"])
index_stream(es, template["index_name"], stream)
if "taxon_names" in types:
if "defaults" in types and "taxon_names" in types["defaults"]:
for key, value in types["names"].items():
value = {
**types["defaults"]["taxon_names"],
**value,
}
types["taxon_names"][key] = value
template, stream = index(
es, types_name, types["taxon_names"], opts, index_type="identifier"
)
load_mapping(es, template["name"], template["mapping"])
index_stream(es, template["index_name"], stream)


def fetch_types(es, types_name, opts):
Expand Down
2 changes: 1 addition & 1 deletion src/genomehubs/lib/btk.py
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ def describe_btk_files(meta):
return files


def btk_parser(_params, opts):
def btk_parser(_params, opts, *args, **kwargs):
"""Parse BlobToolKit assemblies."""
parsed = []
analyses = []
Expand Down

0 comments on commit dd1bf3c

Please sign in to comment.