Skip to content

Commit

Permalink
trim unsupported characters
Browse files Browse the repository at this point in the history
  • Loading branch information
Karl-Svard committed Dec 9, 2024
1 parent 49bb1d5 commit e67094b
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions cg_lims/EPPs/files/smrt_link/models.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import logging
from typing import Any, Dict, List, Optional
import re
from typing import Any, Dict, List, Optional, Pattern

import pandas as pd
from cg_lims.enums import StrEnum
Expand Down Expand Up @@ -185,6 +186,12 @@ def _is_indexed(pool: Artifact) -> bool:
return False


def _trim_unsupported_characters(name: str) -> str:
"""Return a trimmed sample name only containing supported characters"""
pattern: Pattern[str] = re.compile(r"[^A-Za-z0-9 _:\.-]")
return re.sub(pattern=pattern, repl=" ", string=name)


class RevioRun:
process_id: Process
plates: Dict[Any, Any]
Expand Down Expand Up @@ -256,7 +263,7 @@ def _create_smrt_cell_settings(self) -> str:
index_set: str = pool.samples[0].id

df[well] = [
pool.name,
_trim_unsupported_characters(name=pool.name),
pool.udf.get("Library Type"),
pool.udf.get("Revio Application"),
POLYMERASE_KITS[pool.udf.get("Polymerase Kit")],
Expand Down

0 comments on commit e67094b

Please sign in to comment.