mtbls-mhd-integration 0.0.14__tar.gz → 0.0.15__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.
Files changed (28) hide show
  1. {mtbls_mhd_integration-0.0.14/mtbls_mhd_integration.egg-info → mtbls_mhd_integration-0.0.15}/PKG-INFO +3 -3
  2. {mtbls_mhd_integration-0.0.14 → mtbls_mhd_integration-0.0.15}/mtbls2mhd/__init__.py +1 -1
  3. {mtbls_mhd_integration-0.0.14 → mtbls_mhd_integration-0.0.15}/mtbls2mhd/v0_1/legacy/builder.py +66 -20
  4. {mtbls_mhd_integration-0.0.14 → mtbls_mhd_integration-0.0.15/mtbls_mhd_integration.egg-info}/PKG-INFO +3 -3
  5. {mtbls_mhd_integration-0.0.14 → mtbls_mhd_integration-0.0.15}/mtbls_mhd_integration.egg-info/requires.txt +2 -2
  6. {mtbls_mhd_integration-0.0.14 → mtbls_mhd_integration-0.0.15}/pyproject.toml +4 -4
  7. {mtbls_mhd_integration-0.0.14 → mtbls_mhd_integration-0.0.15}/LICENSE +0 -0
  8. {mtbls_mhd_integration-0.0.14 → mtbls_mhd_integration-0.0.15}/README.md +0 -0
  9. {mtbls_mhd_integration-0.0.14 → mtbls_mhd_integration-0.0.15}/mtbls2mhd/commands/__init__.py +0 -0
  10. {mtbls_mhd_integration-0.0.14 → mtbls_mhd_integration-0.0.15}/mtbls2mhd/commands/cli.py +0 -0
  11. {mtbls_mhd_integration-0.0.14 → mtbls_mhd_integration-0.0.15}/mtbls2mhd/commands/create.py +0 -0
  12. {mtbls_mhd_integration-0.0.14 → mtbls_mhd_integration-0.0.15}/mtbls2mhd/commands/create_mhd_file.py +0 -0
  13. {mtbls_mhd_integration-0.0.14 → mtbls_mhd_integration-0.0.15}/mtbls2mhd/commands/validate.py +0 -0
  14. {mtbls_mhd_integration-0.0.14 → mtbls_mhd_integration-0.0.15}/mtbls2mhd/config.py +0 -0
  15. {mtbls_mhd_integration-0.0.14 → mtbls_mhd_integration-0.0.15}/mtbls2mhd/convertor_factory.py +0 -0
  16. {mtbls_mhd_integration-0.0.14 → mtbls_mhd_integration-0.0.15}/mtbls2mhd/v0_1/__init__.py +0 -0
  17. {mtbls_mhd_integration-0.0.14 → mtbls_mhd_integration-0.0.15}/mtbls2mhd/v0_1/legacy/__init__.py +0 -0
  18. {mtbls_mhd_integration-0.0.14 → mtbls_mhd_integration-0.0.15}/mtbls2mhd/v0_1/legacy/convertor.py +0 -0
  19. {mtbls_mhd_integration-0.0.14 → mtbls_mhd_integration-0.0.15}/mtbls2mhd/v0_1/legacy/db_metadata_collector.py +0 -0
  20. {mtbls_mhd_integration-0.0.14 → mtbls_mhd_integration-0.0.15}/mtbls2mhd/v0_1/legacy/folder_metadata_collector.py +0 -0
  21. {mtbls_mhd_integration-0.0.14 → mtbls_mhd_integration-0.0.15}/mtbls2mhd/v0_1/legacy/mtbls_study_schema.py +0 -0
  22. {mtbls_mhd_integration-0.0.14 → mtbls_mhd_integration-0.0.15}/mtbls2mhd/v0_1/ms/__init__.py +0 -0
  23. {mtbls_mhd_integration-0.0.14 → mtbls_mhd_integration-0.0.15}/mtbls2mhd/v0_1/ms/convertor.py +0 -0
  24. {mtbls_mhd_integration-0.0.14 → mtbls_mhd_integration-0.0.15}/mtbls_mhd_integration.egg-info/SOURCES.txt +0 -0
  25. {mtbls_mhd_integration-0.0.14 → mtbls_mhd_integration-0.0.15}/mtbls_mhd_integration.egg-info/dependency_links.txt +0 -0
  26. {mtbls_mhd_integration-0.0.14 → mtbls_mhd_integration-0.0.15}/mtbls_mhd_integration.egg-info/entry_points.txt +0 -0
  27. {mtbls_mhd_integration-0.0.14 → mtbls_mhd_integration-0.0.15}/mtbls_mhd_integration.egg-info/top_level.txt +0 -0
  28. {mtbls_mhd_integration-0.0.14 → mtbls_mhd_integration-0.0.15}/setup.cfg +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: mtbls-mhd-integration
3
- Version: 0.0.14
3
+ Version: 0.0.15
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.16
12
- Requires-Dist: mhd-model>=0.1.43
11
+ Requires-Dist: metabolights-utils>=1.4.18
12
+ Requires-Dist: mhd-model>=0.1.44
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,4 +1,4 @@
1
- __version__ = "v0.0.14"
1
+ __version__ = "v0.0.15"
2
2
 
3
3
  import pathlib
4
4
  import sys
@@ -361,14 +361,14 @@ class MhdLegacyDatasetBuilder:
361
361
  reverse_relationship_name="affiliates",
362
362
  )
363
363
  for role in contact.roles:
364
- if role.term == "principal investigator":
364
+ if role.term.lower() == "principal investigator":
365
365
  mhd_builder.link(
366
366
  mhd_contact,
367
367
  "principal-investigator-of",
368
368
  mhd_study,
369
369
  reverse_relationship_name="has-principal-investigator",
370
370
  )
371
- elif role.term == "submitter":
371
+ elif role.term.lower() == "submitter":
372
372
  mhd_builder.link(
373
373
  mhd_contact,
374
374
  "submits",
@@ -449,6 +449,46 @@ class MhdLegacyDatasetBuilder:
449
449
 
450
450
  return organizations
451
451
 
452
+ def add_funders(
453
+ self,
454
+ data: MetabolightsStudyModel,
455
+ mhd_builder: MhDatasetBuilder,
456
+ mhd_study: mhd_domain.Study,
457
+ organizations: dict[str, mhd_domain.Organization],
458
+ build_type: BuildType = BuildType.FULL,
459
+ ):
460
+ if build_type == build_type.MINIMUM:
461
+ return
462
+ study: Study = data.investigation.studies[0]
463
+ comments = {x.name: x for x in study.comments if x and x.name}
464
+ grant_ids = []
465
+ if comments.get("Funder") and comments["Funder"].value:
466
+ if isinstance(comments["Funder"].value, str):
467
+ funders = comments["Funder"].value.split(";") or []
468
+ else:
469
+ funders = comments["Funder"].value[0].split(";") or []
470
+ for funder in funders:
471
+ organization = organizations.get(funder)
472
+ if not organization:
473
+ organization = mhd_domain.Organization(name=funder)
474
+ mhd_builder.add(organization)
475
+ organizations[funder] = organization
476
+ mhd_builder.link(
477
+ mhd_study,
478
+ "funded-by",
479
+ organization,
480
+ reverse_relationship_name="funds",
481
+ )
482
+ grants = comments.get("Grant Identifier")
483
+ if grants and grants.value:
484
+ if isinstance(grants.value, str):
485
+ identifiers = grants.value.split(";")
486
+ else:
487
+ identifiers = grants.value[0].split(";")
488
+ if identifiers:
489
+ grant_ids.extend(identifiers)
490
+ mhd_study.grant_identifier_list = grant_ids
491
+
452
492
  def add_publications(
453
493
  self,
454
494
  data: MetabolightsStudyModel,
@@ -1864,28 +1904,32 @@ class MhdLegacyDatasetBuilder:
1864
1904
  )
1865
1905
  mhd_builder.add(assay_type)
1866
1906
  mhd_assay.assay_type_ref = assay_type.id_
1907
+ omics_types: list[mhd_domain.CvTermObject] = []
1908
+ measurement_types: list[mhd_domain.CvTermObject] = []
1909
+ measurement = None
1910
+ if "untargeted" in assay.measurement_type.term.lower():
1911
+ measurement = MTBLS_MEASUREMENT_TYPES["untargeted"]
1912
+ elif "targeted" in assay.measurement_type.term.lower():
1913
+ measurement = MTBLS_MEASUREMENT_TYPES["targeted"]
1867
1914
 
1868
1915
  inv_study = data.investigation.studies[0]
1869
1916
  design_types = inv_study.study_design_descriptors.design_types
1870
1917
 
1871
- omics_types: list[mhd_domain.CvTermObject] = []
1872
- measurement_types: list[mhd_domain.CvTermObject] = []
1873
1918
  for descriptor in design_types:
1874
- measurement = None
1875
- if "untargeted" in descriptor.term.lower():
1876
- measurement = MTBLS_MEASUREMENT_TYPES["untargeted"]
1877
- elif "targeted" in descriptor.term.lower():
1878
- measurement = MTBLS_MEASUREMENT_TYPES["targeted"]
1879
-
1880
- if measurement:
1881
- measurement_type = create_cv_term_object(
1882
- type_="descriptor",
1883
- source=measurement.source,
1884
- accession=measurement.accession,
1885
- name=measurement.name,
1886
- )
1887
- measurement_types.append(measurement_type)
1888
-
1919
+ if not measurement:
1920
+ if "untargeted" in descriptor.term.lower():
1921
+ measurement = MTBLS_MEASUREMENT_TYPES["untargeted"]
1922
+ elif "targeted" in descriptor.term.lower():
1923
+ measurement = MTBLS_MEASUREMENT_TYPES["targeted"]
1924
+
1925
+ if measurement:
1926
+ measurement_type = create_cv_term_object(
1927
+ type_="descriptor",
1928
+ source=measurement.source,
1929
+ accession=measurement.accession,
1930
+ name=measurement.name,
1931
+ )
1932
+ measurement_types.append(measurement_type)
1889
1933
  for v in COMMON_OMICS_TYPES.values():
1890
1934
  if descriptor.term.lower() == v.name.lower():
1891
1935
  omics_type = create_cv_term_object(
@@ -2110,7 +2154,9 @@ class MhdLegacyDatasetBuilder:
2110
2154
  reverse_relationship_name="provided-by",
2111
2155
  )
2112
2156
 
2113
- self.add_contacts(data, mhd_builder, mhd_study, build_type)
2157
+ organizations = self.add_contacts(data, mhd_builder, mhd_study, build_type)
2158
+ self.add_funders(data, mhd_builder, mhd_study, organizations, build_type)
2159
+
2114
2160
  metadata_files = self.add_metadata_files(
2115
2161
  mhd_builder,
2116
2162
  mhd_study,
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: mtbls-mhd-integration
3
- Version: 0.0.14
3
+ Version: 0.0.15
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.16
12
- Requires-Dist: mhd-model>=0.1.43
11
+ Requires-Dist: metabolights-utils>=1.4.18
12
+ Requires-Dist: mhd-model>=0.1.44
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
  asyncpg>=0.30.0
2
- metabolights-utils>=1.4.16
3
- mhd-model>=0.1.43
2
+ metabolights-utils>=1.4.18
3
+ mhd-model>=0.1.44
4
4
  psycopg[binary,pool]>=3.3.2
5
5
  pydantic>=2.12.4
6
6
  pydantic-settings>=2.10.1
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "mtbls-mhd-integration"
3
- version = "0.0.14"
3
+ version = "0.0.15"
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.16",
12
- "mhd-model>=0.1.43",
11
+ "metabolights-utils>=1.4.18",
12
+ "mhd-model>=0.1.44",
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.143"
57
+ version = "0.0.153"
58
58
  tag_format = "v$major.$minor.$patch"
59
59
  version_files = [
60
60
  "pyproject.toml:version",