Compare commits
4 Commits
Author | SHA1 | Date | |
---|---|---|---|
b89f24a3fa | |||
e7c8c5bcf9 | |||
ab44dfaa48 | |||
611b956d88 |
6
Jenkinsfile
vendored
6
Jenkinsfile
vendored
@@ -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/*'
|
||||
}
|
||||
}
|
||||
}
|
||||
|
27
README.md
27
README.md
@@ -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.
|
@@ -5,6 +5,7 @@ build-backend = "setuptools.build_meta"
|
||||
[project]
|
||||
name = "automlst.engine"
|
||||
dynamic = ["version"]
|
||||
readme = "README.md"
|
||||
|
||||
dependencies = [
|
||||
"biopython",
|
||||
|
@@ -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:
|
||||
else:
|
||||
result_locis = list()
|
||||
result_locis.append(allele.allele_variant)
|
||||
result_dict[loci] = result_locis
|
||||
for allele in alleles:
|
||||
result_locis.append(allele.allele_variant)
|
||||
result_dict[loci] = result_locis
|
||||
return result_dict
|
||||
|
||||
|
||||
|
21
tests/automlst/engine/data/local/test_csv.py
Normal file
21
tests/automlst/engine/data/local/test_csv.py
Normal file
@@ -0,0 +1,21 @@
|
||||
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"
|
||||
|
||||
def test_dict_loci_alleles_variants_from_loci_multi_loci_is_list():
|
||||
alleles_map = {
|
||||
"adk": [Allele("adk", "1", None), Allele("adk", "2", None)]
|
||||
}
|
||||
results = dict_loci_alleles_variants_from_loci(alleles_map)
|
||||
for loci, variant in results.items():
|
||||
assert isinstance(variant, list)
|
||||
assert len(variant) == 2
|
Reference in New Issue
Block a user