Skip to content

Commit 49e50e3

Browse files
authored
Excise SRA support from htsjdk (#1774)
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.
1 parent 41e497a commit 49e50e3

28 files changed

Lines changed: 9 additions & 3973 deletions

README.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,6 @@ Broadly speaking the majority of the code is covered under the MIT license with
9696

9797
* Much of the CRAM code is under the Apache License, Version 2
9898
* Core `tribble` code (underlying VCF reading/writing amongst other things) is under LGPL
99-
* Code supporting the reading/writing of SRA format is uncopyrighted & public domain
10099

101100
### Java Minimum Version Support Policy
102101

build.gradle

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,6 @@ dependencies {
5151
implementation "org.json:json:20231013"
5252
implementation 'org.openjdk.nashorn:nashorn-core:15.4'
5353

54-
api "gov.nih.nlm.ncbi:ngs-java:2.9.0"
5554
api "org.apache.commons:commons-jexl:2.1.1"
5655

5756
testImplementation 'org.testng:testng:7.8.0'
@@ -225,13 +224,13 @@ tasks.register('testWithOptimisticVCF4_4', Test) {
225224
}
226225

227226
test {
228-
description = "Runs the unit tests other than the SRA tests"
227+
description = "Runs the unit tests other than external-API tests"
229228

230229
useTestNG {
231230
if (OperatingSystem.current().isUnix()) {
232-
excludeGroups "slow", "broken", "defaultReference", "optimistic_vcf_4_4", "ftp", "http", "sra", "ena", "htsget"
231+
excludeGroups "slow", "broken", "defaultReference", "optimistic_vcf_4_4", "ftp", "http", "ena", "htsget"
233232
} else {
234-
excludeGroups "slow", "broken", "defaultReference", "optimistic_vcf_4_4", "ftp", "http", "sra", "ena", "htsget", "unix"
233+
excludeGroups "slow", "broken", "defaultReference", "optimistic_vcf_4_4", "ftp", "http", "ena", "htsget", "unix"
235234
}
236235
parallel = "classes"
237236
threadCount = Runtime.runtime.availableProcessors()
@@ -250,13 +249,12 @@ tasks.register('testFTP', Test) {
250249
}
251250

252251
tasks.register('testExternalApis', Test) {
253-
description = "Run the SRA, ENA, and HTTP tests (tests that interact with external APIs)"
252+
description = "Run the ENA and HTTP tests (tests that interact with external APIs)"
254253
testClassesDirs = sourceSets.test.output.classesDirs
255254
classpath = sourceSets.test.runtimeClasspath
256-
jvmArgs += '-Dsamjdk.sra_libraries_download=true'
257255

258256
useTestNG {
259-
includeGroups "sra", "http", "ena"
257+
includeGroups "http", "ena"
260258
excludeGroups "slow", "broken"
261259
}
262260
}

src/main/java/htsjdk/beta/plugin/reads/ReadsBundle.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -201,7 +201,7 @@ private static <T extends IOPath> Optional<Tuple<String, String>> getInferredCon
201201
} else if (ext.equals((FileExtensions.SAM))) {
202202
return Optional.of(new Tuple<>(BundleResourceType.CT_ALIGNED_READS, BundleResourceType.FMT_READS_SAM));
203203
}
204-
// TODO: finish this, else SRA, htsget,...
204+
// TODO: finish this, else htsget,...
205205
}
206206
return Optional.empty();
207207
}

src/main/java/htsjdk/samtools/Defaults.java

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -95,12 +95,6 @@ public class Defaults {
9595
*/
9696
public static final String EBI_REFERENCE_SERVICE_URL_MASK;
9797

98-
/**
99-
* Boolean describing whether downloading of SRA native libraries is allowed,
100-
* in case such native libraries are not found locally. Default = false.
101-
*/
102-
public static final boolean SRA_LIBRARIES_DOWNLOAD;
103-
10498
/**
10599
* Whether to attempt to use jlibdeflate (libdeflate via JNI) for DEFLATE compression and decompression.
106100
* When true, the default deflater/inflater factories will try to load the native library and fall back
@@ -143,7 +137,6 @@ public class Defaults {
143137
CUSTOM_READER_FACTORY = getStringProperty("custom_reader", "");
144138
SAM_FLAG_FIELD_FORMAT =
145139
SamFlagField.valueOf(getStringProperty("sam_flag_field_format", SamFlagField.DECIMAL.name()));
146-
SRA_LIBRARIES_DOWNLOAD = getBooleanProperty("sra_libraries_download", false);
147140
USE_LIBDEFLATE = getBooleanProperty("use_libdeflate", true);
148141
DISABLE_SNAPPY_COMPRESSOR = getBooleanProperty(DISABLE_SNAPPY_PROPERTY_NAME, false);
149142
OPTIMISTIC_VCF_4_4 = getBooleanProperty(OPTIMISTIC_VCF_4_4_PROPERTY, false);

src/main/java/htsjdk/samtools/SRAFileReader.java

Lines changed: 0 additions & 301 deletions
This file was deleted.

0 commit comments

Comments
 (0)