Skip to content

BioJava 8.0 plan: Java 21, a leaner, library-only BioJava #1168

Backlog

Description

@josemduarte

Motivation

BioJava 8.0 will be a major release with breaking changes. The goal is for BioJava to be a pure library: lean, headless, and cheaper to maintain. Code that pulls in GUI toolkits, depends on resources we can no longer get, or wraps services that no longer work costs maintenance time and gives users little in return. Where a component still has users, it gets a new home under the biojava GitHub organization rather than being deleted.

Comments are welcome, both on the items below and on anything else that should go into 8.0.

Planned changes

1. Require Java 21

  • Raise the minimum Java version from 11 to 21 and build with --release 21.
  • After the bump, modern language features (records, sealed types, pattern matching, switch expressions) can be used where they make code simpler. This is not a goal on its own.

2. Move biojava-structure-gui and biojava-protein-comparison-tool to a separate repository

3. Drop biojava-modfinder

4. Drop biojava-survival

  • Cox regression and Kaplan-Meier survival curves are general biostatistics, outside BioJava's sequence and structure focus, and well served by R, lifelines and statsmodels.
  • The module has no tests and no dependents within BioJava, and has had no functional changes since 2016. It includes Swing figures and its own hand-written matrix and Cholesky code, both things 8.0 is removing elsewhere.
  • If anyone wants to maintain it, it can move to its own repository under the biojava org.

5. Replace the embedded Jama copy with Hipparchus

BioJava ships its own copy of Jama (org.biojava.nbio.structure.jama). We don't want to maintain basic math code ourselves, embedded or hand-written.

  • Public API that uses Jama Matrix for 3D transforms switches to vecmath Matrix3d / Matrix4d (Calc.rotate(...), Calc.getXYZEuler/getZYZEuler, RotationAxis, AFPChain.getBlockRotationMatrix, AFP.getM, FragmentPair.getRot, …). Determinants, inverses and rotation axes use vecmath.
  • Public API that uses Matrix for general NxM matrices (distance, RMSD and dk matrices) switches to double[][] (AFPChain.getDistanceMatrix/getDisTable1/2, MultipleAlignmentTools.getRMSDMatrix, SymmetryTools.getDkMatrix, AlignUtils.getDistanceMatrix, …).
  • Decompositions use Hipparchus 5.0 (hipparchus-core), which also targets Java 21: the SVD in SuperPositionSVD and the eigen decompositions in MomentsOfInertia and UnitQuaternions. SuperPositionSVD keeps its public API; only its internals change. Hipparchus stays an implementation detail and is not exposed in the public API.
  • vecmath stays in 8.0 as the 3D geometry layer of biojava-structure. See "Looking ahead to 9.0" below.

6. Drop MMTF support

7. Remove deprecated APIs

  • Delete members that are currently @Deprecated, for example Structure.getPDBCode/setPDBCode, PDBHeader.getIdCode/setIdCode and getDescription/setDescription (PDBHeader.getDescription meaning #662), the deprecated Grid.getContacts(), and CESymmParameters.setRefineResult.

8. Remove java.awt / javax.swing from the library modules

  • biojava-structure: remove GuiWrapper (it calls into the GUI module through reflection) and the Swing parts of AlignmentProgressListener.
  • biojava-alignment / biojava-core: review the AWT use in GuideTree, GuideTreeNode and ABITrace, and remove it where it's only used for display.
  • Goal: no module outside the GUI repository needs a display or a desktop toolkit.

9. Review biojava-ws

10. Replace clone() with copy constructors in biojava-structure

  • SonarCloud flags 29 clone() implementations in biojava-structure as blockers (rule java:S2975). Cloneable/clone() is fragile: it bypasses constructors, doesn't work with final fields, and needs casts and CloneNotSupportedException handling.
  • Replace them with copy constructors or copy factory methods. Since several are declared on public interfaces, this is a breaking change that fits 8.0.
  • Interfaces that declare clone(): Atom, Group, Chain, Structure, Block, BlockSet, MultipleAlignment, MultipleAlignmentEnsemble.
  • Implementations:
    • Core model: AtomImpl, HetatomImpl, AminoAcidImpl, NucleotideImpl, ChainImpl, StructureImpl, GroupIterator, PdbId, io.SSBondImpl
    • Alignment: align.model.AFPChain, align.pairwise.FragmentPair, align.multiple.BlockImpl, BlockSetImpl, MultipleAlignmentImpl, MultipleAlignmentEnsembleImpl
    • Other: asa.GroupAsa, ecod.EcodDomain, scop.ScopDescription, scop.ScopDomain, secstruc.HBond, symmetry.internal.CESymmParameters
  • The clone() in the embedded Jama Matrix goes away with item 5.

11. Resolve public name clashes

  • SonarCloud flags these as blockers. Each needs a public API change, so they wait for 8.0.
  • Name clashes (rule java:S1845):
    • core.sequence.features.AbstractFeature.TYPE: this public Comparator constant differs only in case from the field type. Rename it, e.g. TYPE_COMPARATOR, and LOCATION_LENGTH with it for consistency.
    • structure.secstruc.BridgeType.name and structure.secstruc.SecStrucType.name: these public fields on enums shadow Enum.name(). Rename them, e.g. label or description, and keep an accessor.

12. Stop imposing a logging backend on users

  • Every library module ships a log4j2.xml in its jar and passes log4j-core and log4j-slf4j2-impl on to users as runtime dependencies (the parent pom sets them to runtime scope).
  • A library should depend only on slf4j-api and let the application choose the backend. As it is, applications using another backend (e.g. logback) get "multiple SLF4J bindings" warnings, and BioJava's log4j2.xml competes with the application's own configuration on the classpath.
  • Change: move the log4j dependencies to test scope and log4j2.xml to src/test/resources in every module. Users who relied on BioJava's logging setup will need to add a backend themselves, which is why this waits for 8.0.

Out of scope for 8.0

  • New features and algorithms. 8.0 is about removing code and modernizing what stays. New work can go into 8.x.

Looking ahead to 9.0

  • Replace vecmath. javax.vecmath 1.3.1 is old and unmaintained, but its types (Point3d, Vector3d, Matrix4d, AxisAngle4d, Quat4d) are used throughout the biojava-structure public API. Moving to Hipparchus geometry (Vector3D, Rotation) would touch most of the structure package, which is too large a break to fit in 8.0. If Hipparchus works out in 8.0, this is a candidate for 9.0.

Feedback

Comments on this plan are very welcomed here.

Activity

  1. josemduarte commented on Dec 5, 2026

    @josemduarte
    ContributorAuthor

    General cleanups for 8.0: unused internal code

    A scan of the modules that stay in 8.0 (core, alignment, structure, genome, aa-prop, ontology, protein-disorder) found public code that nothing in BioJava uses and that looks internal rather than intended as API. Removing it, or making it non-public, fits the 8.0 breaking-change window.

    1. Developer scripts and one-off tools inside the library

    • genome, a project-specific analysis pipeline. These classes have main() methods with hard-coded /Users/Scooter/scripps/dyadic/... paths and are used only by each other. BlastXMLQuery has been superseded by core's BlastXMLParser.
      • query.BlastXMLQuery, query.OutputHitsGFF
      • homology.BlastHomologyHits, homology.GFF3FromUniprotBlastHits
      • util.SplitFasta, uniprot.UniprotToFasta
      • parsers.geneid.GeneIDXMLReader, parsers.gff.GCStats
    • App in genome and ontology: the Maven-template "Hello World!" main().
    • structure Mutator: unused. Its javadoc example writes to a developer's home directory.
    • structure xtal.io.TreeMapSpaceGroupWrapper: a JAXB wrapper apparently used once to generate the space-group XML. Unused at runtime.
    • main() methods with hard-coded paths in classes that stay: GFF3Reader, GeneIDGFF2Reader, GeneMarkGTFReader, StructurePairAligner, SmithWaterman3Daligner. Remove the main(), keep the class.

    2. File, network and XML helpers used only internally or only in tests

    • core.util.FileDownloadUtils:
      • openConnectionFollowingRedirects: unused.
      • getFileExtension, getFilePrefix, toUnixPath: used only in tests.
      • computeHash, writeHashFile, verifyHash, hashFromETag, normalizeETag: internal plumbing of downloadFile. Make them private or package-private.
    • structure.align.util.URLConnectionTools.doPOST (both overloads): unused.
    • structure.io.FileConvert.toDASStructure: produces output for DAS, a protocol that is long gone. setPrintConnections / doPrintConnections are unused too.
    • core.sequence.io.util.IOUtils.processReader: unused.
    • core.util.UncompressInputStream.uncompress(...) (the static one): used only in tests and a demo.
    • core.util.XMLHelper: addChildElement, getNewDocument, outputToStream and selectParentElement are used only in tests.
    • core.util.StringManipulationHelper: convertStreamToString, equalsToIgnoreEndline and equalsToXml are used only in tests. equalsToXml also never returns true (SonarCloud java:S3516) and is already @Deprecated. The other three methods are used by the GenBank writers: join duplicates String.join, and padLeft / padRight can be done with String.format. Once the writers switch, the whole class can go.
    • protein-disorder data.sequence.SequenceUtil: writeFasta, deepCleanSequence and isNonAmbNucleotideSequence are unused.
    • structure align.util.CollectionTools.randomPick and align.util.UserConfiguration.fromStartupParams: unused.
    • structure io.util.PDBTemporaryStorageUtils: its javadoc already says "Internal use only. Do not use this class." Make it package-private.

    3. Unused classes

    None of these is referenced anywhere in BioJava, nor in any repository of the rcsb or biojava GitHub organizations; private rcsb repositories and rcsb forks were checked too.

    • structure align.ce.CeCalculatorEnhanced: 2,415 lines.
    • structure utilities: symmetry.core.SystematicSolver, domain.SerializableCache, symmetry.utils.PowerSet, math.SparseSquareMatrix, symmetry.misc.ProteinComplexSignature.
    • structure data classes: BondType (javadoc: "Work in progress - NOT final!"), AugmentedResidueRange, align.pairwise.AligNPE, align.pairwise.AlignmentResult, scop.Astral.
    • core sequence.location.LocationHelper: 337 lines.

    4. Settings that do nothing

    • alignment routines.GuanUberbacher "cuts per section": cutsPerSection (declared in template.AbstractMatrixAligner) is never read by any alignment code, so setCutsPerSection, getCutsPerSection, the static setDefaultCutsPerSection and the 5-argument constructor have no effect on results. The setting is also broken on its own terms: setDefaultCutsPerSection assigns its parameter instead of the static field, and the default constructors call that static setter instead of setCutsPerSection, so getCutsPerSection() returns 0 rather than the documented 10. Remove the setting rather than fix it.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions