3 Commits

Author SHA1 Message Date
48905f968f Fixed scheme name argument not converting to ID
All checks were successful
automlst.cli/pipeline/tag This commit looks good
automlst.cli/pipeline/head This commit looks good
Added additional error messages to help user with usage.
2025-02-27 04:55:43 +00:00
d9a16de97e Merge branch 'main' into develop
All checks were successful
automlst.cli/pipeline/tag This commit looks good
automlst.cli/pipeline/head This commit looks good
2025-02-26 15:25:23 +00:00
19b23539b3 Added bioconda and personal conda repos to channels
Some checks reported errors
automlst.cli/pipeline/head Something is wrong with the build of this commit
2025-02-26 15:22:32 +00:00
5 changed files with 44 additions and 10 deletions

16
.devcontainer/Dockerfile Normal file
View File

@@ -0,0 +1,16 @@
FROM mcr.microsoft.com/devcontainers/miniconda:1-3
# Copy environment.yml (if found) to a temp location so we update the environment. Also
# copy "noop.txt" so the COPY instruction does not fail if no environment.yml exists.
COPY environment.yml* .devcontainer/noop.txt /tmp/conda-tmp/
RUN if [ -f "/tmp/conda-tmp/environment.yml" ]; then umask 0002 && /opt/conda/bin/conda env update -n base -f /tmp/conda-tmp/environment.yml; fi \
&& rm -rf /tmp/conda-tmp
# [Optional] Uncomment to install a different version of Python than the default
# RUN conda install -y python=3.6 \
# && pip install --no-cache-dir pipx \
# && pipx reinstall-all
# [Optional] Uncomment this section to install additional OS packages.
# RUN apt-get update && export DEBIAN_FRONTEND=noninteractive \
# && apt-get -y install --no-install-recommends <your-package-list-here>

View File

@@ -1,9 +1,11 @@
// For format details, see https://aka.ms/devcontainer.json. For config options, see the // For format details, see https://aka.ms/devcontainer.json. For config options, see the
// README at: https://github.com/devcontainers/templates/tree/main/src/python // README at: https://github.com/devcontainers/templates/tree/main/src/miniconda
{ {
"name": "Python 3", "name": "Miniconda (Python 3)",
// Or use a Dockerfile or Docker Compose file. More info: https://containers.dev/guide/dockerfile "build": {
"image": "mcr.microsoft.com/devcontainers/python:1-3.12-bullseye", "context": "..",
"dockerfile": "Dockerfile"
},
// Features to add to the dev container. More info: https://containers.dev/features. // Features to add to the dev container. More info: https://containers.dev/features.
// "features": {}, // "features": {},
@@ -12,7 +14,9 @@
// "forwardPorts": [], // "forwardPorts": [],
// Use 'postCreateCommand' to run commands after the container is created. // Use 'postCreateCommand' to run commands after the container is created.
"postCreateCommand": "pip3 install --user -r requirements.txt --pre && pip install -e .", "postCreateCommand": "pip install -e .",
// Configure tool-specific properties.
"customizations": { "customizations": {
"vscode": { "vscode": {
"extensions": [ "extensions": [
@@ -20,8 +24,6 @@
] ]
} }
}, },
// Configure tool-specific properties.
// "customizations": {},
// Uncomment to connect as root instead. More info: https://aka.ms/dev-containers-non-root. // Uncomment to connect as root instead. More info: https://aka.ms/dev-containers-non-root.
// "remoteUser": "root" // "remoteUser": "root"

3
.devcontainer/noop.txt Normal file
View File

@@ -0,0 +1,3 @@
This file is copied into the container along with environment.yml* from the
parent folder. This is done to prevent the Dockerfile COPY instruction from
failing if no environment.yml is found.

2
Jenkinsfile vendored
View File

@@ -9,6 +9,8 @@ pipeline {
stages { stages {
stage("install") { stage("install") {
steps { steps {
sh 'conda config --add channels bioconda'
sh 'conda config --add channels https://git.reslate.systems/api/packages/ydeng/conda'
sh 'conda env update -n base -f environment.yml' sh 'conda env update -n base -f environment.yml'
} }
} }

View File

@@ -57,17 +57,28 @@ async def run(args: Namespace):
async with BIGSdbIndex() as bigsdb_index: async with BIGSdbIndex() as bigsdb_index:
gen_strings = read_multiple_fastas(args.fastas) gen_strings = read_multiple_fastas(args.fastas)
scheme_id_lookup = await bigsdb_index.get_schemes_for_seqdefdb(args.seqdefdb) scheme_id_lookup = await bigsdb_index.get_schemes_for_seqdefdb(args.seqdefdb)
scheme_id = args.scheme_id or args.scheme_name or (scheme_id_lookup)["MLST"]
scheme_name_lookup = {value: key for key, value in scheme_id_lookup.items()} scheme_name_lookup = {value: key for key, value in scheme_id_lookup.items()}
known_dbs = await bigsdb_index.get_known_seqdef_dbs()
async with await bigsdb_index.build_profiler_from_seqdefdb(False, args.seqdefdb, scheme_id) as mlst_profiler: if args.seqdefdb not in known_dbs:
raise ValueError("\"{0}\" is a known database. See -h for help.")
if args.scheme_id and args.scheme_id not in scheme_id_lookup.values():
raise ValueError("ID {0} not a known database scheme ID for database \"{1}\". See -h for help.".format(args.scheme_id, args.seqdefdb))
if args.scheme_name and args.scheme_name not in scheme_id_lookup:
raise ValueError("\"{0}\" not a known database scheme name for database \"{1}\". See -h for help.".format(args.scheme_name, args.seqdefdb))
if not (args.scheme_name or args.scheme_id) and "MLST" not in scheme_id_lookup:
raise ValueError("\"MLST\" not a known database scheme name for database \"{0}\". See -h for help.".format(args.seqdefdb))
selected_scheme_id = args.scheme_id or (scheme_id_lookup[args.scheme_name] if args.scheme_name else None) or scheme_id_lookup["MLST"]
async with await bigsdb_index.build_profiler_from_seqdefdb(False, args.seqdefdb, selected_scheme_id) as mlst_profiler:
if not isinstance(mlst_profiler, BIGSdbMLSTProfiler): if not isinstance(mlst_profiler, BIGSdbMLSTProfiler):
raise TypeError("MLST profiler type invalid") raise TypeError("MLST profiler type invalid")
mlst_profiles = mlst_profiler.profile_multiple_strings(gen_strings, args.stop_on_fail) mlst_profiles = mlst_profiler.profile_multiple_strings(gen_strings, args.stop_on_fail)
failed = await write_mlst_profiles_as_csv(mlst_profiles, args.out) failed = await write_mlst_profiles_as_csv(mlst_profiles, args.out)
if len(failed) > 0: if len(failed) > 0:
print(f"A total of {len(failed)} IDs failed (no profile found):\n{"\n".join(failed)}") print(f"A total of {len(failed)} IDs failed (no profile found):\n{"\n".join(failed)}")
print(f"Completed fetching from {args.seqdefdb} for {scheme_name_lookup[scheme_id]}s for {len(args.fastas)} sequences.") print(f"Completed fetching from {args.seqdefdb} for {scheme_name_lookup[selected_scheme_id]}s for {len(args.fastas)} sequences.")
def run_asynchronously(args): def run_asynchronously(args):
asyncio.run(run(args)) asyncio.run(run(args))