diff --git a/altamisa/isatab/models.py b/altamisa/isatab/models.py index 2481d60..531da90 100644 --- a/altamisa/isatab/models.py +++ b/altamisa/isatab/models.py @@ -460,7 +460,7 @@ class Process: #: Process date date: Optional[Union[datetime.date, Literal[""]]] #: Performer of process - performer: Optional[str] + performer: Optional[Tuple[str, ...]] #: Tuple of parameters values parameter_values: Tuple[ParameterValue, ...] #: Tuple of process comments diff --git a/altamisa/isatab/parse_assay_study.py b/altamisa/isatab/parse_assay_study.py index b75ec0b..142efa0 100644 --- a/altamisa/isatab/parse_assay_study.py +++ b/altamisa/isatab/parse_assay_study.py @@ -442,7 +442,7 @@ def build(self, line: List[str]) -> models.Process: else: date = None if self.performer_header: - performer = line[self.performer_header.col_no] + performer = tuple(self._token_with_escape(line[self.performer_header.col_no])) else: performer = None comments = tuple( diff --git a/altamisa/isatab/write_assay_study.py b/altamisa/isatab/write_assay_study.py index d711d5d..eb0f8ce 100644 --- a/altamisa/isatab/write_assay_study.py +++ b/altamisa/isatab/write_assay_study.py @@ -411,7 +411,9 @@ def _extract_process(self, node: Process) -> dict: if node.protocol_ref != TOKEN_UNKNOWN: attributes[table_headers.PROTOCOL_REF] = node.protocol_ref if node.performer is not None: - attributes[table_headers.PERFORMER] = node.performer + attributes[table_headers.PERFORMER] = ";".join( + [p.replace(";", "\\;") if p else "" for p in node.performer] + ) if node.date is not None: attributes[table_headers.DATE] = node.date for parameter in node.parameter_values: diff --git a/docs/index.rst b/docs/index.rst index 9e2d7a3..baae2e3 100644 --- a/docs/index.rst +++ b/docs/index.rst @@ -53,10 +53,10 @@ Special Extensions In addition to the original ISA-Tab format specifications, AltamISA supports the following special modifications to improve specific use cases: -- **List of values** in ``Characterics``, ``Parameter Value``, or ``Factor Value`` fields by using - semicolon-separators (";"). Note, for ontology terms the same number of - splits is expected in the associated field ``Term Source REF`` and - ``Term Accession Number``. +- **List of values** in ``Characterics``, ``Parameter Value``, ``Factor Value``, + and ``Performer`` fields by using semicolon-separators (";"). Note: For + ontology terms the same number of splits is expected in the associated field + ``Term Source REF`` and ``Term Accession Number``. - **Material name** ``Library Name`` for improved library annotation in nucleotide sequencing assays. diff --git a/tests/test_parse_study.py b/tests/test_parse_study.py index ffaaa64..b2331ac 100644 --- a/tests/test_parse_study.py +++ b/tests/test_parse_study.py @@ -257,7 +257,7 @@ def test_study_row_reader_small_study(small_investigation_file, small_study_file None, None, date(2018, 2, 2), - "John Doe", + ("John Doe",), (models.ParameterValue("instrument", ["scalpel"], None),), (), None, @@ -298,7 +298,7 @@ def test_study_row_reader_small_study(small_investigation_file, small_study_file None, None, date(2018, 2, 2), - "John Doe", + ("John Doe",), (models.ParameterValue("instrument", ["scalpel type A", "scalpel type B"], None),), (), None, @@ -507,7 +507,7 @@ def test_study_reader_small_study( None, None, date(2018, 2, 2), - "John Doe", + ("John Doe",), (models.ParameterValue("instrument", ["scalpel"], None),), (), None, @@ -522,7 +522,7 @@ def test_study_reader_small_study( None, None, date(2018, 2, 2), - "John Doe", + ("John Doe",), (models.ParameterValue("instrument", ["scalpel type A", "scalpel type B"], None),), (), None, @@ -537,7 +537,7 @@ def test_study_reader_small_study( None, None, date(2018, 2, 2), - "John Doe", + ("John Doe",), (models.ParameterValue("instrument", ["scalpel"], None),), (), None,