Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix plugin verbosity #147

Open
wants to merge 9 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions .github/workflows/run-pytest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ jobs:
runs-on: ${{ matrix.os }}
strategy:
matrix:
python-version: [3.6, 3.9]
os: [ubuntu-latest, macos-latest]
python-version: ["3.8", "3.10"]
os: [ubuntu-latest]

steps:
- uses: actions/checkout@v2
Expand All @@ -26,10 +26,10 @@ jobs:
with:
python-version: ${{ matrix.python-version }}

- name: Install dev dependancies
- name: Install dev dependencies
run: if [ -f requirements/requirements-dev.txt ]; then pip install -r requirements/requirements-dev.txt; fi

- name: Install test dependancies
- name: Install test dependencies
run: if [ -f requirements/requirements-test.txt ]; then pip install -r requirements/requirements-test.txt; fi

- name: Install package
Expand Down
6 changes: 6 additions & 0 deletions docs/changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,12 @@

This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html) and [Keep a Changelog](https://keepachangelog.com/en/1.0.0/) format.

## [0.12.3] - 2024-10-10

### Fixed
- Reduce verbosity of refgenie plugin


## [0.12.2] - 2021-11-04

### Fixed
Expand Down
2 changes: 1 addition & 1 deletion refgenconf/_version.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__ = "0.12.2"
__version__ = "0.12.3"
8 changes: 4 additions & 4 deletions refgenconf/populator.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,14 +57,14 @@ def get_asset_tag(genome, asset):
return namespaces["project"]["refgenie"]["tag_overrides"][genome][asset]
except KeyError:
default_tag = rgc.get_default_tag(genome=genome, asset=asset)
_LOGGER.info(
_LOGGER.debug(
f"Refgenie asset ({genome}/{asset}) tag not specified in `refgenie.tag_overrides` section. "
f"Using the default tag: {default_tag}"
)
return default_tag
except TypeError:
default_tag = rgc.get_default_tag(genome=genome, asset=asset)
_LOGGER.warn(f"tag_overrides section is malformed. Using default.")
_LOGGER.warning(f"tag_overrides section is malformed. Using default.")
return default_tag

# Restructure the seek key paths to make them accessible with
Expand All @@ -78,7 +78,7 @@ def get_asset_tag(genome, asset):
try:
paths_dict[g][k] = v[tag]
except KeyError:
_LOGGER.warn(
_LOGGER.warning(
f"Can't find tag '{tag}' for asset '{g}/{k}', as specified in your project config. Using default."
)
paths_dict[g][k] = v[rgc.get_default_tag(genome=g, asset=k)]
Expand All @@ -97,7 +97,7 @@ def get_asset_tag(genome, asset):
except KeyError:
_LOGGER.debug("Did not find path_overrides section")
except TypeError:
_LOGGER.warn("Warning: path_overrides is not iterable")
_LOGGER.warning("Warning: path_overrides is not iterable")

# print(paths_dict)
# Provide these values under the 'refgenie' namespace
Expand Down
24 changes: 14 additions & 10 deletions refgenconf/refgenconf.py
Original file line number Diff line number Diff line change
Expand Up @@ -557,9 +557,11 @@ def get_symlink_paths(self, genome, asset=None, tag=None, all_aliases=False):
if asset:
tag = tag or self.get_default_tag(genome, asset)
return {
a: os.path.join(self.alias_dir, a, asset, tag)
if asset
else os.path.join(self.alias_dir, a)
a: (
os.path.join(self.alias_dir, a, asset, tag)
if asset
else os.path.join(self.alias_dir, a)
)
for a in alias
}

Expand Down Expand Up @@ -1128,9 +1130,9 @@ def list_seek_keys_values(self, genomes=None, assets=None):
tag_mapping = asset_mapping[CFG_ASSET_TAGS_KEY][tag_name]
ret[genome_name][asset_name][tag_name] = {}
for seek_key_name in get_tag_seek_keys(tag_mapping):
ret[genome_name][asset_name][tag_name][
seek_key_name
] = self.seek(genome_name, asset_name, tag_name, seek_key_name)
ret[genome_name][asset_name][tag_name][seek_key_name] = (
self.seek(genome_name, asset_name, tag_name, seek_key_name)
)
return ret

def get_local_data_str(self, genome=None, order=None):
Expand Down Expand Up @@ -1217,9 +1219,11 @@ def listr(
genomes = genome if isinstance(genome, list) else [genome]
if genome is not None:
genome_digests = [
g
if g in aliases_by_digest.keys()
else digests_by_alias.get(g, None)
(
g
if g in aliases_by_digest.keys()
else digests_by_alias.get(g, None)
)
for g in genomes
]
if genome_digests is None:
Expand Down Expand Up @@ -3139,7 +3143,7 @@ def _str2float(x):
size = "{0:f}GB".format(_str2float(size) / 1000)
if size.endswith("KB"):
# convert to gigs
size = "{0:f}GB".format(_str2float(size) / 1000 ** 2)
size = "{0:f}GB".format(_str2float(size) / 1000**2)
return size.endswith("TB") or (size.endswith("GB") and _str2float(size) > cutoff)


Expand Down
16 changes: 8 additions & 8 deletions refgenconf/refgenconf_v03.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
import sys
import urllib.request
import warnings
from collections import Iterable, Mapping, OrderedDict
from collections.abc import Iterable, Mapping
from functools import partial
from inspect import getfullargspec as finspect
from tempfile import TemporaryDirectory
Expand Down Expand Up @@ -223,7 +223,7 @@ def list(self, genome=None, order=None, include_tags=False):
)
if include_tags:
self.run_plugins(POST_LIST_HOOK)
return OrderedDict(
return dict(
[
(
g,
Expand All @@ -238,7 +238,7 @@ def list(self, genome=None, order=None, include_tags=False):
]
)
self.run_plugins(POST_LIST_HOOK)
return OrderedDict(
return dict(
[
(
g,
Expand Down Expand Up @@ -677,7 +677,7 @@ def listr(
:param list[str] | str genome: genomes that the assets should be found for
:param function(str) -> object order: how to key genome IDs and asset
names for sort
:return dict[OrderedDict[list]]: remotely available genomes and assets
:return dict[dict[list]]: remotely available genomes and assets
keyed by genome keyed by source server endpoint
"""
data_by_server = {}
Expand Down Expand Up @@ -1575,7 +1575,7 @@ def _invert_genomes(self, order=None):
asset ID.
:param function(str) -> object order: how to key genome IDs and asset
names for sort
:return OrderedDict[str, Iterable[str]] binding between asset kind/key/name
:return dict[str, Iterable[str]] binding between asset kind/key/name
and collection of reference genome assembly names for which the
asset type is available
"""
Expand All @@ -1584,7 +1584,7 @@ def _invert_genomes(self, order=None):
for a in am[CFG_ASSETS_KEY].keys():
genomes.setdefault(a, []).append(g)
assets = sorted(genomes.keys(), key=order)
return OrderedDict([(a, sorted(genomes[a], key=order)) for a in assets])
return dict([(a, sorted(genomes[a], key=order)) for a in assets])

def _chk_digest_if_avail(self, genome, remote_asset_name, server_url):
"""
Expand Down Expand Up @@ -1892,7 +1892,7 @@ def _str2float(x):
size = "{0:f}GB".format(_str2float(size) / 1000)
if size.endswith("KB"):
# convert to gigs
size = "{0:f}GB".format(_str2float(size) / 1000 ** 2)
size = "{0:f}GB".format(_str2float(size) / 1000**2)
return size.endswith("TB") or (size.endswith("GB") and _str2float(size) > cutoff)


Expand All @@ -1910,7 +1910,7 @@ def _list_remote(url, genome, order=None, as_str=True):
)
if not refgens:
return None, None if as_str else dict()
filtered_genomes_data = OrderedDict(
filtered_genomes_data = dict(
[(rg, sorted(genomes_data[rg], key=order)) for rg in refgens]
)
if not as_str:
Expand Down
26 changes: 13 additions & 13 deletions refgenconf/seqcol.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,17 +19,17 @@ def _schema_path(name):
return os.path.join(SCHEMA_FILEPATH, name)


CONTENT_ALL_A_IN_B = 2 ** 0
CONTENT_ALL_B_IN_A = 2 ** 1
LENGTHS_ALL_A_IN_B = 2 ** 2
LENGTHS_ALL_B_IN_A = 2 ** 3
NAMES_ALL_A_IN_B = 2 ** 4
NAMES_ALL_B_IN_A = 2 ** 5
CONTENT_A_ORDER = 2 ** 6
CONTENT_B_ORDER = 2 ** 7
CONTENT_ANY_SHARED = 2 ** 8
LENGTHS_ANY_SHARED = 2 ** 9
NAMES_ANY_SHARED = 2 ** 10
CONTENT_ALL_A_IN_B = 2**0
CONTENT_ALL_B_IN_A = 2**1
LENGTHS_ALL_A_IN_B = 2**2
LENGTHS_ALL_B_IN_A = 2**3
NAMES_ALL_A_IN_B = 2**4
NAMES_ALL_B_IN_A = 2**5
CONTENT_A_ORDER = 2**6
CONTENT_B_ORDER = 2**7
CONTENT_ANY_SHARED = 2**8
LENGTHS_ANY_SHARED = 2**9
NAMES_ANY_SHARED = 2**10

FLAGS = {
CONTENT_ALL_A_IN_B: "CONTENT_ALL_A_IN_B",
Expand Down Expand Up @@ -244,5 +244,5 @@ def explain_flag(flag):
"""Explains a compare flag"""
print(f"Flag: {flag}\nBinary: {bin(flag)}\n")
for e in range(0, 13):
if flag & 2 ** e:
print(FLAGS[2 ** e])
if flag & 2**e:
print(FLAGS[2**e])
1 change: 0 additions & 1 deletion requirements/requirements-test.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,5 @@ mock
pytest
pytest-cov
pytest-remotedata
git+git://github.com/databio/refgenie_myplugin@master#egg=refgenie_myplugin
tqdm
veracitools
7 changes: 3 additions & 4 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,9 @@
classifiers=[
"Development Status :: 4 - Beta",
"License :: OSI Approved :: BSD License",
"Programming Language :: Python :: 3.5",
"Programming Language :: Python :: 3.6",
"Programming Language :: Python :: 3.7",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Topic :: Scientific/Engineering :: Bio-Informatics",
],
license="BSD2",
Expand All @@ -48,6 +47,6 @@
["pytest-runner"] if {"test", "pytest", "ptr"} & set(sys.argv) else []
),
url="https://refgenie.databio.org",
author=u"Nathan Sheffield, Vince Reuter, Michal Stolarczyk",
author="Nathan Sheffield, Vince Reuter, Michal Stolarczyk",
**extra
)
1 change: 1 addition & 0 deletions tests/conftest.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
""" Test suite shared objects and setup """

import os
import random
import shutil
Expand Down
2 changes: 1 addition & 1 deletion tests/test_utils.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from collections import Mapping
from collections.abc import Mapping

import pytest

Expand Down
Loading