Added additional test for fully automatic typing based on sequence

This commit is contained in:
Harrison Deng 2025-01-08 16:31:06 +00:00
parent c3a492fa8f
commit ad28d9bf20
7 changed files with 25 additions and 7 deletions

View File

@ -1,6 +1,6 @@
from os import path
from typing import Any, AsyncGenerator, AsyncIterable, Iterable, Sequence
from automlst.engine.data.MLST import MLSTProfile
from automlst.engine.data.mlst import MLSTProfile
from automlst.engine.data.genomics import NamedString
from automlst.engine.local.abif import read_abif
from automlst.engine.local.fasta import read_fasta

View File

@ -3,7 +3,7 @@ from io import TextIOWrapper
from os import PathLike
from typing import AsyncIterable, Iterable, Mapping, Sequence, Union
from automlst.engine.data.MLST import Allele, MLSTProfile
from automlst.engine.data.mlst import Allele, MLSTProfile
def loci_alleles_variants_from_loci(alleles_map: Mapping[str, Sequence[Allele]]):

View File

@ -3,7 +3,7 @@ from contextlib import AbstractAsyncContextManager
import re
from typing import Any, AsyncGenerator, AsyncIterable, Generator, Iterable, Sequence, Union
from aiohttp import ClientSession, ClientTimeout
from automlst.engine.data.MLST import Allele, MLSTProfile
from automlst.engine.data.mlst import Allele, MLSTProfile
from automlst.engine.data.genomics import NamedString
class InstitutPasteurProfiler(AbstractAsyncContextManager):

View File

@ -4,7 +4,7 @@ from typing import AsyncGenerator, AsyncIterable, Generator, Iterable, Mapping,
from aiohttp import ClientSession
from automlst.engine.data.MLST import Allele, MLSTProfile
from automlst.engine.data.mlst import Allele, MLSTProfile
MLST_DATABASES = [
"https://bigsdb.pasteur.fr/api/db",

View File

@ -3,7 +3,7 @@ from contextlib import AbstractAsyncContextManager
import re
from typing import Any, AsyncGenerator, AsyncIterable, Generator, Iterable, Mapping, Sequence, Union
from aiohttp import ClientSession, ClientTimeout
from automlst.engine.data.MLST import Allele, MLSTProfile
from automlst.engine.data.mlst import Allele, MLSTProfile
from automlst.engine.data.genomics import NamedString
from automlst.engine.remote.databases.mlst import MLSTProfiler

View File

@ -1,5 +1,5 @@
from Bio import SeqIO
from automlst.engine.data.MLST import Allele, MLSTProfile
from automlst.engine.data.mlst import Allele, MLSTProfile
from automlst.engine.remote.databases.institutpasteur.mlst import InstitutPasteurProfiler
@ -32,4 +32,22 @@ async def test_profiling_results_in_correct_st():
assert mlst_st_data is not None
assert isinstance(mlst_st_data, MLSTProfile)
assert mlst_st_data.clonal_complex == "ST-2 complex"
assert mlst_st_data.sequence_type == "1"
assert mlst_st_data.sequence_type == "1"
async def test_sequence_profiling_is_correct():
sequence = str(SeqIO.read("tests/resources/tohama_I_bpertussis.fasta", "fasta").seq)
dummy_alleles = [
Allele("adk", "1"),
Allele("fumC", "1"),
Allele("glyA", "1"),
Allele("tyrB", "1"),
Allele("icd", "1"),
Allele("pepA", "1"),
Allele("pgm", "1"),
]
async with InstitutPasteurProfiler(database_name="pubmlst_bordetella_seqdef") as dummy_profiler:
profile = await dummy_profiler.profile_string(sequence)
assert profile is not None
assert isinstance(profile, MLSTProfile)
assert profile.clonal_complex == "ST-2 complex"
assert profile.sequence_type == "1"