aboutsummaryrefslogtreecommitdiff
path: root/bh20sequploader/main.py
diff options
context:
space:
mode:
authorPeter Amstutz2020-04-20 12:50:03 -0400
committerPeter Amstutz2020-04-20 12:50:03 -0400
commit1219eaf496c899f3043b90e30eb956f0f363bfb3 (patch)
treea0735d5df88e608c5461d5b3cb9a3c6bb2f0f32e /bh20sequploader/main.py
parenta2d19fa7b34170abab3759cdff14d8b052178a8a (diff)
downloadbh20-seq-resource-1219eaf496c899f3043b90e30eb956f0f363bfb3.tar.gz
bh20-seq-resource-1219eaf496c899f3043b90e30eb956f0f363bfb3.tar.lz
bh20-seq-resource-1219eaf496c899f3043b90e30eb956f0f363bfb3.zip
Add ShEx validation
Arvados-DCO-1.1-Signed-off-by: Peter Amstutz <peter.amstutz@curii.com>
Diffstat (limited to 'bh20sequploader/main.py')
-rw-r--r--bh20sequploader/main.py11
1 files changed, 10 insertions, 1 deletions
diff --git a/bh20sequploader/main.py b/bh20sequploader/main.py
index e0a6a9a..49d012d 100644
--- a/bh20sequploader/main.py
+++ b/bh20sequploader/main.py
@@ -21,16 +21,25 @@ def main():
parser = argparse.ArgumentParser(description='Upload SARS-CoV-19 sequences for analysis')
parser.add_argument('sequence', type=argparse.FileType('r'), help='sequence FASTA/FASTQ')
parser.add_argument('metadata', type=argparse.FileType('r'), help='sequence metadata json')
+ parser.add_argument("--validate", action="store_true", help="Dry run, validate only")
args = parser.parse_args()
api = arvados.api(host=ARVADOS_API_HOST, token=ARVADOS_API_TOKEN, insecure=True)
- target = qc_fasta(args.sequence)
+ try:
+ target = qc_fasta(args.sequence)
+ except ValueError as e:
+ print(e)
+ exit(1)
if not qc_metadata(args.metadata.name):
print("Failed metadata qc")
exit(1)
+ if args.validate:
+ print("Valid")
+ exit(0)
+
col = arvados.collection.Collection(api_client=api)
with col.open(target, "w") as f: