Skip to content

Commit

Permalink
Merge pull request #49 from oyurekten/metabolights-data-type-support
Browse files Browse the repository at this point in the history
new and updated values for DataTypeEnum
  • Loading branch information
kdp-cloud authored Sep 30, 2024
2 parents b901090 + a724d42 commit 90dd5df
Show file tree
Hide file tree
Showing 3 changed files with 105 additions and 86 deletions.
16 changes: 13 additions & 3 deletions mars-cli/mars_lib/models/isa_json.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,18 @@ class DataTypeEnum(str, Enum):
RAW_DATA_FILE = "Raw Data File"
DERIVED_DATA_FILE = "Derived Data File"
IMAGE_FILE = "Image File"
SPECTRAL_RAW_DATA_FILE = "Spectral Raw Data File" # TODO: QUESTION: This is not mentioned in the specs (https://isa-specs.readthedocs.io/)
FREE_INDUCTION_DECAY_FILE = "Free Induction Decay File" # TODO: QUESTION: This is not mentioned in the specs (https://isa-specs.readthedocs.io/)
# The following names are not mentioned in the specs (https://isa-specs.readthedocs.io/en/latest/isajson.html#data-schema-json).
# However, spectral data file names are mentioned in the ISA-Tab specs (https://isa-specs.readthedocs.io/en/latest/isatab.html).
# TODO: Review and support all possible data file names mentioned in the the ISA-Tab specs (Section 2.3.8).
# Metabolights support the following data file types:
RAW_SPECTRAL_DATA_FILE = "Raw Spectral Data File"
DERIVED_SPECTRAL_DATA_FILE = "Derived Spectral Data File"
FREE_INDUCTION_DECAY_DATA_FILE = "Free Induction Decay Data File"
ACQUSITION_PARAMETER_DATA_FILE = "Acquisition Parameter Data File"
METABOLITE_ASSIGNMENT_FILE = "Metabolite Assignment File" # Used in MetaboLights to report metabolite assignments


DATA_TYPE_VALUES = {item.value for item in DataTypeEnum}


class Data(IsaBase):
Expand All @@ -43,7 +53,7 @@ class Data(IsaBase):

@field_validator("type")
def apply_enum(cls, v: str) -> str:
if v not in [item.value for item in DataTypeEnum]:
if v not in DATA_TYPE_VALUES:
raise ValueError("Invalid material type")
return v

Expand Down
93 changes: 51 additions & 42 deletions test-data/ISA-BH2023-ALL/isa-bh2023-all.json
Original file line number Diff line number Diff line change
Expand Up @@ -65,59 +65,65 @@
}
],
"dataFiles": [
{
"@id": "#data_file/4dd85c35-6e70-4541-99ac-324328f817eb",
"comments": [],
"name": "m_BH2023___metabolite_profiling_v2_maf.tsv",
"type": "Metabolite Assignment File"
},
{
"@id": "#data_file/b3530ec1-6bc5-4757-a526-81c1773530a6",
"comments": [],
"name": "isotopologue-distribution-analysis.txt",
"type": "Derived Data File"
"type": "Derived Spectral Data File"
},
{
"@id": "#data_file/2647db5f-0ed8-4536-aec7-8d5d4cfc65d3",
"comments": [],
"name": "ms-data-0.mzml",
"type": "Spectral Raw Data File"
"type": "Raw Spectral Data File"
},
{
"@id": "#data_file/d3cf3b1f-f375-4763-8837-89d9f453116c",
"comments": [],
"name": "ms-data-1.mzml",
"type": "Spectral Raw Data File"
"type": "Raw Spectral Data File"
},
{
"@id": "#data_file/ca61e6d1-0cab-45be-b333-e45583e06311",
"comments": [],
"name": "ms-data-2.mzml",
"type": "Spectral Raw Data File"
"type": "Raw Spectral Data File"
},
{
"@id": "#data_file/0eb3dcc9-b79c-4b44-ac31-b977ea63ae2c",
"comments": [],
"name": "ms-data-3.mzml",
"type": "Spectral Raw Data File"
"type": "Raw Spectral Data File"
},
{
"@id": "#data_file/a449d1e5-9f71-4503-a165-97c5a4c69252",
"comments": [],
"name": "ms-data-4.mzml",
"type": "Spectral Raw Data File"
"type": "Raw Spectral Data File"
},
{
"@id": "#data_file/f32fe0d7-d349-4f70-948e-17f7d8ec22fe",
"comments": [],
"name": "ms-data-5.mzml",
"type": "Spectral Raw Data File"
"type": "Raw Spectral Data File"
},
{
"@id": "#data_file/15c1fb2e-2814-4bff-a37d-cb336fb8b5f4",
"comments": [],
"name": "ms-data-6.mzml",
"type": "Spectral Raw Data File"
"type": "Raw Spectral Data File"
},
{
"@id": "#data_file/402b1d0c-6925-44bd-a365-16bf933659aa",
"comments": [],
"name": "ms-data-7.mzml",
"type": "Spectral Raw Data File"
"type": "Raw Spectral Data File"
}
],
"filename": "a_BH2023-isotopologue-ms-assay.txt",
Expand Down Expand Up @@ -819,6 +825,9 @@
"outputs": [
{
"@id": "#data_file/b3530ec1-6bc5-4757-a526-81c1773530a6"
},
{
"@id": "#data_file/4dd85c35-6e70-4541-99ac-324328f817eb"
}
],
"parameterValues": [
Expand Down Expand Up @@ -864,193 +873,193 @@
"@id": "#data_file/cc587806-e123-459e-b089-37731063b6ce",
"comments": [],
"name": "nmr-data-topoHACO-DIPSY-1.nmrml",
"type": "Free Induction Decay File"
"type": "Free Induction Decay Data File"
},
{
"@id": "#data_file/5b4ec5f5-57c1-459d-b022-2a21395f0dbc",
"comments": [],
"name": "nmr-data-topoHACO-DIPSY-2.nmrml",
"type": "Free Induction Decay File"
"type": "Free Induction Decay Data File"
},
{
"@id": "#data_file/053fe2d8-a3c1-4405-90ba-5a44576b4755",
"comments": [],
"name": "nmr-data-topoHACO-DIPSY-3.nmrml",
"type": "Free Induction Decay File"
"type": "Free Induction Decay Data File"
},
{
"@id": "#data_file/5b6f541e-ed67-4061-9ce7-987b299b238c",
"comments": [],
"name": "nmr-data-topoHACO-DIPSY-4.nmrml",
"type": "Free Induction Decay File"
"type": "Free Induction Decay Data File"
},
{
"@id": "#data_file/8ac4d26e-9d70-48eb-97b2-fd2b03d70dc7",
"comments": [],
"name": "nmr-data-topoHACO-DIPSY-5.nmrml",
"type": "Free Induction Decay File"
"type": "Free Induction Decay Data File"
},
{
"@id": "#data_file/632db404-8826-40f1-92b0-3e5f17b48e17",
"comments": [],
"name": "nmr-data-topoHACO-DIPSY-6.nmrml",
"type": "Free Induction Decay File"
"type": "Free Induction Decay Data File"
},
{
"@id": "#data_file/6dbadd82-109c-4e87-9a9d-3fe0f820d066",
"comments": [],
"name": "nmr-data-topoHACO-DIPSY-7.nmrml",
"type": "Free Induction Decay File"
"type": "Free Induction Decay Data File"
},
{
"@id": "#data_file/f8b16168-af0c-45a5-8748-9bbd9579457b",
"comments": [],
"name": "nmr-data-topoHACO-DIPSY-8.nmrml",
"type": "Free Induction Decay File"
"type": "Free Induction Decay Data File"
},
{
"@id": "#data_file/2b5b1f3e-6ad3-42eb-8dc3-988d9f35b134",
"comments": [],
"name": "nmr-data-topoHNCA-1.nmrml",
"type": "Free Induction Decay File"
"type": "Free Induction Decay Data File"
},
{
"@id": "#data_file/e23ccca9-7f27-4001-b4f7-632ac031476b",
"comments": [],
"name": "nmr-data-topoHNCA-2.nmrml",
"type": "Free Induction Decay File"
"type": "Free Induction Decay Data File"
},
{
"@id": "#data_file/1285966c-8236-46d6-9b6d-ecd99af63503",
"comments": [],
"name": "nmr-data-topoHNCA-3.nmrml",
"type": "Free Induction Decay File"
"type": "Free Induction Decay Data File"
},
{
"@id": "#data_file/b4051169-6be9-41cd-9cf1-0b62287226f2",
"comments": [],
"name": "nmr-data-topoHNCA-4.nmrml",
"type": "Free Induction Decay File"
"type": "Free Induction Decay Data File"
},
{
"@id": "#data_file/ccd56c4c-d54e-4629-90cf-01b088242fd8",
"comments": [],
"name": "nmr-data-topoHNCA-5.nmrml",
"type": "Free Induction Decay File"
"type": "Free Induction Decay Data File"
},
{
"@id": "#data_file/743004a7-7a7a-4d84-ada5-59bc145494dd",
"comments": [],
"name": "nmr-data-topoHNCA-6.nmrml",
"type": "Free Induction Decay File"
"type": "Free Induction Decay Data File"
},
{
"@id": "#data_file/ee89ba9a-4338-495a-ac7c-bc817788dd0d",
"comments": [],
"name": "nmr-data-topoHNCA-7.nmrml",
"type": "Free Induction Decay File"
"type": "Free Induction Decay Data File"
},
{
"@id": "#data_file/a8443352-8dfa-4afc-9253-db2033520d38",
"comments": [],
"name": "nmr-data-topoHNCA-8.nmrml",
"type": "Free Induction Decay File"
"type": "Free Induction Decay Data File"
},
{
"@id": "#data_file/6b436486-605b-4099-94be-293d2a9c149a",
"comments": [],
"name": "nmr-data-topoHSQC-1.nmrml",
"type": "Free Induction Decay File"
"type": "Free Induction Decay Data File"
},
{
"@id": "#data_file/2dd6ce6a-d36d-4f50-9a59-abb922729aa7",
"comments": [],
"name": "nmr-data-topoHSQC-2.nmrml",
"type": "Free Induction Decay File"
"type": "Free Induction Decay Data File"
},
{
"@id": "#data_file/f2b57ff4-3a49-4954-9473-ac2cb9caf990",
"comments": [],
"name": "nmr-data-topoHSQC-3.nmrml",
"type": "Free Induction Decay File"
"type": "Free Induction Decay Data File"
},
{
"@id": "#data_file/caaec7ef-2b45-44d4-a795-be3e95ba698f",
"comments": [],
"name": "nmr-data-topoHSQC-4.nmrml",
"type": "Free Induction Decay File"
"type": "Free Induction Decay Data File"
},
{
"@id": "#data_file/7c25feec-5af8-4a0d-84cf-755fce9cb33c",
"comments": [],
"name": "nmr-data-topoHSQC-5.nmrml",
"type": "Free Induction Decay File"
"type": "Free Induction Decay Data File"
},
{
"@id": "#data_file/470899c8-03d5-4c3e-bc0f-5b1c294e37f6",
"comments": [],
"name": "nmr-data-topoHSQC-6.nmrml",
"type": "Free Induction Decay File"
"type": "Free Induction Decay Data File"
},
{
"@id": "#data_file/ef1692cd-12a1-4e25-b035-3c3c7dc76931",
"comments": [],
"name": "nmr-data-topoHSQC-7.nmrml",
"type": "Free Induction Decay File"
"type": "Free Induction Decay Data File"
},
{
"@id": "#data_file/eb9c13be-d281-4081-ae03-fe8519461948",
"comments": [],
"name": "nmr-data-topoHSQC-8.nmrml",
"type": "Free Induction Decay File"
"type": "Free Induction Decay Data File"
},
{
"@id": "#data_file/0d00bdaa-df1a-4e14-a497-a95dd5f729a0",
"comments": [],
"name": "nmr-data-topoZQF-TOCSY-1.nmrml",
"type": "Free Induction Decay File"
"type": "Free Induction Decay Data File"
},
{
"@id": "#data_file/72496274-97ad-4e72-b7fd-7c500ac69b4b",
"comments": [],
"name": "nmr-data-topoZQF-TOCSY-2.nmrml",
"type": "Free Induction Decay File"
"type": "Free Induction Decay Data File"
},
{
"@id": "#data_file/a4465bef-42fe-43bd-89a0-872a6b749a7a",
"comments": [],
"name": "nmr-data-topoZQF-TOCSY-3.nmrml",
"type": "Free Induction Decay File"
"type": "Free Induction Decay Data File"
},
{
"@id": "#data_file/c7f86f88-92a6-4490-8672-cef8fbbfa25a",
"comments": [],
"name": "nmr-data-topoZQF-TOCSY-4.nmrml",
"type": "Free Induction Decay File"
"type": "Free Induction Decay Data File"
},
{
"@id": "#data_file/bd4b9325-bca0-4770-b287-4f515036333c",
"comments": [],
"name": "nmr-data-topoZQF-TOCSY-5.nmrml",
"type": "Free Induction Decay File"
"type": "Free Induction Decay Data File"
},
{
"@id": "#data_file/effd7cc5-3bc6-4d40-9bc8-c21b819ba95e",
"comments": [],
"name": "nmr-data-topoZQF-TOCSY-6.nmrml",
"type": "Free Induction Decay File"
"type": "Free Induction Decay Data File"
},
{
"@id": "#data_file/7da41385-7cb8-4a3e-85bb-360f4ea90a16",
"comments": [],
"name": "nmr-data-topoZQF-TOCSY-7.nmrml",
"type": "Free Induction Decay File"
"type": "Free Induction Decay Data File"
},
{
"@id": "#data_file/5b69b0e6-95da-4534-bd0d-02527f9a1b8d",
"comments": [],
"name": "nmr-data-topoZQF-TOCSY-8.nmrml",
"type": "Free Induction Decay File"
"type": "Free Induction Decay Data File"
}
],
"filename": "a_BH2023-isotopomer-nmr-assay.txt",
Expand Down Expand Up @@ -2741,7 +2750,7 @@
"@id": "#data_file/abee3156-8521-4539-bcf3-c5bfeadb2f83",
"comments": [],
"name": "nmr-data-topoHACO-DIPSY-8.nmrml",
"type": "Free Induction Decay File"
"type": "Free Induction Decay Data File"
}
],
"filename": "a_BH2023-metabolite-profiling-nmr-assay.txt",
Expand Down
Loading

0 comments on commit 90dd5df

Please sign in to comment.