Skip to content
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: 2 additions & 0 deletions src/smftools/config/experiment_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -713,6 +713,7 @@ class ExperimentConfig:
# Nanopore specific for basecalling and demultiplexing
model_dir: Optional[str] = None
barcode_kit: Optional[str] = None
emit_moves: Optional[bool] = True
model: str = "hac"
barcode_both_ends: bool = BARCODE_BOTH_ENDS
trim: bool = TRIM
Expand Down Expand Up @@ -1449,6 +1450,7 @@ def from_var_dict(
mapping_threshold=float(merged.get("mapping_threshold", 0.01)),
experiment_name=merged.get("experiment_name"),
model=merged.get("model", "hac"),
emit_moves=merged.get("emit_moves", True),
barcode_both_ends=merged.get("barcode_both_ends", BARCODE_BOTH_ENDS),
trim=merged.get("trim", TRIM),
demux_backend=merged.get("demux_backend", "dorado"),
Expand Down
4 changes: 3 additions & 1 deletion src/smftools/informatics/bam_functions.py
Original file line number Diff line number Diff line change
Expand Up @@ -1042,7 +1042,9 @@ def annotate_umi_tags_in_bam(
if umi_values[idx] is None:
umi_values[idx] = extracted

if configured_slots and all(umi_values[idx] is not None for idx in configured_slots):
if configured_slots and all(
umi_values[idx] is not None for idx in configured_slots
):
break
else:
for i, ref_side in enumerate(["left", "right"]):
Expand Down
9 changes: 7 additions & 2 deletions tests/unit/informatics/test_umi_annotation.py
Original file line number Diff line number Diff line change
Expand Up @@ -249,16 +249,21 @@ def test_umi_amplicon_only_from_start(self):

def test_umi_composite_from_start(self, monkeypatch):
"""Extract UMI with composite alignment."""

class _FakeEdlib:
@staticmethod
def align(query, target, mode, task, k, additionalEqualities=None):
assert mode == "HW"
assert task == "path"
assert k == 0
# Exact match for entire query against target
return {"editDistance": 0, "locations": [(0, len(query) - 1)], "cigar": f\"{len(query)}=\"}
return {
"editDistance": 0,
"locations": [(0, len(query) - 1)],
"cigar": f"{len(query)}=",
}

monkeypatch.setattr(bam_functions, \"require\", lambda *args, **kwargs: _FakeEdlib())
monkeypatch.setattr(bam_functions, "require", lambda *args, **kwargs: _FakeEdlib())
read = "GTACTGACAATTCCGGAACCTTGGNNNN"
flanking = FlankingConfig(adapter_side="GTACTGAC", amplicon_side="AACCTTGG")
umi, start, end = _extract_sequence_with_flanking(
Expand Down