mtbls-mhd-integration 0.0.13__py3-none-any.whl → 0.0.14__py3-none-any.whl

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.
mtbls2mhd/__init__.py CHANGED
@@ -1,4 +1,4 @@
1
- __version__ = "v0.0.13"
1
+ __version__ = "v0.0.14"
2
2
 
3
3
  import pathlib
4
4
  import sys
@@ -6,6 +6,7 @@ from mhd_model.model.definitions import (
6
6
  )
7
7
 
8
8
  from mtbls2mhd.v0_1.legacy.convertor import LegacyProfileV01Convertor
9
+ from mtbls2mhd.v0_1.ms.convertor import MsProfileConvertor
9
10
 
10
11
 
11
12
  class Mtbls2MhdConvertorFactory(BaseMhdConvertorFactory):
@@ -21,7 +22,10 @@ class Mtbls2MhdConvertorFactory(BaseMhdConvertorFactory):
21
22
  target_mhd_model_profile_uri=target_mhd_model_profile_uri,
22
23
  )
23
24
  elif target_mhd_model_profile_uri == MHD_MODEL_V0_1_MS_PROFILE_NAME:
24
- raise NotImplementedError()
25
+ return MsProfileConvertor(
26
+ target_mhd_model_schema_uri=target_mhd_model_schema_uri,
27
+ target_mhd_model_profile_uri=target_mhd_model_profile_uri,
28
+ )
25
29
  raise NotImplementedError()
26
30
  else:
27
31
  raise NotImplementedError()
@@ -1808,7 +1808,7 @@ class MhdLegacyDatasetBuilder:
1808
1808
  files_map,
1809
1809
  ) -> dict[str, mhd_domain.Assay]:
1810
1810
  protocol_summaries: OrderedDict[str, ProtocolRunSummary] = OrderedDict()
1811
- assays = dict[str, mhd_domain.Assay] = OrderedDict()
1811
+ assays: OrderedDict[str, mhd_domain.Assay] = OrderedDict()
1812
1812
  for assay in selected_assays:
1813
1813
  if assay.file_name not in data.assays:
1814
1814
  continue
@@ -1,3 +1,59 @@
1
- class Mtbs2MhdMsProfileConvertor:
2
- def convert():
3
- raise NotImplementedError()
1
+ from pathlib import Path
2
+
3
+ from mhd_model.convertors.mhd.convertor import BaseMhdConvertor
4
+ from mhd_model.shared.model import Revision
5
+
6
+ from mtbls2mhd.config import Mtbls2MhdConfiguration, get_default_config
7
+ from mtbls2mhd.v0_1.legacy.builder import BuildType, MhdLegacyDatasetBuilder
8
+
9
+
10
+ class MsProfileConvertor(BaseMhdConvertor):
11
+ def __init__(
12
+ self,
13
+ target_mhd_model_schema_uri: str,
14
+ target_mhd_model_profile_uri: str,
15
+ ):
16
+ self.target_mhd_model_schema_uri = target_mhd_model_schema_uri
17
+ self.target_mhd_model_profile_uri = target_mhd_model_profile_uri
18
+
19
+ def convert(
20
+ self,
21
+ repository_name: str,
22
+ repository_identifier: str,
23
+ mhd_identifier: None | str,
24
+ repository_revision: None | Revision = None,
25
+ config: None | Mtbls2MhdConfiguration = None, # noqa: F821
26
+ cached_mtbls_model_file_path: None | str = None,
27
+ **kwargs,
28
+ ):
29
+ if not config:
30
+ config = get_default_config()
31
+ mhd_dataset_builder = MhdLegacyDatasetBuilder()
32
+ mtbls_study_repository_url = (
33
+ f"{config.study_http_base_url}/{repository_identifier}"
34
+ )
35
+
36
+ mtbls_study_path = Path(config.mtbls_studies_root_path) / Path(
37
+ repository_identifier
38
+ )
39
+ try:
40
+ success, message = mhd_dataset_builder.build(
41
+ mhd_id=mhd_identifier,
42
+ mtbls_study_id=repository_identifier,
43
+ mtbls_study_path=mtbls_study_path,
44
+ mtbls_study_repository_url=mtbls_study_repository_url,
45
+ target_mhd_model_schema_uri=self.target_mhd_model_schema_uri,
46
+ target_mhd_model_profile_uri=self.target_mhd_model_profile_uri,
47
+ config=config,
48
+ cached_mtbls_model_file_path=cached_mtbls_model_file_path,
49
+ revision=repository_revision,
50
+ repository_name=repository_name,
51
+ build_type=BuildType.FULL_AND_CUSTOM_NODES,
52
+ **kwargs,
53
+ )
54
+ return success, message
55
+ except Exception as ex:
56
+ import traceback
57
+
58
+ traceback.print_exc()
59
+ return False, str(ex)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: mtbls-mhd-integration
3
- Version: 0.0.13
3
+ Version: 0.0.14
4
4
  Summary: MetaboLights - MetabolomicsHub Integration
5
5
  Author-email: MetaboLights Team <metabolights-help@ebi.ac.uk>
6
6
  License-Expression: Apache-2.0
@@ -1,6 +1,6 @@
1
- mtbls2mhd/__init__.py,sha256=9NntcMjl9WIHQAy6xlxCyDazWlWBRKDTjy517m_kTgc,158
1
+ mtbls2mhd/__init__.py,sha256=XpOJ1XATu_r7h8z0RvXDGIZ-JHycpLZFRO5bzsIc6W0,158
2
2
  mtbls2mhd/config.py,sha256=BjOqAyfDhp9byoFjJz70xh4HRR8pu1yrm_5jweqygSI,2310
3
- mtbls2mhd/convertor_factory.py,sha256=4loatqIRIvIhcaeIS0cSonJNYJu47o56ZllX6593ypk,1133
3
+ mtbls2mhd/convertor_factory.py,sha256=WNXgzLFq84whwv0phrB1B2L1YRabO2tD0nPDT9QJ6gQ,1365
4
4
  mtbls2mhd/commands/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
5
5
  mtbls2mhd/commands/cli.py,sha256=XhLcqBxmBNX_nSEc4aU9q2D9VoYvqZKeRuYLbt-JwZ8,662
6
6
  mtbls2mhd/commands/create.py,sha256=fcZO5Ez5yams95Zpx1vQjjagBiJzfnZrIKfk5Z6qoRw,452
@@ -8,16 +8,16 @@ mtbls2mhd/commands/create_mhd_file.py,sha256=0sDr-Cm0JhhEB5V1g66uoag3rlcaAnGP8Md
8
8
  mtbls2mhd/commands/validate.py,sha256=iwIKegviRxdH0r8scRXbDISlwQUzAq5uVoCHinU7x6Q,473
9
9
  mtbls2mhd/v0_1/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
10
10
  mtbls2mhd/v0_1/legacy/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
11
- mtbls2mhd/v0_1/legacy/builder.py,sha256=4V0jxjeXrKRFv9ojC0lg1l8aO1FDVTugrW1zh8L2VL4,90582
11
+ mtbls2mhd/v0_1/legacy/builder.py,sha256=EhTDcshxkQTs-vz60TZ6e2ECyn6ZwRaJRxJGKwilS0o,90588
12
12
  mtbls2mhd/v0_1/legacy/convertor.py,sha256=Nu6xJvEk8WsRQJQFoxM5eo-y46tVfWV8EkedVoqI9rI,2198
13
13
  mtbls2mhd/v0_1/legacy/db_metadata_collector.py,sha256=UGk1AeST1NQ9lWwy_sYZxaaWs0ajgaKELDJtXJ4-Uco,13071
14
14
  mtbls2mhd/v0_1/legacy/folder_metadata_collector.py,sha256=QwtXI9rBvdh6pxILQDHymIwYDqzGuMxqdOcqtdAObME,7538
15
15
  mtbls2mhd/v0_1/legacy/mtbls_study_schema.py,sha256=gUTbRmI8GfHI5leLiw8dxsmWnV3NnWw5RPX_LQWRFRQ,3162
16
16
  mtbls2mhd/v0_1/ms/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
17
- mtbls2mhd/v0_1/ms/convertor.py,sha256=kLIUpxOrH6hcs2Y9Bq1D0Mdvypg40pLyEJpHtGj6H_g,89
18
- mtbls_mhd_integration-0.0.13.dist-info/licenses/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
19
- mtbls_mhd_integration-0.0.13.dist-info/METADATA,sha256=pww_KrAeo8l_Ehfxht5GJIGyvPC-5bvJjNEr95sTOU4,688
20
- mtbls_mhd_integration-0.0.13.dist-info/WHEEL,sha256=wUyA8OaulRlbfwMtmQsvNngGrxQHAvkKcvRmdizlJi0,92
21
- mtbls_mhd_integration-0.0.13.dist-info/entry_points.txt,sha256=WQjM4flaYMyvHyv9zGKjCVk1i1_FGdNlhTmFVGgLgxs,61
22
- mtbls_mhd_integration-0.0.13.dist-info/top_level.txt,sha256=b7pI95n6HIQMFXDD0yL1NwldiDc-XdeWql4Iw-uYygQ,10
23
- mtbls_mhd_integration-0.0.13.dist-info/RECORD,,
17
+ mtbls2mhd/v0_1/ms/convertor.py,sha256=axkKDRx00ix6ceqJe9-KruEYEZOgaVtsAgCHiixPo5k,2201
18
+ mtbls_mhd_integration-0.0.14.dist-info/licenses/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
19
+ mtbls_mhd_integration-0.0.14.dist-info/METADATA,sha256=7Y-wIcfSz16osVnn30q1V4xd3I1A6kIsYDfcqHBEu0E,688
20
+ mtbls_mhd_integration-0.0.14.dist-info/WHEEL,sha256=wUyA8OaulRlbfwMtmQsvNngGrxQHAvkKcvRmdizlJi0,92
21
+ mtbls_mhd_integration-0.0.14.dist-info/entry_points.txt,sha256=WQjM4flaYMyvHyv9zGKjCVk1i1_FGdNlhTmFVGgLgxs,61
22
+ mtbls_mhd_integration-0.0.14.dist-info/top_level.txt,sha256=b7pI95n6HIQMFXDD0yL1NwldiDc-XdeWql4Iw-uYygQ,10
23
+ mtbls_mhd_integration-0.0.14.dist-info/RECORD,,