-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
8 changed files
with
87 additions
and
48 deletions.
There are no files selected for viewing
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,2 @@ | ||
"""Module init""" | ||
from .version import VERSION, VERSION_SHORT |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
#!/usr/bin/env python | ||
"""Defines CLI and main execution entrypoint to enable easier import | ||
of key classes directly into other scripts""" | ||
|
||
import argparse | ||
from .utils import check_file_exists, initialise_logger | ||
|
||
def generate_cli(): | ||
""" | ||
Create the CLI interface for the AST entrypoint | ||
""" | ||
parser = argparse.ArgumentParser( | ||
description="Converts antibiotic susceptibility " | ||
"testing data to INSDC standardised format" | ||
) | ||
|
||
# takes input file and confirms it exists | ||
parser.add_argument("input_file", help="The input file to convert", type=check_file_exists) | ||
parser.add_argument( | ||
"-f", "--format", help="Origin of input file", required=True, choices=["VITEK"] | ||
) | ||
parser.add_argument("-o", "--output", help="The output file destination") | ||
return parser | ||
|
||
|
||
def main(): | ||
""" | ||
CLI entrypoint | ||
""" | ||
parser = generate_cli() | ||
args = parser.parse_args() | ||
|
||
if not args.output: | ||
args.output = args.input_file.with_suffix(".insdc.csv") | ||
|
||
logger = initialise_logger() | ||
|
||
logger.info(f"Converting {args.input_file} as {args.format} to INSDC {args.output}") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
#!/usr/bin/env python | ||
|
||
# implement parent convast class including linkml output |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
"""General utility functions for convast""" | ||
from pathlib import Path | ||
import logging | ||
import argparse | ||
|
||
|
||
def check_file_exists(file_path): | ||
""" | ||
Check if a given filepath exists | ||
""" | ||
file_path = Path(file_path) | ||
if not file_path.exists(): | ||
raise argparse.ArgumentTypeError(f"{file_path} does not exist") | ||
return file_path | ||
|
||
|
||
def initialise_logger(): | ||
""" | ||
Initialise the logger to stderr | ||
""" | ||
logging.basicConfig( | ||
level=logging.INFO, | ||
format="%(asctime)s-%(levelname)s: %(message)s", | ||
datefmt="%Y-%m-%d %H:%M:%S", | ||
) | ||
logger = logging.getLogger(__name__) | ||
return logger |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,51 +3,41 @@ requires = ["setuptools", "wheel"] | |
build-backend = "setuptools.build_meta" | ||
|
||
[project] | ||
# See https://setuptools.pypa.io/en/latest/userguide/quickstart.html for more project configuration options. | ||
name = "my-package" | ||
name = "convast" | ||
dynamic = ["version"] | ||
readme = "README.md" | ||
classifiers = [ | ||
"Intended Audience :: Science/Research", | ||
"Development Status :: 3 - Alpha", | ||
"License :: OSI Approved :: Apache Software License", | ||
"Programming Language :: Python :: 3", | ||
"Topic :: Scientific/Engineering :: Artificial Intelligence", | ||
] | ||
authors = [ | ||
{name = "Allen Institute for Artificial Intelligence", email = "[email protected]"} | ||
] | ||
{name = "Finlay Maguire", email = "[email protected]"}, | ||
{name = "Amos Raphenya", email = "[email protected]"},] | ||
requires-python = ">=3.8" | ||
dependencies = [ | ||
# Add your own dependencies here | ||
] | ||
license = {file = "LICENSE"} | ||
|
||
[project.scripts] | ||
convast = "convast.cli:main" | ||
|
||
[project.urls] | ||
Homepage = "https://github.com/allenai/python-package-template" | ||
Repository = "https://github.com/allenai/python-package-template" | ||
Changelog = "https://github.com/allenai/python-package-template/blob/main/CHANGELOG.md" | ||
Homepage = "https://github.com/pha4ge/convast" | ||
Repository = "https://github.com/pha4ge/convast" | ||
Changelog = "https://github.com/pha4ge/convast/blob/main/CHANGELOG.md" | ||
# Documentation = "https://my-package.readthedocs.io/" | ||
|
||
[project.optional-dependencies] | ||
dev = [ | ||
"ruff", | ||
"mypy>=1.0,<1.5", | ||
"black>=23.0,<24.0", | ||
"isort>=5.12,<5.13", | ||
"pytest", | ||
"pytest-sphinx", | ||
"pytest-cov", | ||
"twine>=1.11.0", | ||
"build", | ||
"setuptools", | ||
"wheel", | ||
"Sphinx>=4.3.0,<7.1.0", | ||
"furo==2023.7.26", | ||
"myst-parser>=1.0,<2.1", | ||
"sphinx-copybutton==0.5.2", | ||
"sphinx-autobuild==2021.3.14", | ||
"sphinx-autodoc-typehints==1.23.3", | ||
"packaging" | ||
] | ||
|
||
|
@@ -57,18 +47,13 @@ exclude = [ | |
"*.tests.*", | ||
"tests.*", | ||
"tests", | ||
"docs*", | ||
"scripts*" | ||
] | ||
|
||
[tool.setuptools] | ||
include-package-data = true | ||
|
||
[tool.setuptools.package-data] | ||
my_package = ["py.typed"] | ||
|
||
[tool.setuptools.dynamic] | ||
version = {attr = "my_package.version.VERSION"} | ||
version = {attr = "convast.version.VERSION"} | ||
|
||
[tool.black] | ||
line-length = 100 | ||
|
@@ -86,35 +71,22 @@ exclude = ''' | |
) | ||
''' | ||
|
||
[tool.isort] | ||
profile = "black" | ||
multi_line_output = 3 | ||
|
||
# You can override these pyright settings by adding a personal pyrightconfig.json file. | ||
[tool.pyright] | ||
reportPrivateImportUsage = false | ||
|
||
[tool.ruff] | ||
line-length = 115 | ||
target-version = "py39" | ||
|
||
[tool.ruff.per-file-ignores] | ||
"__init__.py" = ["F401"] | ||
|
||
[tool.mypy] | ||
ignore_missing_imports = true | ||
no_site_packages = true | ||
check_untyped_defs = true | ||
|
||
[[tool.mypy.overrides]] | ||
module = "tests.*" | ||
strict_optional = false | ||
[tool.pylint.'MESSAGES CONTROL'] | ||
max-line-length = 115 | ||
disable = """ | ||
logging-fstring-interpolation | ||
""" | ||
|
||
[tool.pytest.ini_options] | ||
testpaths = "tests/" | ||
python_classes = [ | ||
"Test*", | ||
"*Test" | ||
] | ||
log_format = "%(asctime)s - %(levelname)s - %(name)s - %(message)s" | ||
log_level = "DEBUG" |
This file was deleted.
Oops, something went wrong.