spacr.qt.widgets.barcode_regex¶
Interactive editor for sequencing barcode regular expressions.
Barcode regexes are not filename regexes. The sequencing pipeline requires
three specifically named capture groups (columnID, grna and
rowID), so the generic filename-regex editor cannot validate this field.
This module keeps the compact settings row while providing a focused dialog
that compiles the expression and previews its captures against a pasted read.
Classes¶
Edit and test a barcode regex against a representative read. |
|
Validation result shown by the inline field and test dialog. |
|
Compact settings-row field with inline validation and a test dialog. |
Functions¶
|
Compile a barcode regex and optionally apply it to one sequence. |
Module Contents¶
- class spacr.qt.widgets.barcode_regex.BarcodeRegexDialog(initial_regex: str = '', parent=None)[source]¶
Bases:
PySide6.QtWidgets.QDialogEdit and test a barcode regex against a representative read.
- Parameters:
initial_regex – the expression to open with. Empty opens the field empty; the dialog proposes nothing until the user tests a read.
parent – parent widget.
Build the barcode-regex tester.
Sized in scaled pixels rather than raw ones: a size set from Python does not grow with the stylesheet’s font size, and at the 200% scale the prose inside wrapped to more height than the window had.
- Parameters:
initial_regex – the pattern to open with; empty uses spaCR’s default.
parent – parent widget, or
None.
- class spacr.qt.widgets.barcode_regex.BarcodeRegexResult[source]¶
Validation result shown by the inline field and test dialog.
- Parameters:
valid – whether the pattern (and the sample, when one was given) passed.
message – one-line explanation to show beside the field.
captures – the
columnID,grnaandrowIDvalues the sample produced; empty when no sample was matched.
- class spacr.qt.widgets.barcode_regex.BarcodeRegexWidget(value: str = '', parent=None)[source]¶
Bases:
PySide6.QtWidgets.QWidgetCompact settings-row field with inline validation and a test dialog.
- Parameters:
value – the regular expression already saved. Empty opens the field empty rather than with a suggestion, so a blank setting stays blank until the user or the test dialog fills it.
parent – parent widget.
Build the inline regex field with its verdict mark and Test button.
- Parameters:
value – the pattern to start with.
parent – parent widget, or
None.
- spacr.qt.widgets.barcode_regex.evaluate_barcode_regex(pattern: str, sample: str = '') BarcodeRegexResult[source]¶
Compile a barcode regex and optionally apply it to one sequence.
A usable mapping expression must define every named group consumed by
spacr.sequencing. When a sample is supplied it must also match and produce a non-empty value for each required group.- Parameters:
pattern – the regular expression, stripped of surrounding whitespace; it must define the named groups
columnID,grnaandrowID.sample – an optional read to match from its start with
re.match; all whitespace is removed first, and empty skips the match.