aboutsummaryrefslogtreecommitdiff
path: root/workflows/pangenome-generate/merge-metadata.py
diff options
context:
space:
mode:
authorPeter Amstutz2020-04-20 12:55:18 -0400
committerPeter Amstutz2020-04-20 12:55:18 -0400
commitd781e42c9adac07253cb928ae66e9b7314710267 (patch)
tree4718165cbc069169eaff98080c61c5f07763ffc1 /workflows/pangenome-generate/merge-metadata.py
parent1219eaf496c899f3043b90e30eb956f0f363bfb3 (diff)
downloadbh20-seq-resource-d781e42c9adac07253cb928ae66e9b7314710267.tar.gz
bh20-seq-resource-d781e42c9adac07253cb928ae66e9b7314710267.tar.lz
bh20-seq-resource-d781e42c9adac07253cb928ae66e9b7314710267.zip
Move workflows into main repo
Arvados-DCO-1.1-Signed-off-by: Peter Amstutz <peter.amstutz@curii.com>
Diffstat (limited to 'workflows/pangenome-generate/merge-metadata.py')
-rw-r--r--workflows/pangenome-generate/merge-metadata.py17
1 files changed, 17 insertions, 0 deletions
diff --git a/workflows/pangenome-generate/merge-metadata.py b/workflows/pangenome-generate/merge-metadata.py
new file mode 100644
index 0000000..64275b1
--- /dev/null
+++ b/workflows/pangenome-generate/merge-metadata.py
@@ -0,0 +1,17 @@
+import schema_salad.schema
+import schema_salad.jsonld_context
+
+metadataSchema = '$(inputs.metadataSchema.path)'
+metadata = $(inputs.metadata)
+subjects = $(inputs.subjects)
+
+(document_loader,
+ avsc_names,
+ schema_metadata,
+ metaschema_loader) = schema_salad.schema.load_schema(metadataSchema)
+
+for i, m in enumerate(metadata):
+ doc, metadata = schema_salad.schema.load_and_validate(document_loader, avsc_names, m["path"], True)
+ doc["id"] = subjects[i]
+ g = schema_salad.jsonld_context.makerdf(subjects[i], doc, document_loader.ctx)
+ print(g.serialize(format="ntriples").decode("utf-8"))