Skip to content

Excise SRA support and ngs-java dependency#1774

Merged
tfenne merged 1 commit into
devfrom
tf_excise_sra
Apr 25, 2026
Merged

Excise SRA support and ngs-java dependency#1774
tfenne merged 1 commit into
devfrom
tf_excise_sra

Conversation

@tfenne
Copy link
Copy Markdown
Member

@tfenne tfenne commented Apr 25, 2026

Summary

Removes all NCBI SRA reading support and the gov.nih.nlm.ncbi:ngs-java dependency. This is a breaking API change for v5.0.0.

Why

  • ngs-java ships native libraries that have repeatedly caused build/runtime friction (load failures, platform-specific bugs, opt-in download flag).
  • SRA usage in htsjdk is rare in practice, and consumers that need it can drop down to NCBI's own tooling or a dedicated library.
  • Cuts a non-trivial amount of build complexity, JVM-arg plumbing, and special-case dispatch in core types like SamReaderFactory and SamInputResource.

What's removed

Build / config:

  • gov.nih.nlm.ncbi:ngs-java:2.9.0 api dependency.
  • "sra" TestNG group references in build.gradle and htsjdk.TestDataProviders.EXCLUDED_GROUPS.
  • -Dsamjdk.sra_libraries_download=true JVM arg on testExternalApis.
  • Defaults.SRA_LIBRARIES_DOWNLOAD.

Public API:

  • htsjdk.samtools.SRAFileReader, SRAIterator, SRAIndex.
  • The entire htsjdk.samtools.sra package (SRAAccession, SRALazyRecord, SRAAlignmentIterator, SRAUnalignmentIterator, SRAUtils, ReferenceCache, SRAIndexedSequenceFile).
  • SamInputResource.of(SRAAccession) factory + the SRA_ACCESSION InputResource.Type value.
  • SamReader.Type.SRA_TYPE.

Internal:

  • The SRA dispatch branches in SamReaderFactory (resource-type switch, file-type autodetection, the Option enum's applyTo(SRAFileReader, …) overrides).
  • The SRA inner classes / overrides in SamInputResource.

Tests / resources:

  • 7 test classes under src/test/java/htsjdk/samtools/sra/ and test_archive.sra.

Docs:

  • The README's SRA license-attribution sentence.

What downstream consumers need to do

If you have code that calls any of:

  • SamInputResource.of(SRAAccession)
  • SamReader.Type.SRA_TYPE
  • InputResource.Type.SRA_ACCESSION
  • anything under htsjdk.samtools.sra / SRAFileReader / SRAIterator / SRAIndex
  • Defaults.SRA_LIBRARIES_DOWNLOAD
  • the JVM property -Dsamjdk.sra_libraries_download

…delete it. There is no replacement in htsjdk.

Test plan

  • ./gradlew compileJava compileTestJava — passes
  • ./gradlew test21,877 / 21,877 pass (down from 21,936 on dev; the difference is the removed sra-group test classes plus DataProvider paths that referenced the sra group)
  • ./gradlew spotbugsMain spotbugsTest — clean, no new findings
  • ./gradlew spotlessCheck — clean
  • Stragglers: grep for \bSRA[A-Za-z_], ^import ngs\., "sra", ngs-java, sra_libraries across src/, build.gradle, README.md, CONTRIBUTING.md, CHANGELOG.md, .github/ — zero remaining references
  • CI: confirm test, formatCheck, spotBugs jobs green
  • CHANGELOG entry for v5.0.0 will follow in the dedicated CHANGELOG/breaking-changes PR

The NCBI SRA reader, backed by the gov.nih.nlm.ncbi:ngs-java native
library, has been a recurring source of build/runtime friction and is
being removed for v5.0.0. Downstream consumers that need SRA must
implement it themselves or use a different library.

Removed:
- gov.nih.nlm.ncbi:ngs-java api dependency from build.gradle.
- The "sra" TestNG group from build.gradle's test and testExternalApis
  tasks (and from htsjdk.TestDataProviders.EXCLUDED_GROUPS).
- The -Dsamjdk.sra_libraries_download=true JVM arg from
  testExternalApis. The corresponding Defaults.SRA_LIBRARIES_DOWNLOAD
  field is removed.
- 10 main sources under htsjdk/samtools and htsjdk/samtools/sra/
  (SRAFileReader, SRAIterator, SRAIndex, SRAAccession, SRALazyRecord,
  SRAAlignmentIterator, SRAUnalignmentIterator, SRAUtils, ReferenceCache,
  SRAIndexedSequenceFile).
- 7 test classes under htsjdk/samtools/sra/ and the test_archive.sra
  resource.
- SamReader.Type.SRA_TYPE.
- The README's SRA license-attribution sentence.

Modified (SRA hooks removed):
- SamInputResource: drops InputResource.Type.SRA_ACCESSION, the
  abstract asSRAAccession() method and all its overrides, the
  SRAInputResource inner class, and the SamInputResource.of(SRAAccession)
  factory.
- SamReaderFactory: drops the SRA dispatch in the resource type switch,
  the isSra() autodetection branch, the abstract
  applyTo(SRAFileReader, ...) method on Option and all five overrides
  of it, plus the instanceof SRAFileReader branch.
- SamReaderFactoryTest, SamReaderTest, ReadsBundle (TODO comment): minor
  follow-on edits where these referenced the removed types.

Verification:
- ./gradlew compileJava compileTestJava: passes.
- ./gradlew test: 21,877 / 21,877 pass (down from 21,936 on dev; the
  difference is the removed sra test classes plus DataProvider-discovered
  test paths that referenced the sra group).
- ./gradlew spotbugsMain spotbugsTest: clean, no new findings.
- ./gradlew spotlessCheck: clean (autoformat applied during compile).
- Stragglers: grep'd src/, build.gradle, README, CONTRIBUTING, CHANGELOG,
  and .github/ for "SRA" tokens, "import ngs.", "sra" string literals,
  "ngs-java", and "sra_libraries" -- no remaining references.

CHANGELOG entry deferred to the dedicated v5.0.0 CHANGELOG task.
@tfenne tfenne merged commit 49e50e3 into dev Apr 25, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant