Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Generic assay plugin bugs #1983

Merged
merged 4 commits into from
Sep 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion docs_manual/source/metadata_advanced.rst
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@ investigation file.
- Inline links
* Comments define semicolon-separated lists of columns to be linked to
collections.
* *SODAR Assay Link Results* |rarr| ``ResultsReports``
* *SODAR Assay Link ResultsReports* |rarr| ``ResultsReports``
* *SODAR Assay Link MiscFiles* |rarr| ``MiscFiles``
* *SODAR Assay Link Row* |rarr| ``RowPath``
* For example:
Expand Down
23 changes: 16 additions & 7 deletions samplesheets/assayapps/generic/plugins.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

# Local constants
APP_NAME = 'samplesheets.assayapps.generic'
RESULTS_COMMENT = 'SODAR Assay Link Results'
RESULTS_COMMENT = 'SODAR Assay Link ResultsReports'
MISC_FILES_COMMENT = 'SODAR Assay Link MiscFiles'
DATA_COMMENT_PREFIX = 'SODAR Assay Row Path'
DATA_LINK_COMMENT = 'SODAR Assay Link Row'
Expand Down Expand Up @@ -65,9 +65,13 @@ def _link_from_comment(cell, header, top_header, target_cols, url):
return True
# Special case for Material Names
if (
top_header['value']
in th.DATA_FILE_HEADERS + th.MATERIAL_NAME_HEADERS
) and (header['value'] == 'Name'):
(
top_header['value']
in th.DATA_FILE_HEADERS + th.MATERIAL_NAME_HEADERS
)
and top_header['value'].lower() in target_cols
and (header['value'] == 'Name')
):
cell['link'] = f"{url}/{cell['value']}"
return True
# Handle everything else
Expand All @@ -83,11 +87,11 @@ def _get_col_value(cls, target_col, row, table):
"""
Return value of last matched column.

:param target_col: Column name to look for
:param target_col: Column name string to look for.
:param row: List of dicts (a row returned by SampleSheetTableBuilder)
:param table: Full table with headers (dict returned by
SampleSheetTableBuilder)
:return: String with cell value of last matched column
:return: String with cell value of last matched column.
"""
# Returns last match of row
value = None
Expand All @@ -96,7 +100,12 @@ def _get_col_value(cls, target_col, row, table):
header = table['field_header'][i]
if header['value'].lower() == target_col.lower():
value = row[i]['value']
return value

if isinstance(value, str):
return value
elif isinstance(value, list) and len(value) == 1: # OntologyTermRefs
return value[0]['name']
return None

def get_row_path(self, row, table, assay, assay_path):
"""
Expand Down
Loading