diff options
author | Peter Amstutz | 2020-07-05 21:33:26 +0000 |
---|---|---|
committer | Peter Amstutz | 2020-07-05 21:33:26 +0000 |
commit | 4f30e506055acb788a1ff1bbcb6359c4413a4eab (patch) | |
tree | 08d564d00b19a71fe670588880f30225d7cb442d /bh20sequploader | |
parent | dd0ff95c6973953542cc3a275be2b057b30ff577 (diff) | |
download | bh20-seq-resource-4f30e506055acb788a1ff1bbcb6359c4413a4eab.tar.gz bh20-seq-resource-4f30e506055acb788a1ff1bbcb6359c4413a4eab.tar.lz bh20-seq-resource-4f30e506055acb788a1ff1bbcb6359c4413a4eab.zip |
Add bh20-seq-analyzer --print-status
Get status from new property "status: validated/rejected"
Also store QC fail error message.
Diffstat (limited to 'bh20sequploader')
-rw-r--r-- | bh20sequploader/main.py | 9 | ||||
-rw-r--r-- | bh20sequploader/qc_metadata.py | 21 |
2 files changed, 10 insertions, 20 deletions
diff --git a/bh20sequploader/main.py b/bh20sequploader/main.py index cdc4c3f..8555e2b 100644 --- a/bh20sequploader/main.py +++ b/bh20sequploader/main.py @@ -26,11 +26,9 @@ def qc_stuff(metadata, sequence_p1, sequence_p2, do_qc=True): try: log.debug("Checking metadata" if do_qc else "Skipping metadata check") if do_qc and not qc_metadata(metadata.name): - log.warning("Failed metadata qc") - exit(1) - except ValueError as e: + raise Exception("Failed metadata qc") + except Exception as e: log.debug(e) - log.debug("Failed metadata qc") print(e) exit(1) @@ -42,9 +40,8 @@ def qc_stuff(metadata, sequence_p1, sequence_p2, do_qc=True): target.append(qc_fasta(sequence_p2)) target[0] = ("reads_1."+target[0][0][6:], target[0][1]) target[1] = ("reads_2."+target[1][0][6:], target[0][1]) - except ValueError as e: + except Exception as e: log.debug(e) - log.debug("Failed FASTA qc") print(e) exit(1) diff --git a/bh20sequploader/qc_metadata.py b/bh20sequploader/qc_metadata.py index 9122ace..2b57991 100644 --- a/bh20sequploader/qc_metadata.py +++ b/bh20sequploader/qc_metadata.py @@ -21,20 +21,13 @@ def qc_metadata(metadatafile): shex = pkg_resources.resource_stream(__name__, "bh20seq-shex.rdf").read().decode("utf-8") if not isinstance(avsc_names, schema_salad.avro.schema.Names): - print(avsc_names) - return False + raise Exception(avsc_names) - try: - doc, metadata = schema_salad.schema.load_and_validate(document_loader, avsc_names, metadatafile, True) - g = schema_salad.jsonld_context.makerdf("workflow", doc, document_loader.ctx) - rslt, reason = evaluate(g, shex, doc["id"], "https://raw.githubusercontent.com/arvados/bh20-seq-resource/master/bh20sequploader/bh20seq-shex.rdf#submissionShape") + doc, metadata = schema_salad.schema.load_and_validate(document_loader, avsc_names, metadatafile, True) + g = schema_salad.jsonld_context.makerdf("workflow", doc, document_loader.ctx) + rslt, reason = evaluate(g, shex, doc["id"], "https://raw.githubusercontent.com/arvados/bh20-seq-resource/master/bh20sequploader/bh20seq-shex.rdf#submissionShape") - if not rslt: - log.debug(reason) - print(reason) + if not rslt: + raise Exception(reason) - return rslt - except Exception as e: - traceback.print_exc() - log.warn(e) - return False + return True |