mtbls-mhd-integration 0.0.14__tar.gz → 0.0.16__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {mtbls_mhd_integration-0.0.14/mtbls_mhd_integration.egg-info → mtbls_mhd_integration-0.0.16}/PKG-INFO +3 -3
- {mtbls_mhd_integration-0.0.14 → mtbls_mhd_integration-0.0.16}/mtbls2mhd/__init__.py +1 -1
- {mtbls_mhd_integration-0.0.14 → mtbls_mhd_integration-0.0.16}/mtbls2mhd/v0_1/legacy/builder.py +83 -30
- {mtbls_mhd_integration-0.0.14 → mtbls_mhd_integration-0.0.16/mtbls_mhd_integration.egg-info}/PKG-INFO +3 -3
- {mtbls_mhd_integration-0.0.14 → mtbls_mhd_integration-0.0.16}/mtbls_mhd_integration.egg-info/requires.txt +2 -2
- {mtbls_mhd_integration-0.0.14 → mtbls_mhd_integration-0.0.16}/pyproject.toml +4 -4
- {mtbls_mhd_integration-0.0.14 → mtbls_mhd_integration-0.0.16}/LICENSE +0 -0
- {mtbls_mhd_integration-0.0.14 → mtbls_mhd_integration-0.0.16}/README.md +0 -0
- {mtbls_mhd_integration-0.0.14 → mtbls_mhd_integration-0.0.16}/mtbls2mhd/commands/__init__.py +0 -0
- {mtbls_mhd_integration-0.0.14 → mtbls_mhd_integration-0.0.16}/mtbls2mhd/commands/cli.py +0 -0
- {mtbls_mhd_integration-0.0.14 → mtbls_mhd_integration-0.0.16}/mtbls2mhd/commands/create.py +0 -0
- {mtbls_mhd_integration-0.0.14 → mtbls_mhd_integration-0.0.16}/mtbls2mhd/commands/create_mhd_file.py +0 -0
- {mtbls_mhd_integration-0.0.14 → mtbls_mhd_integration-0.0.16}/mtbls2mhd/commands/validate.py +0 -0
- {mtbls_mhd_integration-0.0.14 → mtbls_mhd_integration-0.0.16}/mtbls2mhd/config.py +0 -0
- {mtbls_mhd_integration-0.0.14 → mtbls_mhd_integration-0.0.16}/mtbls2mhd/convertor_factory.py +0 -0
- {mtbls_mhd_integration-0.0.14 → mtbls_mhd_integration-0.0.16}/mtbls2mhd/v0_1/__init__.py +0 -0
- {mtbls_mhd_integration-0.0.14 → mtbls_mhd_integration-0.0.16}/mtbls2mhd/v0_1/legacy/__init__.py +0 -0
- {mtbls_mhd_integration-0.0.14 → mtbls_mhd_integration-0.0.16}/mtbls2mhd/v0_1/legacy/convertor.py +0 -0
- {mtbls_mhd_integration-0.0.14 → mtbls_mhd_integration-0.0.16}/mtbls2mhd/v0_1/legacy/db_metadata_collector.py +0 -0
- {mtbls_mhd_integration-0.0.14 → mtbls_mhd_integration-0.0.16}/mtbls2mhd/v0_1/legacy/folder_metadata_collector.py +0 -0
- {mtbls_mhd_integration-0.0.14 → mtbls_mhd_integration-0.0.16}/mtbls2mhd/v0_1/legacy/mtbls_study_schema.py +0 -0
- {mtbls_mhd_integration-0.0.14 → mtbls_mhd_integration-0.0.16}/mtbls2mhd/v0_1/ms/__init__.py +0 -0
- {mtbls_mhd_integration-0.0.14 → mtbls_mhd_integration-0.0.16}/mtbls2mhd/v0_1/ms/convertor.py +0 -0
- {mtbls_mhd_integration-0.0.14 → mtbls_mhd_integration-0.0.16}/mtbls_mhd_integration.egg-info/SOURCES.txt +0 -0
- {mtbls_mhd_integration-0.0.14 → mtbls_mhd_integration-0.0.16}/mtbls_mhd_integration.egg-info/dependency_links.txt +0 -0
- {mtbls_mhd_integration-0.0.14 → mtbls_mhd_integration-0.0.16}/mtbls_mhd_integration.egg-info/entry_points.txt +0 -0
- {mtbls_mhd_integration-0.0.14 → mtbls_mhd_integration-0.0.16}/mtbls_mhd_integration.egg-info/top_level.txt +0 -0
- {mtbls_mhd_integration-0.0.14 → mtbls_mhd_integration-0.0.16}/setup.cfg +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: mtbls-mhd-integration
|
|
3
|
-
Version: 0.0.
|
|
3
|
+
Version: 0.0.16
|
|
4
4
|
Summary: MetaboLights - MetabolomicsHub Integration
|
|
5
5
|
Author-email: MetaboLights Team <metabolights-help@ebi.ac.uk>
|
|
6
6
|
License-Expression: Apache-2.0
|
|
@@ -8,8 +8,8 @@ Requires-Python: <4.0,>=3.12
|
|
|
8
8
|
Description-Content-Type: text/markdown
|
|
9
9
|
License-File: LICENSE
|
|
10
10
|
Requires-Dist: asyncpg>=0.30.0
|
|
11
|
-
Requires-Dist: metabolights-utils>=1.4.
|
|
12
|
-
Requires-Dist: mhd-model>=0.1.
|
|
11
|
+
Requires-Dist: metabolights-utils>=1.4.18
|
|
12
|
+
Requires-Dist: mhd-model>=0.1.45
|
|
13
13
|
Requires-Dist: psycopg[binary,pool]>=3.3.2
|
|
14
14
|
Requires-Dist: pydantic>=2.12.4
|
|
15
15
|
Requires-Dist: pydantic-settings>=2.10.1
|
{mtbls_mhd_integration-0.0.14 → mtbls_mhd_integration-0.0.16}/mtbls2mhd/v0_1/legacy/builder.py
RENAMED
|
@@ -283,6 +283,7 @@ class MhdLegacyDatasetBuilder:
|
|
|
283
283
|
if x
|
|
284
284
|
]
|
|
285
285
|
),
|
|
286
|
+
email_list=[submitter.user_name],
|
|
286
287
|
)
|
|
287
288
|
mhd_builder.add(mhd_contact)
|
|
288
289
|
mhd_builder.link(
|
|
@@ -331,6 +332,11 @@ class MhdLegacyDatasetBuilder:
|
|
|
331
332
|
idx,
|
|
332
333
|
)
|
|
333
334
|
continue
|
|
335
|
+
if contact.additional_emails:
|
|
336
|
+
if mhd_contact.email_list:
|
|
337
|
+
mhd_contact.email_list.extend(contact.additional_emails)
|
|
338
|
+
else:
|
|
339
|
+
mhd_contact.email_list = contact.additional_emails
|
|
334
340
|
if not mhd_contact.email_list:
|
|
335
341
|
logger.warning(
|
|
336
342
|
"%s study %s. contact's ('%s') email is empty. Contact will be ignored.",
|
|
@@ -360,15 +366,19 @@ class MhdLegacyDatasetBuilder:
|
|
|
360
366
|
organization,
|
|
361
367
|
reverse_relationship_name="affiliates",
|
|
362
368
|
)
|
|
369
|
+
roles = set()
|
|
363
370
|
for role in contact.roles:
|
|
364
|
-
if role.term
|
|
371
|
+
if role.term.lower() in roles:
|
|
372
|
+
continue
|
|
373
|
+
roles.add(role.term.lower())
|
|
374
|
+
if role.term.lower() == "principal investigator":
|
|
365
375
|
mhd_builder.link(
|
|
366
376
|
mhd_contact,
|
|
367
377
|
"principal-investigator-of",
|
|
368
378
|
mhd_study,
|
|
369
379
|
reverse_relationship_name="has-principal-investigator",
|
|
370
380
|
)
|
|
371
|
-
elif role.term == "submitter":
|
|
381
|
+
elif role.term.lower() == "submitter":
|
|
372
382
|
mhd_builder.link(
|
|
373
383
|
mhd_contact,
|
|
374
384
|
"submits",
|
|
@@ -429,7 +439,7 @@ class MhdLegacyDatasetBuilder:
|
|
|
429
439
|
else:
|
|
430
440
|
mhd_contact = contacts[submitter.user_name]
|
|
431
441
|
submitter_roles = [
|
|
432
|
-
x for x in contact.roles if x.term == "submitter"
|
|
442
|
+
x for x in contact.roles if x.term.lower() == "submitter"
|
|
433
443
|
]
|
|
434
444
|
if not submitter_roles:
|
|
435
445
|
mhd_builder.link(
|
|
@@ -449,6 +459,46 @@ class MhdLegacyDatasetBuilder:
|
|
|
449
459
|
|
|
450
460
|
return organizations
|
|
451
461
|
|
|
462
|
+
def add_funders(
|
|
463
|
+
self,
|
|
464
|
+
data: MetabolightsStudyModel,
|
|
465
|
+
mhd_builder: MhDatasetBuilder,
|
|
466
|
+
mhd_study: mhd_domain.Study,
|
|
467
|
+
organizations: dict[str, mhd_domain.Organization],
|
|
468
|
+
build_type: BuildType = BuildType.FULL,
|
|
469
|
+
):
|
|
470
|
+
if build_type == build_type.MINIMUM:
|
|
471
|
+
return
|
|
472
|
+
study: Study = data.investigation.studies[0]
|
|
473
|
+
comments = {x.name: x for x in study.comments if x and x.name}
|
|
474
|
+
grant_ids = []
|
|
475
|
+
if comments.get("Funder") and comments["Funder"].value:
|
|
476
|
+
if isinstance(comments["Funder"].value, str):
|
|
477
|
+
funders = comments["Funder"].value.split(";") or []
|
|
478
|
+
else:
|
|
479
|
+
funders = comments["Funder"].value[0].split(";") or []
|
|
480
|
+
for funder in funders:
|
|
481
|
+
organization = organizations.get(funder)
|
|
482
|
+
if not organization:
|
|
483
|
+
organization = mhd_domain.Organization(name=funder)
|
|
484
|
+
mhd_builder.add(organization)
|
|
485
|
+
organizations[funder] = organization
|
|
486
|
+
mhd_builder.link(
|
|
487
|
+
mhd_study,
|
|
488
|
+
"funded-by",
|
|
489
|
+
organization,
|
|
490
|
+
reverse_relationship_name="funds",
|
|
491
|
+
)
|
|
492
|
+
grants = comments.get("Grant Identifier")
|
|
493
|
+
if grants and grants.value:
|
|
494
|
+
if isinstance(grants.value, str):
|
|
495
|
+
identifiers = grants.value.split(";")
|
|
496
|
+
else:
|
|
497
|
+
identifiers = grants.value[0].split(";")
|
|
498
|
+
if identifiers:
|
|
499
|
+
grant_ids.extend(identifiers)
|
|
500
|
+
mhd_study.grant_identifier_list = grant_ids
|
|
501
|
+
|
|
452
502
|
def add_publications(
|
|
453
503
|
self,
|
|
454
504
|
data: MetabolightsStudyModel,
|
|
@@ -1447,17 +1497,17 @@ class MhdLegacyDatasetBuilder:
|
|
|
1447
1497
|
)
|
|
1448
1498
|
mhd_builder.add_node(keyword)
|
|
1449
1499
|
|
|
1450
|
-
if item.source
|
|
1500
|
+
if not item.source or item.source.lower() in ("submitter",):
|
|
1451
1501
|
mhd_builder.link(
|
|
1452
1502
|
mhd_study,
|
|
1453
|
-
"has-
|
|
1503
|
+
"has-submitter-keyword",
|
|
1454
1504
|
keyword,
|
|
1455
1505
|
reverse_relationship_name="keyword-of",
|
|
1456
1506
|
)
|
|
1457
1507
|
else:
|
|
1458
1508
|
mhd_builder.link(
|
|
1459
1509
|
mhd_study,
|
|
1460
|
-
"has-
|
|
1510
|
+
"has-repository-keyword",
|
|
1461
1511
|
keyword,
|
|
1462
1512
|
reverse_relationship_name="keyword-of",
|
|
1463
1513
|
)
|
|
@@ -1485,20 +1535,17 @@ class MhdLegacyDatasetBuilder:
|
|
|
1485
1535
|
)
|
|
1486
1536
|
mhd_builder.add_node(keyword)
|
|
1487
1537
|
|
|
1488
|
-
if item.source
|
|
1489
|
-
"data-curation",
|
|
1490
|
-
"workflows",
|
|
1491
|
-
):
|
|
1538
|
+
if not item.source or item.source.lower() in ("submitter",):
|
|
1492
1539
|
mhd_builder.link(
|
|
1493
1540
|
mhd_assay,
|
|
1494
|
-
"has-
|
|
1541
|
+
"has-submitter-keyword",
|
|
1495
1542
|
keyword,
|
|
1496
1543
|
reverse_relationship_name="keyword-of",
|
|
1497
1544
|
)
|
|
1498
1545
|
else:
|
|
1499
1546
|
mhd_builder.link(
|
|
1500
1547
|
mhd_assay,
|
|
1501
|
-
"has-
|
|
1548
|
+
"has-repository-keyword",
|
|
1502
1549
|
keyword,
|
|
1503
1550
|
reverse_relationship_name="keyword-of",
|
|
1504
1551
|
)
|
|
@@ -1864,28 +1911,32 @@ class MhdLegacyDatasetBuilder:
|
|
|
1864
1911
|
)
|
|
1865
1912
|
mhd_builder.add(assay_type)
|
|
1866
1913
|
mhd_assay.assay_type_ref = assay_type.id_
|
|
1914
|
+
omics_types: list[mhd_domain.CvTermObject] = []
|
|
1915
|
+
measurement_types: list[mhd_domain.CvTermObject] = []
|
|
1916
|
+
measurement = None
|
|
1917
|
+
if "untargeted" in assay.measurement_type.term.lower():
|
|
1918
|
+
measurement = MTBLS_MEASUREMENT_TYPES["untargeted"]
|
|
1919
|
+
elif "targeted" in assay.measurement_type.term.lower():
|
|
1920
|
+
measurement = MTBLS_MEASUREMENT_TYPES["targeted"]
|
|
1867
1921
|
|
|
1868
1922
|
inv_study = data.investigation.studies[0]
|
|
1869
1923
|
design_types = inv_study.study_design_descriptors.design_types
|
|
1870
1924
|
|
|
1871
|
-
omics_types: list[mhd_domain.CvTermObject] = []
|
|
1872
|
-
measurement_types: list[mhd_domain.CvTermObject] = []
|
|
1873
1925
|
for descriptor in design_types:
|
|
1874
|
-
|
|
1875
|
-
|
|
1876
|
-
|
|
1877
|
-
|
|
1878
|
-
|
|
1879
|
-
|
|
1880
|
-
|
|
1881
|
-
|
|
1882
|
-
|
|
1883
|
-
|
|
1884
|
-
|
|
1885
|
-
|
|
1886
|
-
|
|
1887
|
-
|
|
1888
|
-
|
|
1926
|
+
if not measurement:
|
|
1927
|
+
if "untargeted" in descriptor.term.lower():
|
|
1928
|
+
measurement = MTBLS_MEASUREMENT_TYPES["untargeted"]
|
|
1929
|
+
elif "targeted" in descriptor.term.lower():
|
|
1930
|
+
measurement = MTBLS_MEASUREMENT_TYPES["targeted"]
|
|
1931
|
+
|
|
1932
|
+
if measurement:
|
|
1933
|
+
measurement_type = create_cv_term_object(
|
|
1934
|
+
type_="descriptor",
|
|
1935
|
+
source=measurement.source,
|
|
1936
|
+
accession=measurement.accession,
|
|
1937
|
+
name=measurement.name,
|
|
1938
|
+
)
|
|
1939
|
+
measurement_types.append(measurement_type)
|
|
1889
1940
|
for v in COMMON_OMICS_TYPES.values():
|
|
1890
1941
|
if descriptor.term.lower() == v.name.lower():
|
|
1891
1942
|
omics_type = create_cv_term_object(
|
|
@@ -2110,7 +2161,9 @@ class MhdLegacyDatasetBuilder:
|
|
|
2110
2161
|
reverse_relationship_name="provided-by",
|
|
2111
2162
|
)
|
|
2112
2163
|
|
|
2113
|
-
self.add_contacts(data, mhd_builder, mhd_study, build_type)
|
|
2164
|
+
organizations = self.add_contacts(data, mhd_builder, mhd_study, build_type)
|
|
2165
|
+
self.add_funders(data, mhd_builder, mhd_study, organizations, build_type)
|
|
2166
|
+
|
|
2114
2167
|
metadata_files = self.add_metadata_files(
|
|
2115
2168
|
mhd_builder,
|
|
2116
2169
|
mhd_study,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: mtbls-mhd-integration
|
|
3
|
-
Version: 0.0.
|
|
3
|
+
Version: 0.0.16
|
|
4
4
|
Summary: MetaboLights - MetabolomicsHub Integration
|
|
5
5
|
Author-email: MetaboLights Team <metabolights-help@ebi.ac.uk>
|
|
6
6
|
License-Expression: Apache-2.0
|
|
@@ -8,8 +8,8 @@ Requires-Python: <4.0,>=3.12
|
|
|
8
8
|
Description-Content-Type: text/markdown
|
|
9
9
|
License-File: LICENSE
|
|
10
10
|
Requires-Dist: asyncpg>=0.30.0
|
|
11
|
-
Requires-Dist: metabolights-utils>=1.4.
|
|
12
|
-
Requires-Dist: mhd-model>=0.1.
|
|
11
|
+
Requires-Dist: metabolights-utils>=1.4.18
|
|
12
|
+
Requires-Dist: mhd-model>=0.1.45
|
|
13
13
|
Requires-Dist: psycopg[binary,pool]>=3.3.2
|
|
14
14
|
Requires-Dist: pydantic>=2.12.4
|
|
15
15
|
Requires-Dist: pydantic-settings>=2.10.1
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
[project]
|
|
2
2
|
name = "mtbls-mhd-integration"
|
|
3
|
-
version = "0.0.
|
|
3
|
+
version = "0.0.16"
|
|
4
4
|
description = "MetaboLights - MetabolomicsHub Integration"
|
|
5
5
|
authors = [{"name" = "MetaboLights Team", "email" = "metabolights-help@ebi.ac.uk"}]
|
|
6
6
|
license = "Apache-2.0"
|
|
@@ -8,8 +8,8 @@ readme = "README.md"
|
|
|
8
8
|
requires-python = ">=3.12,<4.0"
|
|
9
9
|
dependencies = [
|
|
10
10
|
"asyncpg>=0.30.0",
|
|
11
|
-
"metabolights-utils>=1.4.
|
|
12
|
-
"mhd-model>=0.1.
|
|
11
|
+
"metabolights-utils>=1.4.18",
|
|
12
|
+
"mhd-model>=0.1.45",
|
|
13
13
|
"psycopg[binary,pool]>=3.3.2",
|
|
14
14
|
"pydantic>=2.12.4",
|
|
15
15
|
"pydantic-settings>=2.10.1",
|
|
@@ -54,7 +54,7 @@ exclude = ["tests*", "docs*"]
|
|
|
54
54
|
[tool.commitizen]
|
|
55
55
|
name = "cz_conventional_commits"
|
|
56
56
|
version_provider = "uv"
|
|
57
|
-
version = "0.0.
|
|
57
|
+
version = "0.0.163"
|
|
58
58
|
tag_format = "v$major.$minor.$patch"
|
|
59
59
|
version_files = [
|
|
60
60
|
"pyproject.toml:version",
|
|
File without changes
|
|
File without changes
|
{mtbls_mhd_integration-0.0.14 → mtbls_mhd_integration-0.0.16}/mtbls2mhd/commands/__init__.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
{mtbls_mhd_integration-0.0.14 → mtbls_mhd_integration-0.0.16}/mtbls2mhd/commands/create_mhd_file.py
RENAMED
|
File without changes
|
{mtbls_mhd_integration-0.0.14 → mtbls_mhd_integration-0.0.16}/mtbls2mhd/commands/validate.py
RENAMED
|
File without changes
|
|
File without changes
|
{mtbls_mhd_integration-0.0.14 → mtbls_mhd_integration-0.0.16}/mtbls2mhd/convertor_factory.py
RENAMED
|
File without changes
|
|
File without changes
|
{mtbls_mhd_integration-0.0.14 → mtbls_mhd_integration-0.0.16}/mtbls2mhd/v0_1/legacy/__init__.py
RENAMED
|
File without changes
|
{mtbls_mhd_integration-0.0.14 → mtbls_mhd_integration-0.0.16}/mtbls2mhd/v0_1/legacy/convertor.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{mtbls_mhd_integration-0.0.14 → mtbls_mhd_integration-0.0.16}/mtbls2mhd/v0_1/ms/convertor.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|