8 Commits
0.2.0 ... 0.4.0

8 changed files with 39 additions and 28 deletions

View File

@@ -1,39 +1,45 @@
# autoMLST.CLI # autoBIGS.cli
A command-line interface based program that allows quickly batched requests for obtaining MLST profiles on multiple FASTA sequences and exporting it as a convenient CSV. A command-line interface (CLI) based program that allows quickly batched requests for obtaining MLST profiles on multiple FASTA sequences and exporting it as a convenient CSV. Capable of querying a variety of MLST databases from both Institut Pasteur and PubMLST.
This program is simply a command-line interface for [autoMLST.Engine](https://pypi.org/project/automlst.engine). This program is simply a command-line interface for [autoBIGS.engine](https://pypi.org/project/autoBIGS.engine).
## Features ## Features
This CLI is capable of exactly what [autoMLST.Engine](https://pypi.org/project/automlst.engine) is capable of: This CLI is capable of exactly what [autoBIGS.engine](https://pypi.org/project/autoBIGS.engine) is capable of:
- Import multiple FASTA files - Import multiple whole genome FASTA files
- Fetch the available BIGSdb databases that is currently live and available - Fetch the available BIGSdb databases that is currently live and available
- Fetch the available BIGSdb database schemas for a given MLST database - Fetch the available BIGSdb database schemas for a given MLST database
- Retrieve exact/non-exact MLST allele variant IDs based off a sequence - Retrieve exact/non-exact MLST allele variant IDs based off a sequence
- Retrieve MLST sequence type IDs based off a sequence - Retrieve MLST sequence type IDs based off a sequence
- Output all results to a single CSV - Output all results to a single CSV
## Planned Features for CLI
- Specifications of multi-threading capacity
- Session authentication for updated database schemas (as required by both PubMLST and Institut Pasteur)
Please refer to [autoBIGS.engine](https://pypi.org/project/autoBIGS.engine) for more planned features.
## Usage ## Usage
This CLI can be installed with `pip`. Please ensure [pip is installed](https://pip.pypa.io/en/stable/installation/). Then: This CLI can be installed with `pip`. Please ensure [pip is installed](https://pip.pypa.io/en/stable/installation/). Then:
1. Run `pip install automlst-cli` to install the latest version of the CLI for autoMLST. 1. Run `pip install autoBIGS-cli` to install the latest version of the CLI for autoBIGS.
2. Once installation is complete, run `automlst --version` to test that the installation succeeded (and that you are running the appropriate version). 2. Once installation is complete, run `autoBIGS --version` to test that the installation succeeded (and that you are running the appropriate version).
3. Run `automlst -h` to get information on how to get started. 3. Run `autoBIGS -h` to get information on how to get started.
### Example ### Example
Let's say you have a fasta called `seq.fasta` which contains several sequences. You know all sequences in `seq.fasta` are Bordetella pertussis sequences, and you know you have the sequences for the necessary targets of your schema in each of them. You want to retrieve MLST profiles for all of them. This can be done by: Let's say you have a fasta called `seq.fasta` which contains several sequences. You know all sequences in `seq.fasta` are Bordetella pertussis sequences, and you know you have the sequences for the necessary targets of your schema in each of them. You want to retrieve MLST profiles for all of them. This can be done by:
1. Running `automlst info -l` to list all available `seqdef` databases and find the database associated with Bordetella (you should see one called `pubmlst_bordetella_seqdef`). 1. Running `autobigs info -l` to list all available `seqdef` databases and find the database associated with Bordetella (you should see one called `pubmlst_bordetella_seqdef`).
2. Then, run `automlst info -lschema pubmlst_bordetella_seqdef` to get the available typing schemas and their associated IDs. In this example, let's assume we want a normal MLST scheme. In this case, we would pay attention to the number next to `MLST` (it should be `3`). 2. Then, run `autobigs info -lschema pubmlst_bordetella_seqdef` to get the available typing schemas and their associated IDs. In this example, let's assume we want a normal MLST scheme. In this case, we would pay attention to the number next to `MLST` (it should be `3`).
3. Then, run `automlst st -h` and familiarize yourself with the parameters needed for sequence typing. 3. Then, run `autobigs st -h` and familiarize yourself with the parameters needed for sequence typing.
4. Namely, you should find that you will need to run `automlst st seq.fasta pubmlst_bordetella_seqdef 3 output.csv`. You can optionally include multiple `FASTA` files, and/or `--exact` to only retrieve exact sequence types, and/or `--stop-on-fail` to stop typing if one of your sequences fail to retrieve any type. 4. Namely, you should find that you will need to run `autobigs st seq.fasta pubmlst_bordetella_seqdef 3 output.csv`. You can optionally include multiple `FASTA` files, and/or `--exact` to only retrieve exact sequence types, and/or `--stop-on-fail` to stop typing if one of your sequences fail to retrieve any type.
5. Sit tight, and wait. The `output.csv` will contain your results once completed. 5. Sit tight, and wait. The `output.csv` will contain your results once completed.

View File

@@ -3,18 +3,23 @@ requires = ["setuptools>=64", "setuptools_scm>=8"]
build-backend = "setuptools.build_meta" build-backend = "setuptools.build_meta"
[project] [project]
name = "automlst.cli" name = "autoBIGS.cli"
dynamic = ["version"] dynamic = ["version"]
readme = "README.md" readme = "README.md"
dependencies = [ dependencies = [
"automlst-engine" "autoBIGS-engine"
] ]
requires-python = ">=3.11" requires-python = ">=3.12"
description = "A CLI tool to rapidly fetch fetch MLST profiles given sequences for various diseases." description = "A CLI tool to rapidly fetch fetch MLST profiles given sequences for various diseases."
[project.urls]
Repository = "https://github.com/RealYHD/autoBIGS.cli"
Issues = "https://github.com/RealYHD/autoBIGS.cli/issues"
[project.scripts] [project.scripts]
automlst = "automlst.cli.program:run" autoBIGS = "autobigs.cli.program:run"
[tool.setuptools_scm] [tool.setuptools_scm]

View File

@@ -4,4 +4,4 @@ pytest-cov
build build
twine twine
setuptools_scm setuptools_scm
automlst-engine autoBIGS.engine

View File

@@ -1,6 +1,6 @@
from argparse import ArgumentParser, Namespace from argparse import ArgumentParser, Namespace
import asyncio import asyncio
from automlst.engine.data.remote.databases.bigsdb import BIGSdbIndex from autobigs.engine.data.remote.databases.bigsdb import BIGSdbIndex
def setup_parser(parser: ArgumentParser): def setup_parser(parser: ArgumentParser):
parser.description = "Fetches the latest BIGSdb MLST database definitions." parser.description = "Fetches the latest BIGSdb MLST database definitions."

View File

@@ -3,8 +3,8 @@ from importlib import metadata
from os import path from os import path
import os import os
from automlst.cli import info, st from autobigs.cli import info, st
from automlst.cli.meta import get_module_base_name from autobigs.cli.meta import get_module_base_name
import importlib import importlib
root_parser = argparse.ArgumentParser(epilog='Use "%(prog)s info -h" to learn how to get available MLST databases, and their available schemas.' root_parser = argparse.ArgumentParser(epilog='Use "%(prog)s info -h" to learn how to get available MLST databases, and their available schemas.'
@@ -20,17 +20,17 @@ root_parser.add_argument(
action="store_true", action="store_true",
default=False, default=False,
required=False, required=False,
help="Displays the autoMLST.CLI version, and the autoMLST.Engine version." help="Displays the autoBIGS.CLI version, and the autoBIGS.Engine version."
) )
def run(): def run():
args = root_parser.parse_args() args = root_parser.parse_args()
if args.version: if args.version:
print(f'autoMLST.CLI is running version { print(f'autoBIGS.CLI is running version {
metadata.version("automlst-cli")}.') metadata.version("autoBIGS-cli")}.')
print(f'autoMLST.Engine is running version { print(f'autoBIGS.Engine is running version {
metadata.version("automlst-engine")}.') metadata.version("autoBIGS-engine")}.')
if hasattr(args, "run"): if hasattr(args, "run"):
args.run(args) args.run(args)

View File

@@ -2,9 +2,9 @@
from argparse import ArgumentParser, Namespace from argparse import ArgumentParser, Namespace
import asyncio import asyncio
import datetime import datetime
from automlst.engine.data.local.csv import write_mlst_profiles_as_csv from autobigs.engine.data.local.csv import write_mlst_profiles_as_csv
from automlst.engine.data.local.fasta import read_multiple_fastas from autobigs.engine.data.local.fasta import read_multiple_fastas
from automlst.engine.data.remote.databases.bigsdb import BIGSdbIndex from autobigs.engine.data.remote.databases.bigsdb import BIGSdbIndex
def setup_parser(parser: ArgumentParser): def setup_parser(parser: ArgumentParser):