3 Commits
0.3 ... 0.5

5 changed files with 42 additions and 16 deletions

6
Jenkinsfile vendored
View File

@@ -39,15 +39,15 @@ pipeline {
sh returnStatus: true, script: 'python -m twine upload --repository-url https://git.reslate.systems/api/packages/ydeng/pypi -u __token__ -p ${TOKEN} --non-interactive --disable-progress-bar --verbose dist/*'
}
}
stage ("test.pypi.org") {
stage ("pypi.org") {
when {
tag '*.*'
}
environment {
TOKEN = credentials('test.pypi.org')
TOKEN = credentials('pypi.org')
}
steps {
sh returnStatus: true, script: 'python -m twine upload -r testpypi -u __token__ -p ${TOKEN} --non-interactive --disable-progress-bar --verbose dist/*'
sh returnStatus: true, script: 'python -m twine upload -u __token__ -p ${TOKEN} --non-interactive --disable-progress-bar --verbose dist/*'
}
}
}

View File

@@ -1,12 +1,25 @@
# autoMLST
# autoMLST.Engine
A CLI/library for rapidly performing MLST typing via accessing pubMLST and InstitutPasteur MSLT databases.
A python library implementing common BIGSdb MLST schemes and databases. Implementation follows the RESTful API outlined by the official [BIGSdb documentation](https://bigsdb.readthedocs.io/en/latest/rest.html) up to `V1.50.0`.
# Components
## Features
## automlst.cli
Briefly, this library can:
- Import multiple `FASTA` files
- Fetch the available BIGSdb databases that is currently live and available
- Fetch the available BIGSdb database schemas for a given MLST database
- Retrieve exact/non-exact MLST allele variant IDs based off a sequence
- Retrieve MLST sequence type IDs based off a sequence
- Output all results to a single CSV
The command line interface, sets up very minimal and mostly makes calls to the library. Uses argparse and is split into two parts:
Furthermore, this library is highly asynchronous where any potentially blocking operation, ranging from parsing FASTAs to performing HTTP requests are at least asynchronous, if not fully multithreaded.
- `automlst info`: Provides user information on available databases to pull from, and the schemas available.
- `automlst exactmatch`: Provides users the ability to request exact match results from a given database and schema
## Usage
This library can be installed through pip. Learn how to [setup and install pip first](https://pip.pypa.io/en/stable/installation/).
Then, it's as easy as running `pip install automlst-engine` in any terminal that has pip in it's path (any terminal where `pip --version` returns a valid version and install path).
### CLI usage
This is a independent python library and thus does not have any form of direct user interface. One way of using it could be to create your own Python script that makes calls to this libraries functions. Alternatively, you may use `automlst-cli`, a `Python` package that implements a CLI for calling this library.

View File

@@ -5,6 +5,7 @@ build-backend = "setuptools.build_meta"
[project]
name = "automlst.engine"
dynamic = ["version"]
readme = "README.md"
dependencies = [
"biopython",

View File

@@ -1,7 +1,6 @@
import csv
from io import TextIOWrapper
from os import PathLike
from typing import AsyncIterable, Iterable, Mapping, Sequence, Union
from typing import AsyncIterable, Mapping, Sequence, Union
from automlst.engine.data.structures.mlst import Allele, MLSTProfile
@@ -11,10 +10,11 @@ def dict_loci_alleles_variants_from_loci(alleles_map: Mapping[str, Sequence[Alle
for loci, alleles in alleles_map.items():
if len(alleles) == 1:
result_dict[loci] = alleles[0].allele_variant
for allele in alleles:
result_locis = list()
result_locis.append(allele.allele_variant)
result_dict[loci] = result_locis
else:
for allele in alleles:
result_locis = list()
result_locis.append(allele.allele_variant)
result_dict[loci] = result_locis
return result_dict

View File

@@ -0,0 +1,12 @@
from automlst.engine.data.local.csv import dict_loci_alleles_variants_from_loci
from automlst.engine.data.structures.mlst import Allele
def test_dict_loci_alleles_variants_from_loci_single_loci_not_list():
alleles_map = {
"adk": [Allele("adk", "1", None)]
}
results = dict_loci_alleles_variants_from_loci(alleles_map)
for loci, variant in results.items():
assert isinstance(variant, str)
assert variant == "1"