Files
obitools4/autodoc/docmd/pkg/obingslibrary/match.md
T
Eric Coissac 8c7017a99d ⬆️ version bump to v4.5
- Update obioptions.Version from "Release 4.4.29" to "/v/ Release v5"
- Update version.txt from 4.29 → .30
(automated by Makefile)
2026-04-13 13:34:53 +02:00

33 lines
1.6 KiB
Markdown

# Demultiplexing Functionality in `obingslibrary`
This package provides tools for **demultiplexing NGS reads** by matching them against known primer pairs and extracting associated barcodes.
## Core Types
- `DemultiplexMatch`: Struct holding alignment results for forward/reverse primers, mismatches, barcode coordinates (`BarcodeStart`, `BarcodeEnd`), and metadata (e.g., sample/experiment info via `PCR`). Includes error handling.
## Key Methods
- **`Match(sequence)`**:
Scans the input `BioSequence` against all primer pairs in `NGSLibrary.Markers`. Returns a populated `DemultiplexMatch` if any primer pair matches.
- **`ExtractBarcode(sequence, inplace)`**:
Uses the result of `Match()` to:
- Extract the barcode region (if valid: non-dimer).
- Reverse-complement if read is in reverse orientation (`IsDirect == false`).
- Annotate the sequence with:
- Primer names and match details (positions, mismatches).
- Direction (`direct`/`reverse`).
- Sample/experiment info (if assignment succeeds), or error message.
## Behavior Notes
- **Primer dimer detection**: If `BarcodeStart > BarcodeEnd`, the read is flagged as a primer dimer and not extracted.
- **Error handling**: Errors (e.g., no match, sample unassignment) are stored in `match.Error` and propagated as annotations.
- **Annotation richness**: Output sequences carry rich metadata (sample, experiment, primers, errors), supporting downstream filtering/analysis.
## Dependencies
- Uses `logrus` for fatal logging (e.g., subsequence extraction failure).
- Integrates with `obiseq.BioSequence` for sequence representation and manipulation.