Skip to content

Commit

Permalink
Implement new rules for technology type
Browse files Browse the repository at this point in the history
  • Loading branch information
Lev Levitsky committed Oct 11, 2024
1 parent f6f3617 commit ee678ad
Showing 1 changed file with 23 additions and 10 deletions.
33 changes: 23 additions & 10 deletions sdrf_pipelines/sdrf/sdrf_schema.py
Original file line number Diff line number Diff line change
Expand Up @@ -283,16 +283,29 @@ def validate_columns_order(panda_sdrf):
assay_index = cnames.index("assay name")
factor_tag = False
for idx, column in enumerate(cnames):
if "comment" in column and idx < assay_index:
error_message = "The column " + column + " cannot be before the assay name"
error_columns_order.append(LogicError(error_message, error_type=logging.ERROR))
if (
"characteristics" in column
or ("material type" in column and "factor value" not in column)
or "technology type" in column
) and idx > assay_index:
error_message = "The column " + column + " cannot be after the assay name"
error_columns_order.append(LogicError(error_message, error_type=logging.ERROR))
error_message, error_type = '', None
if idx < assay_index:
if "comment" in column:
error_message = "The column " + column + " cannot be before the assay name"
error_type = logging.ERROR
if "technology type" in column:
error_message = "The column " + column + " must be immediately after the assay name"
if assay_index - idx > 1:
error_type = logging.ERROR
else:
error_type = logging.WARNING
else:
if (
"characteristics" in column
or ("material type" in column and "factor value" not in column)
):
error_message = "The column " + column + " cannot be after the assay name"
error_type = logging.ERROR
if "technology type" in column and idx > assay_index + 1:
error_message = "The column " + column + " must be immediately after the assay name"
error_type = logging.ERROR
if error_type is not None:
error_columns_order.append(LogicError(error_message, error_type=error_type))
if "factor value" in column and not factor_tag:
factor_index = idx
factor_tag = True
Expand Down

0 comments on commit ee678ad

Please sign in to comment.