Skip to content

Commit

Permalink
Merge commit '555d93ff42af3d2468eb950ff0d2c8548b8b179e' 0.3.1 into no…
Browse files Browse the repository at this point in the history
…te/dev
  • Loading branch information
silenus092 committed Nov 11, 2022
2 parents 7fc1420 + 555d93f commit 5a39726
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 4 deletions.
File renamed without changes.
2 changes: 1 addition & 1 deletion libs/mpxsonar/pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "mpxsonar"
version = "0.3.0"
version = "0.3.1"
description = "A database-driven system for handling genomic sequences and screening genomic profiles."
authors = ["Stephan Fuchs <FuchsS@rki.de>", "Kunaphas Kongkitimanon <KongkitimanonK@rki.de>", "Matthew Huska <HuskaM@rki.de>"]
license = "GPL3"
Expand Down
3 changes: 3 additions & 0 deletions libs/mpxsonar/src/mpxsonar/dbm.py
Original file line number Diff line number Diff line change
Expand Up @@ -811,12 +811,14 @@ def get_molecule_ids(self, reference_accession=None):
"SELECT `molecule.accession`, `molecule.id` FROM referenceView WHERE "
+ condition
)
# print(sql, val)
self.cursor.execute(sql, val)
output = {
x["molecule.accession"]: x["molecule.id"]
for x in self.cursor.fetchall()
if x is not None
}
# print(output)
return output

# Do we need this function?
Expand Down Expand Up @@ -888,6 +890,7 @@ def get_element_ids(self, reference_accession=None, type=None):
if type:
sql += " AND type = ?"
molecule_ids.append(type)
# print(sql, molecule_ids)
self.cursor.execute(sql, molecule_ids)
row = self.cursor.fetchall()
if not row:
Expand Down
22 changes: 19 additions & 3 deletions libs/mpxsonar/src/mpxsonar/sonar.py
Original file line number Diff line number Diff line change
Expand Up @@ -369,7 +369,7 @@ def parse_args(args):
"-v",
"--version",
action="version",
version="mpxsonar " + VERSION,
version="MPXSonar " + VERSION,
help="Show program's version number and exit.",
)

Expand Down Expand Up @@ -400,7 +400,7 @@ def parse_args(args):

def check_file(fname):
if not os.path.isfile(fname):
sys.exit("iput error: " + fname + " is not a valid file.")
sys.exit("input error: " + fname + " is not a valid file.")


def main(args): # noqa: C901
Expand Down Expand Up @@ -629,6 +629,22 @@ def main(args): # noqa: C901
reserved_props = {}

with sonarDBManager(args.db, readonly=False, debug=args.debug) as dbm:
# check reference
if args.reference:
if len(dbm.references) != 0 and args.reference not in [
d["accession"] for d in dbm.references
]:
rows = dbm.references
if not rows:
print("*** no references ***")
else:
print("*** Available Reference***")
print(tabulate(rows, headers="keys", tablefmt="fancy_grid"))
sys.exit(
"Input Error: "
+ str(args.reference)
+ " is not available in our database."
)
for pname in dbm.properties:
if hasattr(args, pname):
props[pname] = getattr(args, pname)
Expand All @@ -637,7 +653,7 @@ def main(args): # noqa: C901
reserved_props["with_sublineage"] = args.with_sublineage
else:
sys.exit(
"input error: "
"Input Error: "
+ args.with_sublineage
+ " is mismatch to the available properties"
)
Expand Down

0 comments on commit 5a39726

Please sign in to comment.