Added check to wrap string into list to prevent decomposing string for querying

This commit is contained in:
Harrison Deng 2025-02-12 14:46:29 +00:00
parent c18d817cd9
commit a88225fcff

View File

@ -47,10 +47,13 @@ class OnlineBIGSdbMLSTProfiler(BIGSdbMLSTProfiler):
async def __aenter__(self): async def __aenter__(self):
return self return self
async def fetch_mlst_allele_variants(self, sequence_strings: Iterable[str]) -> AsyncGenerator[Allele, Any]: async def fetch_mlst_allele_variants(self, sequence_strings: Union[Iterable[str], str]) -> AsyncGenerator[Allele, Any]:
# See https://bigsdb.pasteur.fr/api/db/pubmlst_bordetella_seqdef/schemes # See https://bigsdb.pasteur.fr/api/db/pubmlst_bordetella_seqdef/schemes
uri_path = "sequence" uri_path = "sequence"
if isinstance(sequence_strings, str):
sequence_strings = [sequence_strings]
for sequence_string in sequence_strings: for sequence_string in sequence_strings:
async with self._http_client.post(uri_path, json={ async with self._http_client.post(uri_path, json={
"sequence": sequence_string, "sequence": sequence_string,