Skip to content

Commit 39b1d7e

Browse files
committed
label change in prov
1 parent d1b3f48 commit 39b1d7e

File tree

3 files changed

+18
-7
lines changed

3 files changed

+18
-7
lines changed

rocrate/provenance_profile.py

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,17 @@ def __init__(
121121
metadata_export = load_ga_history_export(ga_export)
122122
self.generate_prov_doc()
123123
self.jobs = []
124+
self.datasets = []
125+
124126
# print(metadata_export["jobs_attrs"][0]["params"])
127+
for dataset in metadata_export["datasets_attrs"]:
128+
ds_attrs = GalaxyDataset()
129+
ds_attrs.parse_ga_dataset_attrs(dataset)
130+
self.datasets.append(ds_attrs.attributes)
131+
# self.declare_process(ds_attrs.attributes)
132+
133+
print(self.datasets[0])
134+
125135
for job in metadata_export["jobs_attrs"]:
126136
job_attrs = GalaxyJob()
127137
job_attrs.parse_ga_jobs_attrs(job)
@@ -234,7 +244,7 @@ def declare_process(
234244
cmd = ga_export_jobs_attrs["command_line"]
235245
process_name = ga_export_jobs_attrs["tool_id"]
236246
tool_version = ga_export_jobs_attrs["tool_version"]
237-
prov_label = "Run of ga_export/jobs_attrs.txt#" + process_name
247+
prov_label = "Run of " + process_name
238248
start_time = ga_export_jobs_attrs["create_time"]
239249
end_time = ga_export_jobs_attrs["update_time"]
240250

@@ -294,7 +304,7 @@ def used_artefacts(
294304
if isinstance(key, str):
295305
key = key.replace("|", "_")
296306
if isinstance(value, str):
297-
val = value.replace("|", "_")
307+
value = value.replace("|", "_")
298308

299309
prov_role = self.wf_ns[f"{base}/{key}"]
300310

@@ -353,6 +363,7 @@ def declare_artefact(self, value: Any) -> ProvEntity:
353363
)
354364

355365
if isinstance(value, Dict):
366+
# print(value, end ='\n')
356367
if "@id" in value:
357368
# Already processed this value, but it might not be in this PROV
358369
entities = self.document.get_record(value["@id"])

test/test_parse_ga_export.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ def test_ga_history_loading(test_data_dir, tmpdir, helpers):
3131
def test_ga_history_parsing(test_data_dir, tmpdir, helpers):
3232
export_dir = "test_ga_history_export"
3333
export_path = test_data_dir / export_dir / "history_export"
34-
prov_path = "/home/padge/Elixir/workflow-export/ro-crate-py/test/test-data/test_ga_history_export/history_export/provenance"
34+
prov_path = export_path / "provenance"
3535
# prov_name = "ga_export.cwlprov"
3636
# crate_path = test_data_dir / export_dir / "history_export_crate"
3737

tools/load_ga_export.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -58,21 +58,21 @@ def parse_ga_jobs_attrs(self, job_attrs):
5858
self.attributes["parameters"].update(job_attrs[key])
5959

6060
class GalaxyDataset(Dict):
61-
def __init__(self, ga_export_dataset_attrs):
61+
def __init__(self):
6262
"""
6363
Initialize the GalaxyDataset object.
6464
"""
6565
self.attributes = {}
6666
self.attributes["metadata"] = {}
6767

68-
def parse_ga_dataset_attrs(self, job_attrs):
68+
def parse_ga_dataset_attrs(self, ds_attrs):
6969

70-
for key, value in job_attrs.items():
70+
for key, value in ds_attrs.items():
7171
if not isinstance(value, dict):
7272
self.attributes[key] = value
7373
else:
7474
if len(value) == 0:
7575
pass
7676
else:
7777
if "metadata" in key:
78-
self.attributes["metadata"].update(job_attrs[key])
78+
self.attributes["metadata"].update(ds_attrs[key])

0 commit comments

Comments
 (0)