-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Co-authored-by: Brandon Duane Walker <[email protected]>
- Loading branch information
1 parent
07a9b3a
commit d436818
Showing
15 changed files
with
451 additions
and
0 deletions.
There are no files selected for viewing
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,29 @@ | ||
[bumpversion] | ||
current_version = 0.1.0 | ||
commit = False | ||
tag = False | ||
parse = (?P<major>\d+)\.(?P<minor>\d+)\.(?P<patch>\d+)(\-(?P<release>[a-z]+)(?P<dev>\d+))? | ||
serialize = | ||
{major}.{minor}.{patch}-{release}{dev} | ||
{major}.{minor}.{patch} | ||
|
||
[bumpversion:part:release] | ||
optional_value = _ | ||
first_value = dev | ||
values = | ||
dev | ||
_ | ||
|
||
[bumpversion:part:dev] | ||
|
||
[bumpversion:file:pyproject.toml] | ||
search = version = "{current_version}" | ||
replace = version = "{new_version}" | ||
|
||
[bumpversion:file:VERSION] | ||
|
||
[bumpversion:file:README.md] | ||
|
||
[bumpversion:file:plugin.json] | ||
|
||
[bumpversion:file:src/polus/mm/utils/check_linear_fit/__init__.py] |
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,4 @@ | ||
.venv | ||
out | ||
tests | ||
__pycache__ |
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 @@ | ||
poetry.lock |
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,5 @@ | ||
# CHANGELOG | ||
|
||
## 0.1.0 | ||
|
||
Initial release. |
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,22 @@ | ||
# docker build -f Dockerfile -t mrbrandonwalker/check_linear_fit . | ||
FROM condaforge/mambaforge | ||
|
||
ENV EXEC_DIR="/opt/executables" | ||
ENV POLUS_LOG="INFO" | ||
RUN mkdir -p ${EXEC_DIR} | ||
|
||
# Work directory defined in the base container | ||
# WORKDIR ${EXEC_DIR} | ||
|
||
COPY pyproject.toml ${EXEC_DIR} | ||
COPY VERSION ${EXEC_DIR} | ||
COPY README.md ${EXEC_DIR} | ||
COPY CHANGELOG.md ${EXEC_DIR} | ||
|
||
# Install needed packages here | ||
|
||
COPY src ${EXEC_DIR}/src | ||
|
||
RUN pip3 install ${EXEC_DIR} --no-cache-dir | ||
|
||
CMD ["--help"] |
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,17 @@ | ||
# check_linear_fit (0.1.0) | ||
|
||
check_linear_fit | ||
|
||
## Options | ||
|
||
This plugin takes 6 input arguments and 1 output argument: | ||
|
||
| Name | Description | I/O | Type | Default | | ||
|---------------|-------------------------|--------|--------|---------| | ||
| script | | Input | string | string | | ||
| xs | | Input | {'type': 'array', 'items': 'float'} | {'type': 'array', 'items': 'float'} | | ||
| ys | | Input | {'type': 'array', 'items': 'float'} | {'type': 'array', 'items': 'float'} | | ||
| tol_quad | | Input | float | float | | ||
| slope_min | | Input | float | float | | ||
| slope_max | | Input | float | float | | ||
| success | | Output | boolean | boolean | |
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 @@ | ||
0.1.0 |
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,59 @@ | ||
#!/usr/bin/env cwl-runner | ||
cwlVersion: v1.0 | ||
|
||
class: CommandLineTool | ||
|
||
label: check_linear_fit | ||
|
||
doc: |- | ||
check_linear_fit | ||
|
||
baseCommand: ["python", "-m", "polus.mm.utils.check_linear_fit"] | ||
|
||
requirements: | ||
DockerRequirement: | ||
dockerPull: mrbrandonwalker/check_linear_fit | ||
InlineJavascriptRequirement: {} | ||
|
||
inputs: | ||
|
||
xs: | ||
type: | ||
type: array | ||
items: float | ||
inputBinding: | ||
prefix: --xs | ||
|
||
ys: | ||
type: | ||
type: array | ||
items: float | ||
inputBinding: | ||
prefix: --ys | ||
|
||
tol_quad: | ||
type: float | ||
inputBinding: | ||
prefix: --tol_quad | ||
|
||
slope_min: | ||
type: float | ||
inputBinding: | ||
prefix: --slope_min | ||
|
||
slope_max: | ||
type: float | ||
inputBinding: | ||
prefix: --slope_max | ||
|
||
outputs: | ||
success: | ||
type: boolean | ||
outputBinding: | ||
outputEval: $(true) # If check_linear_fit.py didn't call sys.exit(1), then it called sys.exit(0) | ||
|
||
$namespaces: | ||
edam: https://edamontology.org/ | ||
|
||
$schemas: | ||
- https://raw.githubusercontent.com/edamontology/edamontology/master/EDAM_dev.owl |
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,69 @@ | ||
specVersion: "0.1.0" | ||
name: check_linear_fit | ||
version: 0.1.0 | ||
container: check-linear-fit-tool | ||
entrypoint: | ||
title: check_linear_fit | ||
description: check_linear_fit | ||
author: Data Scientist | ||
contact: [email protected] | ||
repository: | ||
documentation: | ||
citation: | ||
|
||
inputs: | ||
- name: script | ||
required: true | ||
description: | ||
type: string | ||
defaultValue: /check_linear_fit.py | ||
- name: xs | ||
required: true | ||
description: | ||
type: {'type': 'array', 'items': 'float'} | ||
- name: ys | ||
required: true | ||
description: | ||
type: {'type': 'array', 'items': 'float'} | ||
- name: tol_quad | ||
required: true | ||
description: | ||
type: float | ||
- name: slope_min | ||
required: true | ||
description: | ||
type: float | ||
- name: slope_max | ||
required: true | ||
description: | ||
type: float | ||
outputs: | ||
- name: success | ||
required: true | ||
description: | ||
type: boolean | ||
ui: | ||
- key: inputs.script | ||
title: "script: " | ||
description: "" | ||
type: string | ||
- key: inputs.xs | ||
title: "xs: " | ||
description: "" | ||
type: {'type': 'array', 'items': 'float'} | ||
- key: inputs.ys | ||
title: "ys: " | ||
description: "" | ||
type: {'type': 'array', 'items': 'float'} | ||
- key: inputs.tol_quad | ||
title: "tol_quad: " | ||
description: "" | ||
type: float | ||
- key: inputs.slope_min | ||
title: "slope_min: " | ||
description: "" | ||
type: float | ||
- key: inputs.slope_max | ||
title: "slope_max: " | ||
description: "" | ||
type: float |
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,33 @@ | ||
[tool.poetry] | ||
name = "polus-mm-utils-check-linear-fit" | ||
version = "0.1.0" | ||
description = "check_linear_fit" | ||
authors = ["Data Scientist <[email protected]>"] | ||
readme = "README.md" | ||
packages = [{include = "polus", from = "src"}] | ||
|
||
[tool.poetry.dependencies] | ||
python = ">=3.9,<3.12" | ||
typer = "^0.7.0" | ||
cwl-utils = "0.33" | ||
cwltool = "3.1.20240404144621" | ||
numpy = "1.26.4" | ||
scipy = "1.13.0" | ||
|
||
[tool.poetry.group.dev.dependencies] | ||
bump2version = "^1.0.1" | ||
pytest = "^7.4" | ||
pytest-sugar = "^0.9.6" | ||
pre-commit = "^3.2.1" | ||
black = "^23.3.0" | ||
mypy = "^1.1.1" | ||
ruff = "^0.0.270" | ||
|
||
[build-system] | ||
requires = ["poetry-core"] | ||
build-backend = "poetry.core.masonry.api" | ||
|
||
[tool.pytest.ini_options] | ||
pythonpath = [ | ||
"." | ||
] |
7 changes: 7 additions & 0 deletions
7
utils/fitting/check-linear-fit-tool/src/polus/mm/utils/check_linear_fit/__init__.py
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,7 @@ | ||
"""check_linear_fit.""" | ||
|
||
__version__ = "0.1.0" | ||
|
||
from polus.mm.utils.check_linear_fit.check_linear_fit import ( # noqa # pylint: disable=unused-import | ||
check_linear_fit, | ||
) |
71 changes: 71 additions & 0 deletions
71
utils/fitting/check-linear-fit-tool/src/polus/mm/utils/check_linear_fit/__main__.py
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,71 @@ | ||
"""Package entrypoint for the check_linear_fit package.""" | ||
|
||
# Base packages | ||
import logging | ||
import sys | ||
from os import environ | ||
|
||
import typer | ||
from polus.mm.utils.check_linear_fit.check_linear_fit import check_linear_fit | ||
|
||
logging.basicConfig( | ||
format="%(asctime)s - %(name)-8s - %(levelname)-8s - %(message)s", | ||
datefmt="%d-%b-%y %H:%M:%S", | ||
) | ||
POLUS_LOG = getattr(logging, environ.get("POLUS_LOG", "INFO")) | ||
logger = logging.getLogger("polus.mm.utils.check_linear_fit.") | ||
logger.setLevel(POLUS_LOG) | ||
|
||
app = typer.Typer(help="check_linear_fit.") | ||
|
||
|
||
@app.command() | ||
def main( | ||
xs: list[float] = typer.Option( | ||
..., | ||
"--xs", | ||
help="", | ||
), | ||
ys: list[float] = typer.Option( | ||
..., | ||
"--ys", | ||
help="", | ||
), | ||
tol_quad: float = typer.Option( | ||
..., | ||
"--tol_quad", | ||
help="", | ||
), | ||
slope_min: float = typer.Option( | ||
..., | ||
"--slope_min", | ||
help="", | ||
), | ||
slope_max: float = typer.Option( | ||
..., | ||
"--slope_max", | ||
help="", | ||
), | ||
) -> None: | ||
"""check_linear_fit.""" | ||
logger.info(f"xs: {xs}") | ||
logger.info(f"ys: {ys}") | ||
logger.info(f"tol_quad: {tol_quad}") | ||
logger.info(f"slope_min: {slope_min}") | ||
logger.info(f"slope_max: {slope_max}") | ||
|
||
is_linear_and_within_bounds = check_linear_fit( | ||
xs=xs, | ||
ys=ys, | ||
tol_quad=tol_quad, | ||
slope_min=slope_min, | ||
slope_max=slope_max, | ||
) | ||
if is_linear_and_within_bounds: | ||
sys.exit(0) | ||
else: | ||
sys.exit(1) | ||
|
||
|
||
if __name__ == "__main__": | ||
app() |
Oops, something went wrong.