Skip to content

Implement backwards incompatible changes - #949

Open
padix-key wants to merge 17 commits into
biotite-dev:v2from
padix-key:v2-finish
Open

padix-key wants to merge 17 commits into
biotite-dev:v2from
padix-key:v2-finish

Conversation

@padix-key

@padix-key padix-key commented Sep 23, 2026 •

Copy link
Copy Markdown
Member

This PR implements the currently open 'major release' issues and removes all deprecated functionality from the code base.

Issue Title Implementation
#947 Remove license banner from source files Removed the three-line BSD banner (and the following blank line) from all 346 .py, .pyi and .rst files.
#703 Make EValueEstimator accept a Generator EValueEstimator.from_samples() got an rng: numpy.random.Generator parameter (default: fresh default_rng()); sampling uses rng.choice(). Tests and gallery scripts pass a seeded generator instead of np.random.seed().
#905 Do not introduce line breaks in FastaFile by default chars_per_line of FastaFile, FastaFile.read() and FastaFile.write_iter() accepts None and defaults to it, analogous to FastqFile. Internal callers that used a huge line width now rely on the default.
#923 Make FastqFile offset an IntEnum FastqFile.Offset already existed; the docstrings still advertised string offsets and the docs still passed offset="Sanger". Docstrings now document the enum members, and tutorial/gallery scripts use FastqFile.Offset.SANGER.
#900 Remove verbose parameter from fetch() functions Removed the parameter, the progress print() calls and the docstring entries from rcsb, afdb, uniprot, entrez and pubchem fetch().
#899 fetch() functions should accept and return Path objects All fetch() functions (and entrez.fetch_single_file()) accept str | PathLike targets, create directories via Path.mkdir() and return pathlib.Path objects (or lists thereof). Tutorials use .name instead of os.path.basename().
#930 Change default scoring scheme for alignment functions align_ungapped(), align_optimal(), align_banded(), align_local_gapped(), align_multiple() and score() default to matrix=(1, -1) and gap_penalty=-1; score() accepts (match, mismatch) tuples. To make matrix optional, band (in align_banded()) and seed/threshold (in align_local_gapped()) now precede matrix. Doctest examples that illustrate specific alignments pin gap_penalty=-10. The Rust SeedExtension constructor and the deprecated align_local_ungapped() are unchanged.
#924 Represent secondary structure elements as IntEnum New biotite.structure.PSeaElement (NONE=-1, COIL, HELIX, STRAND) returned by annotate_sse() and pdbx.get_sse(), and DsspElement (COIL … POLYPROLINE_HELIX) returned by the v1 and v2 DsspApp. Both enums provide symbol, from_symbol(), from_symbols() and to_symbols() for one-letter conversion.
#909 Represent Compiled Graphics Objects using dedicated class New CGO class wrapping the float values (values property, __eq__, __len__); the former directive enum became CGO.Type. get_*_cgo() return CGO, draw_cgo() takes Sequence[CGO] and rejects raw lists.
#908 Add ColorScheme Frozen dataclass ColorScheme(name, alphabet, colors) with fit(alphabet, default). load_color_scheme() returns it; LetterTypePlotter, plot_alignment_type_based() and plot_sequence_logo() accept it as color_scheme/scheme. get_color_scheme() keeps returning a color list.
#906 Add GFFRecord Dataclass GFFRecord(seqid, source, type, start, end, score, strand, phase, attributes). GFFFile indexing/iteration yields records, insert()/append()/__setitem__() take a record; converters updated.
#925 Add GenBankLocus Dataclass GenBankLocus(name, length, mol_type, is_circular, division, date). get_locus() returns it and set_locus(gb_file, locus) accepts it.
#907 Add GenBankRecord Dataclass GenBankRecord(name, content, subfields). GenBankFile indexing/iteration and get_fields() return records; insert()/append()/set_field()/__setitem__() take a record. The metadata, annotation and sequence converters use record attributes.
#902 Use dataclasses to better encapsulate large tuples and untyped dictionaries Umbrella issue, fulfilled by the ColorScheme, GFFRecord, GenBankLocus, GenBankRecord and CGO commits above; no separate commit.
#844 Refactor AffineTransformation Renamed to RigidTransformation(rotation, translation) using a single rotation and translation (x' = R x + t); __mul__ composes transformations ((a * b).apply(x) == a.apply(b.apply(x))) and unary __neg__ inverts them. apply() also handles single Atoms. superimpose*(), space_group_transforms() and PDBx assembly code produce it; align_vectors() and orient_principal_components() now return the transformation instead of transformed coordinates.
– Rename application_v2 to application biotite.application_v2 was moved to biotite.application (sources, tests, docs, CI config). A deprecated biotite.application_v2 shim remains: importing it emits a DeprecationWarning, re-exports biotite.application and aliases all subpackages in sys.modules, so biotite.application_v2.dssp.DsspApp is the same object as biotite.application.dssp.DsspApp. The shim is excluded from the API documentation.
– Remove deprecated code Removed the deprecated v1 biotite.application package (and its tests, doctests and API docs; the former application_v2 was left untouched in this commit), align_local_ungapped(), set_font_size_in_coord(), PDBFile.get_symmetry_mates()/pdb.get_symmetry_mates(), the as_bytes parameter of LetterAlphabet.decode*(), the distance_range parameter of connect_via_distances(), the float_tolerance parameter of pdbx.compress(), the include_bonds parameter of pdbx.set_structure() and its label_entity_id annotation fallback, and the as_mask parameter of CellList.get_atoms*() (Rust + stub). plot_nucleotide_secondary_structure() and the MUSCLE reference tests now use the v2 apps.
#773 Make use_author_fields default to True (i.e. use label fields) Default of use_author_fields in get_structure(), get_assembly() and get_unit_cell() flipped to False. get_sequence() keys its result by struct_asym.id (= label_asym_id), get_sse() uses beg_label_asym_id/label_asym_id. Tests and docs that compare against PDB/PDBQT/PyMOL/foldseek data (which only know author fields) or select chains by author IDs (2RTG, 2OR1) request use_author_fields=True explicitly; #553 was already fixed.

Closed issues

Closes #703.
Closes #905.
Closes #923.
Closes #900.
Closes #899.
Closes #930.
Closes #924.
Closes #909.
Closes #908.
Closes #906.
Closes #925.
Closes #907.
Closes #902.
Closes #844.
Closes #773.

@padix-key
padix-key marked this pull request as draft September 23, 2026 15:52
The `IntEnum` already existed, but the docstrings and documentation still
referred to the removed string offsets.

Closes biotite-dev#923
`align_ungapped()`, `align_optimal()`, `align_banded()`, `align_local_gapped()`,
`align_multiple()` and `score()` now default to a match score of 1, a mismatch
score of -1 and a linear gap penalty of -1.
To allow a default for `matrix`, the required `band` and `seed`/`threshold`
parameters of `align_banded()` and `align_local_gapped()` now precede it.

Closes biotite-dev#930
`annotate_sse()` and `pdbx.get_sse()` return `SecondaryStructure` values,
`DsspApp` returns `DsspElement` values.
Both enums provide conversion from/to the one-letter symbols.

Closes biotite-dev#924
The former `CGO` enum listing the directives is now `CGO.Type`.

Closes biotite-dev#909
`load_color_scheme()` returns a `ColorScheme` instead of an untyped
dictionary and the plotting functions accept it as `color_scheme`.

Closes biotite-dev#908
`GFFFile` entries are now represented by `GFFRecord` objects instead of
9-tuples.

Closes biotite-dev#906
`get_locus()` returns a `GenBankLocus` and `set_locus()` accepts one instead
of the 6-tuple of locus properties.

Closes biotite-dev#925
`GenBankFile` fields are now represented by `GenBankRecord` objects instead
of (name, content, subfields) tuples.

Closes biotite-dev#907
- The transformation now consists of a single rotation and translation
- Transformations can be combined via `*` and inverted via unary `-`
- `align_vectors()` and `orient_principal_components()` return the
  transformation instead of transformed coordinates

Closes biotite-dev#844
- `use_author_fields` defaults to `False` in `get_structure()`,
  `get_assembly()` and `get_unit_cell()`
- `get_sequence()` keys the sequences by `label_asym_id` (via `struct_asym`)
- `get_sse()` uses `label_asym_id` as chain ID
- Tests and documentation that rely on author fields (PDB, PDBQT, PyMOL,
  foldseek references and hard-coded author IDs) request them explicitly

Closes biotite-dev#773
- Remove the `biotite.application` package in favor of `biotite.application_v2`
- Remove `align_local_ungapped()`, `set_font_size_in_coord()` and
  `get_symmetry_mates()`
- Remove the deprecated parameters `as_bytes` (`LetterAlphabet.decode*()`),
  `distance_range` (`connect_via_distances()`), `float_tolerance`
  (`pdbx.compress()`), `include_bonds` (`pdbx.set_structure()`) and
  `as_mask` (`CellList.get_atoms*()`)
- Remove the `label_entity_id` annotation fallback in `pdbx.set_structure()`
`biotite.application_v2` remains as deprecated shim that forwards to
`biotite.application`.
@codspeed

codspeed Bot commented Sep 24, 2026 •

Copy link
Copy Markdown

Merging this PR will regress 2 benchmarks

⚡ 9 improved benchmarks
❌ 2 regressed benchmarks
✅ 98 untouched benchmarks
⏩ 14 skipped benchmarks1

Warning

Please fix the performance issues or acknowledge them on CodSpeed.

Performance Changes

Benchmark BASE HEAD Efficiency
❌ benchmark_structural_alphabet_methods[to_protein_blocks] 6.6 ms 10.2 ms -35.14%
❌ benchmark_match_kmer_selection[KmerTable-None] 246.2 µs 277.8 µs -11.38%
⚡ benchmark_set_structure[cif-False] 92.9 ms 31.6 ms ×2.9
⚡ benchmark_set_structure[cif-True] 103.5 ms 41.7 ms ×2.5
⚡ benchmark_connect[connect_via_distances] 3.2 ms 1.7 ms +86.35%
⚡ benchmark_serialize_pdbx[cif] 177.7 ms 120.5 ms +47.38%
⚡ benchmark_infer_bond_types 1,203 µs 830.7 µs +44.82%
⚡ benchmark_clustering[neighbor_joining] 557.7 µs 394.5 µs +41.35%
⚡ benchmark_set_structure 9.4 ms 7 ms +35.39%
⚡ benchmark_set_structure_with_bonds 9.6 ms 7.2 ms +34.53%
⚡ benchmark_match_kmer_selection[BucketKmerTable(10000)-None] 353.1 µs 320.9 µs +10.04%

Tip

Investigate this regression by commenting @codspeedbot fix this regression on this PR, or directly use the CodSpeed MCP with your agent.


Comparing padix-key:v2-finish (32f645d) with main (1aaf784)2

Open in CodSpeed

Footnotes

  1. 14 benchmarks were skipped, so the baseline results were used instead. If they were deleted from the codebase, click here and archive them to remove them from the performance reports. ↩

  2. No successful run was found on v2 (b314fa7) during the generation of this report, so main (1aaf784) was used instead as the comparison base. There might be some changes unrelated to this pull request in this report. ↩

This branch was successfully deployed

1 active deployment
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

1 participant