Added additional test for fully automatic typing based on sequence
This commit is contained in:
parent
c3a492fa8f
commit
ad28d9bf20
@ -1,6 +1,6 @@
|
|||||||
from os import path
|
from os import path
|
||||||
from typing import Any, AsyncGenerator, AsyncIterable, Iterable, Sequence
|
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.data.genomics import NamedString
|
||||||
from automlst.engine.local.abif import read_abif
|
from automlst.engine.local.abif import read_abif
|
||||||
from automlst.engine.local.fasta import read_fasta
|
from automlst.engine.local.fasta import read_fasta
|
||||||
|
@ -3,7 +3,7 @@ from io import TextIOWrapper
|
|||||||
from os import PathLike
|
from os import PathLike
|
||||||
from typing import AsyncIterable, Iterable, Mapping, Sequence, Union
|
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]]):
|
def loci_alleles_variants_from_loci(alleles_map: Mapping[str, Sequence[Allele]]):
|
||||||
|
@ -3,7 +3,7 @@ from contextlib import AbstractAsyncContextManager
|
|||||||
import re
|
import re
|
||||||
from typing import Any, AsyncGenerator, AsyncIterable, Generator, Iterable, Sequence, Union
|
from typing import Any, AsyncGenerator, AsyncIterable, Generator, Iterable, Sequence, Union
|
||||||
from aiohttp import ClientSession, ClientTimeout
|
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.data.genomics import NamedString
|
||||||
|
|
||||||
class InstitutPasteurProfiler(AbstractAsyncContextManager):
|
class InstitutPasteurProfiler(AbstractAsyncContextManager):
|
@ -4,7 +4,7 @@ from typing import AsyncGenerator, AsyncIterable, Generator, Iterable, Mapping,
|
|||||||
|
|
||||||
from aiohttp import ClientSession
|
from aiohttp import ClientSession
|
||||||
|
|
||||||
from automlst.engine.data.MLST import Allele, MLSTProfile
|
from automlst.engine.data.mlst import Allele, MLSTProfile
|
||||||
|
|
||||||
MLST_DATABASES = [
|
MLST_DATABASES = [
|
||||||
"https://bigsdb.pasteur.fr/api/db",
|
"https://bigsdb.pasteur.fr/api/db",
|
||||||
|
@ -3,7 +3,7 @@ from contextlib import AbstractAsyncContextManager
|
|||||||
import re
|
import re
|
||||||
from typing import Any, AsyncGenerator, AsyncIterable, Generator, Iterable, Mapping, Sequence, Union
|
from typing import Any, AsyncGenerator, AsyncIterable, Generator, Iterable, Mapping, Sequence, Union
|
||||||
from aiohttp import ClientSession, ClientTimeout
|
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.data.genomics import NamedString
|
||||||
from automlst.engine.remote.databases.mlst import MLSTProfiler
|
from automlst.engine.remote.databases.mlst import MLSTProfiler
|
||||||
|
|
@ -1,5 +1,5 @@
|
|||||||
from Bio import SeqIO
|
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
|
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 mlst_st_data is not None
|
||||||
assert isinstance(mlst_st_data, MLSTProfile)
|
assert isinstance(mlst_st_data, MLSTProfile)
|
||||||
assert mlst_st_data.clonal_complex == "ST-2 complex"
|
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"
|
Loading…
x
Reference in New Issue
Block a user