Skip to content

Commit

Permalink
Merge branch 'master' into add-pubmlst-utils
Browse files Browse the repository at this point in the history
  • Loading branch information
karlnyr authored Jan 8, 2025
2 parents 6153cff + 1a93071 commit 2d13f27
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 23 deletions.
34 changes: 12 additions & 22 deletions microSALT/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:")
Expand Down Expand Up @@ -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()):
Expand Down Expand Up @@ -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(
Expand All @@ -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
Expand Down
2 changes: 1 addition & 1 deletion microSALT/utils/scraper.py
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand Down

0 comments on commit 2d13f27

Please sign in to comment.