Compare commits

..

No commits in common. "29fcf8c176e3efbd88d969a001ed16589d5fa382" and "f8d92a4aade23a6ed276380ac3846da63f6f4c01" have entirely different histories.

2 changed files with 3 additions and 8 deletions

View File

@ -15,7 +15,7 @@ from autobigs.engine.reading import read_fasta
from autobigs.engine.structures.alignment import PairwiseAlignment from autobigs.engine.structures.alignment import PairwiseAlignment
from autobigs.engine.structures.genomics import NamedString from autobigs.engine.structures.genomics import NamedString
from autobigs.engine.structures.mlst import Allele, NamedMLSTProfile, AlignmentStats, MLSTProfile from autobigs.engine.structures.mlst import Allele, NamedMLSTProfile, AlignmentStats, MLSTProfile
from autobigs.engine.exceptions.database import BIGSdbResponseNotOkay, NoBIGSdbExactMatchesException, NoBIGSdbMatchesException, NoSuchBIGSdbDatabaseException from autobigs.engine.exceptions.database import NoBIGSdbExactMatchesException, NoBIGSdbMatchesException, NoSuchBIGSdbDatabaseException
from Bio.Align import PairwiseAligner from Bio.Align import PairwiseAligner
@ -99,10 +99,7 @@ class RemoteBIGSdbMLSTProfiler(BIGSdbMLSTProfiler):
) )
yield result_allele if isinstance(sequence_string, str) else (sequence_string.name, result_allele) yield result_allele if isinstance(sequence_string, str) else (sequence_string.name, result_allele)
else: else:
if response.status == 200: raise NoBIGSdbMatchesException(self._database_name, self._scheme_id, sequence_string.name if isinstance(sequence_string, NamedString) else None)
raise NoBIGSdbMatchesException(self._database_name, self._scheme_id, sequence_string.name if isinstance(sequence_string, NamedString) else None)
else:
raise BIGSdbResponseNotOkay(sequence_response)
except (ConnectionError, ServerDisconnectedError, ClientOSError) as e: # Errors we will retry except (ConnectionError, ServerDisconnectedError, ClientOSError) as e: # Errors we will retry
last_error = e last_error = e
success = False success = False

View File

@ -3,13 +3,11 @@ from typing import Union
class BIGSDbDatabaseAPIException(Exception): class BIGSDbDatabaseAPIException(Exception):
pass pass
class BIGSdbResponseNotOkay(BIGSDbDatabaseAPIException):
pass
class NoBIGSdbMatchesException(BIGSDbDatabaseAPIException): class NoBIGSdbMatchesException(BIGSDbDatabaseAPIException):
def __init__(self, database_name: str, database_scheme_id: int, query_name: Union[None, str], *args): def __init__(self, database_name: str, database_scheme_id: int, query_name: Union[None, str], *args):
self._query_name = query_name self._query_name = query_name
super().__init__(f"No matches found with scheme with ID {database_scheme_id} in the database \"{database_name}\".", *args) super().__init__(f"No matches found with scheme with ID {database_scheme_id} in the database \"{database_name}\".", *args)
def get_causal_query_name(self) -> Union[str, None]: def get_causal_query_name(self) -> Union[str, None]:
return self._query_name return self._query_name