diff --git a/microSALT/__init__.py b/microSALT/__init__.py index 3472d3cb..0deda94c 100644 --- a/microSALT/__init__.py +++ b/microSALT/__init__.py @@ -10,7 +10,7 @@ from flask import Flask from distutils.sysconfig import get_python_lib -__version__ = "4.0.0" +__version__ = "4.1.0" app = Flask(__name__, template_folder="server/templates") app.config.setdefault("SQLALCHEMY_DATABASE_URI", "sqlite:///:memory:") @@ -51,16 +51,18 @@ app.config["folders"] = preset_config.get("folders", {}) # Ensure PubMLST configuration is included + app.config["pubmlst"] = preset_config.get("pubmlst", { "client_id": "", "client_secret": "" }) + app.config["pubmlst"] = preset_config.get("pubmlst", {"client_id": "", "client_secret": ""}) + + # Add extrapaths to config preset_config["folders"]["expec"] = os.path.abspath( - os.path.join( - pathlib.Path(__file__).parent.parent, "unique_references/ExPEC.fsa" - ) + os.path.join(pathlib.Path(__file__).parent.parent, "unique_references/ExPEC.fsa") ) # Check if release install exists for entry in os.listdir(get_python_lib()): @@ -113,22 +115,14 @@ ): # Special string, mangling if thing == "log_file": - unmade_fldr = os.path.dirname( - preset_config[entry][thing] - ) - bash_cmd = "touch {}".format( - preset_config[entry][thing] - ) - proc = subprocess.Popen( - bash_cmd.split(), stdout=subprocess.PIPE - ) + unmade_fldr = os.path.dirname(preset_config[entry][thing]) + bash_cmd = "touch {}".format(preset_config[entry][thing]) + proc = subprocess.Popen(bash_cmd.split(), stdout=subprocess.PIPE) output, error = proc.communicate() elif thing == "SQLALCHEMY_DATABASE_URI": unmade_fldr = os.path.dirname(db_file) bash_cmd = "touch {}".format(db_file) - proc = subprocess.Popen( - bash_cmd.split(), stdout=subprocess.PIPE - ) + proc = subprocess.Popen(bash_cmd.split(), stdout=subprocess.PIPE) output, error = proc.communicate() if proc.returncode != 0: logger.error( @@ -141,12 +135,8 @@ os.makedirs(unmade_fldr) logger.info("Created path {}".format(unmade_fldr)) - fh = logging.FileHandler( - os.path.expanduser(preset_config["folders"]["log_file"]) - ) - fh.setFormatter( - logging.Formatter("%(asctime)s - %(name)s - %(levelname)s - %(message)s") - ) + fh = logging.FileHandler(os.path.expanduser(preset_config["folders"]["log_file"])) + fh.setFormatter(logging.Formatter("%(asctime)s - %(name)s - %(levelname)s - %(message)s")) logger.addHandler(fh) # Integrity check database diff --git a/microSALT/utils/scraper.py b/microSALT/utils/scraper.py index 00782a8f..daee21d4 100644 --- a/microSALT/utils/scraper.py +++ b/microSALT/utils/scraper.py @@ -391,7 +391,7 @@ def scrape_blast(self, type="", file_list=[]): # Identical identity and span, seperating based on contig coverage else: # Rightmost is worse - if float(hypo[ind].get("contig_coverage")) > float( + if float(hypo[ind].get("contig_coverage")) >= float( hypo[targ].get("contig_coverage") ): del hypo[targ]