Skip to content
Snippets Groups Projects
Commit 16167999 authored by Jasper Koehorst's avatar Jasper Koehorst
Browse files

fixed label issue of sample and assay metadata fields

parent 317b710c
No related branches found
No related tags found
No related merge requests found
...@@ -106,7 +106,7 @@ def process_rdf_files(rdf_file): ...@@ -106,7 +106,7 @@ def process_rdf_files(rdf_file):
}""") }""")
for row in qres: for row in qres:
predicate = row.predicate.split("/")[-1] predicate = "assay_"+row.predicate.split("/")[-1]
identifier = "Sample1_" + row.id + "_1.fastq.gz" identifier = "Sample1_" + row.id + "_1.fastq.gz"
print(identifier + "\t"+predicate + f"\t{row.object}", file=output) print(identifier + "\t"+predicate + f"\t{row.object}", file=output)
...@@ -118,18 +118,21 @@ def process_rdf_files(rdf_file): ...@@ -118,18 +118,21 @@ def process_rdf_files(rdf_file):
PREFIX unlock: <http://m-unlock.nl/ontology/> PREFIX unlock: <http://m-unlock.nl/ontology/>
PREFIX jerm: <http://jermontology.org/ontology/JERMOntology#> PREFIX jerm: <http://jermontology.org/ontology/JERMOntology#>
PREFIX schema: <http://schema.org/> PREFIX schema: <http://schema.org/>
SELECT DISTINCT ?id ?predicate ?object SELECT DISTINCT ?id ?predicate ?object ?predicate_label
WHERE { WHERE {
?sample a jerm:Sample . ?sample a jerm:Sample .
?sample ?predicate ?object . ?sample ?predicate ?object .
?sample unlock:assay ?assay . OPTIONAL { ?predicate rdfs:label ?predicate_label}
?sample jerm:hasPart ?assay .
?assay a unlock:AmpliconAssay . ?assay a unlock:AmpliconAssay .
?assay schema:identifier ?id . ?assay schema:identifier ?id .
FILTER(!ISIRI(?object)) FILTER(!ISIRI(?object))
}""") }""")
for row in qres: for row in qres:
predicate = row.predicate.split("/")[-1] predicate = "sample_" + row.predicate.split("/")[-1]
if type(row.predicate_label) == rdflib.term.Literal:
predicate = "sample_" + row.predicate_label.replace(" ","_")
identifier = "Sample1_" + row.id + "_1.fastq.gz" identifier = "Sample1_" + row.id + "_1.fastq.gz"
print(identifier + "\t"+predicate + f"\t{row.object}", file=output) print(identifier + "\t"+predicate + f"\t{row.object}", file=output)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment