Skip to content

Commit

Permalink
feat!: Support semicolon-separated lists in Performer fields (#141)
Browse files Browse the repository at this point in the history
  • Loading branch information
sellth authored Feb 5, 2024
1 parent ec12292 commit ef8668c
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 12 deletions.
2 changes: 1 addition & 1 deletion altamisa/isatab/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion altamisa/isatab/parse_assay_study.py
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down
4 changes: 3 additions & 1 deletion altamisa/isatab/write_assay_study.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
8 changes: 4 additions & 4 deletions docs/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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.

Expand Down
10 changes: 5 additions & 5 deletions tests/test_parse_study.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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,
Expand All @@ -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,
Expand All @@ -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,
Expand Down

0 comments on commit ef8668c

Please sign in to comment.