bioforge 3.0.0__tar.gz → 3.1.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (38) hide show
  1. {bioforge-3.0.0 → bioforge-3.1.0}/PKG-INFO +1 -1
  2. {bioforge-3.0.0 → bioforge-3.1.0}/bioforge/__init__.py +1 -1
  3. {bioforge-3.0.0 → bioforge-3.1.0}/bioforge/aligner.py +9 -4
  4. {bioforge-3.0.0 → bioforge-3.1.0}/bioforge/genomemap.py +2 -1
  5. {bioforge-3.0.0 → bioforge-3.1.0}/bioforge.egg-info/PKG-INFO +1 -1
  6. {bioforge-3.0.0 → bioforge-3.1.0}/tests/test_aligner.py +17 -0
  7. {bioforge-3.0.0 → bioforge-3.1.0}/LICENSE +0 -0
  8. {bioforge-3.0.0 → bioforge-3.1.0}/README.md +0 -0
  9. {bioforge-3.0.0 → bioforge-3.1.0}/bioforge/analyze.py +0 -0
  10. {bioforge-3.0.0 → bioforge-3.1.0}/bioforge/bgzf.py +0 -0
  11. {bioforge-3.0.0 → bioforge-3.1.0}/bioforge/biocore.py +0 -0
  12. {bioforge-3.0.0 → bioforge-3.1.0}/bioforge/engine/__init__.py +0 -0
  13. {bioforge-3.0.0 → bioforge-3.1.0}/bioforge/engine/_loader.py +0 -0
  14. {bioforge-3.0.0 → bioforge-3.1.0}/bioforge/engine/build.py +0 -0
  15. {bioforge-3.0.0 → bioforge-3.1.0}/bioforge/engine/engine.c +0 -0
  16. {bioforge-3.0.0 → bioforge-3.1.0}/bioforge/engine/engine.dll +0 -0
  17. {bioforge-3.0.0 → bioforge-3.1.0}/bioforge/minimizers.py +0 -0
  18. {bioforge-3.0.0 → bioforge-3.1.0}/bioforge/qcreport.py +0 -0
  19. {bioforge-3.0.0 → bioforge-3.1.0}/bioforge/refindex.py +0 -0
  20. {bioforge-3.0.0 → bioforge-3.1.0}/bioforge/smart_translator.py +0 -0
  21. {bioforge-3.0.0 → bioforge-3.1.0}/bioforge.egg-info/SOURCES.txt +0 -0
  22. {bioforge-3.0.0 → bioforge-3.1.0}/bioforge.egg-info/dependency_links.txt +0 -0
  23. {bioforge-3.0.0 → bioforge-3.1.0}/bioforge.egg-info/entry_points.txt +0 -0
  24. {bioforge-3.0.0 → bioforge-3.1.0}/bioforge.egg-info/requires.txt +0 -0
  25. {bioforge-3.0.0 → bioforge-3.1.0}/bioforge.egg-info/top_level.txt +0 -0
  26. {bioforge-3.0.0 → bioforge-3.1.0}/pyproject.toml +0 -0
  27. {bioforge-3.0.0 → bioforge-3.1.0}/setup.cfg +0 -0
  28. {bioforge-3.0.0 → bioforge-3.1.0}/setup.py +0 -0
  29. {bioforge-3.0.0 → bioforge-3.1.0}/tests/test_analyze.py +0 -0
  30. {bioforge-3.0.0 → bioforge-3.1.0}/tests/test_bgzf.py +0 -0
  31. {bioforge-3.0.0 → bioforge-3.1.0}/tests/test_biocore.py +0 -0
  32. {bioforge-3.0.0 → bioforge-3.1.0}/tests/test_errors.py +0 -0
  33. {bioforge-3.0.0 → bioforge-3.1.0}/tests/test_genomemap.py +0 -0
  34. {bioforge-3.0.0 → bioforge-3.1.0}/tests/test_minimizers.py +0 -0
  35. {bioforge-3.0.0 → bioforge-3.1.0}/tests/test_qcreport.py +0 -0
  36. {bioforge-3.0.0 → bioforge-3.1.0}/tests/test_refindex.py +0 -0
  37. {bioforge-3.0.0 → bioforge-3.1.0}/tests/test_streaming.py +0 -0
  38. {bioforge-3.0.0 → bioforge-3.1.0}/tests/test_translator.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: bioforge
3
- Version: 3.0.0
3
+ Version: 3.1.0
4
4
  Summary: High-performance bioinformatics engine for Edge Computing — 5-bit encoding, vectorised NumPy core, optional C backend
5
5
  Author-email: Aarón Aranda Torrijos <noe9601@gmail.com>
6
6
  License: # PolyForm Noncommercial License 1.0.0
@@ -36,7 +36,7 @@ from .biocore import (
36
36
  from .genomemap import GenomeAligner, Mapping
37
37
  from .smart_translator import SmartTranslator
38
38
 
39
- __version__ = "3.0.0"
39
+ __version__ = "3.1.0"
40
40
  __author__ = "Aarón Aranda Torrijos"
41
41
 
42
42
  __all__ = [
@@ -179,6 +179,7 @@ class SequenceAligner:
179
179
  seq_b: PackedSequence,
180
180
  mode: Literal['global', 'semi-global'] = 'global',
181
181
  band: int | None = None,
182
+ detect_mutations: bool = True,
182
183
  ) -> AlignmentResult:
183
184
  """
184
185
  Align seq_a (reference) against seq_b (query) — Needleman-Wunsch.
@@ -238,7 +239,8 @@ class SequenceAligner:
238
239
  raise AlignmentError(f"band debe ser ≥ 1, se recibió {band}.")
239
240
  if C_AVAILABLE:
240
241
  return cls._align_banded_c(
241
- codes_a, codes_b, m, n, band, mode, seq_a.seq_type
242
+ codes_a, codes_b, m, n, band, mode, seq_a.seq_type,
243
+ detect_mutations,
242
244
  )
243
245
  # NumPy fallback: banded fill sobre matriz completa
244
246
  if m > cls._MAX_SAFE_LEN or n > cls._MAX_SAFE_LEN:
@@ -261,7 +263,8 @@ class SequenceAligner:
261
263
  )
262
264
 
263
265
  if C_AVAILABLE:
264
- return cls._align_c(codes_a, codes_b, m, n, mode, seq_a.seq_type)
266
+ return cls._align_c(codes_a, codes_b, m, n, mode, seq_a.seq_type,
267
+ detect_mutations)
265
268
 
266
269
  H = cls._fill_matrix(codes_a, codes_b, m, n, mode)
267
270
  return cls._traceback(H, codes_a, codes_b, m, n, mode, seq_a.seq_type)
@@ -361,6 +364,7 @@ class SequenceAligner:
361
364
  band: int,
362
365
  mode: str,
363
366
  seq_type: SeqType,
367
+ detect_mutations: bool = True,
364
368
  ) -> AlignmentResult:
365
369
  decode_bytes = (
366
370
  _NUC_DECODE_BYTES if seq_type == SeqType.NUCLEOTIDE else _AA_DECODE_BYTES
@@ -370,7 +374,7 @@ class SequenceAligner:
370
374
  int(cls.MATCH), int(cls.MISMATCH), int(cls.GAP),
371
375
  band, mode,
372
376
  )
373
- mutations = cls._detect_mutations(aligned_a, aligned_b)
377
+ mutations = cls._detect_mutations(aligned_a, aligned_b) if detect_mutations else []
374
378
  aln_len = n_matches + n_mismatches + n_gaps
375
379
  identity = n_matches / aln_len if aln_len else 0.0
376
380
  return AlignmentResult(
@@ -389,6 +393,7 @@ class SequenceAligner:
389
393
  n: int,
390
394
  mode: str,
391
395
  seq_type: SeqType,
396
+ detect_mutations: bool = True,
392
397
  ) -> AlignmentResult:
393
398
  decode_bytes = (
394
399
  _NUC_DECODE_BYTES if seq_type == SeqType.NUCLEOTIDE else _AA_DECODE_BYTES
@@ -398,7 +403,7 @@ class SequenceAligner:
398
403
  int(cls.MATCH), int(cls.MISMATCH), int(cls.GAP),
399
404
  mode,
400
405
  )
401
- mutations = cls._detect_mutations(aligned_a, aligned_b)
406
+ mutations = cls._detect_mutations(aligned_a, aligned_b) if detect_mutations else []
402
407
  aln_len = n_matches + n_mismatches + n_gaps
403
408
  identity = n_matches / aln_len if aln_len else 0.0
404
409
  return AlignmentResult(
@@ -308,7 +308,8 @@ def _extend(ref: str, read: str, ch: Chain) -> Optional[Mapping]:
308
308
  band = min(256, abs(len(ref_sub) - len(read_sub)) + 32)
309
309
  try:
310
310
  res = SequenceAligner.align(_pack(ref_sub), _pack(read_sub),
311
- mode="global", band=band)
311
+ mode="global", band=band,
312
+ detect_mutations=False) # el mapeo no las usa
312
313
  cigar, n_match, block = _cigar(res.aligned_a, res.aligned_b)
313
314
  identity = res.identity
314
315
  except Exception: # noqa: BLE001 — extensión best-effort
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: bioforge
3
- Version: 3.0.0
3
+ Version: 3.1.0
4
4
  Summary: High-performance bioinformatics engine for Edge Computing — 5-bit encoding, vectorised NumPy core, optional C backend
5
5
  Author-email: Aarón Aranda Torrijos <noe9601@gmail.com>
6
6
  License: # PolyForm Noncommercial License 1.0.0
@@ -44,6 +44,23 @@ def _prot(seq: str, header: str = "h") -> PackedSequence:
44
44
  # §1 PROPIEDADES MATEMÁTICAS
45
45
  # ══════════════════════════════════════════════════════════════════════════════
46
46
 
47
+ def test_detect_mutations_flag():
48
+ """detect_mutations=False omite la lista de mutaciones sin tocar el resto."""
49
+ a = "ACGTACGTACGTACGTACGT"
50
+ b = "ACGTACGTTCGTACGTACGT" # una sustitución
51
+ full = SequenceAligner.align(_nuc(a), _nuc(b))
52
+ fast = SequenceAligner.align(_nuc(a), _nuc(b), detect_mutations=False)
53
+ assert len(full.mutations) == 1
54
+ assert fast.mutations == []
55
+ # todo lo demás idéntico (identidad, score, matches)
56
+ assert fast.identity == full.identity
57
+ assert fast.score == full.score
58
+ assert fast.n_matches == full.n_matches
59
+ # y también en la ruta banded (la que usa el mapeador)
60
+ fastb = SequenceAligner.align(_nuc(a), _nuc(b), band=6, detect_mutations=False)
61
+ assert fastb.mutations == []
62
+
63
+
47
64
  def test_identical_sequences_perfect_score():
48
65
  """Dos secuencias idénticas → score máximo, identidad 1.0, 0 mutaciones."""
49
66
  seq = "ATGGTGCACCTGACTCCTGAGGAGAAGTCTGCC"
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes