Skip to content

Commit 155a5fa

Browse files
authored
Upgrade to BioJava 6 (#137)
* Switch to biojava 6
1 parent 43071d3 commit 155a5fa

File tree

14 files changed

+313
-205
lines changed

14 files changed

+313
-205
lines changed

SequenceAnalysis/build.gradle

Lines changed: 163 additions & 142 deletions
Original file line numberDiff line numberDiff line change
@@ -9,169 +9,190 @@ import org.labkey.gradle.util.ExternalDependency
99
import java.util.regex.Matcher
1010

1111
repositories {
12-
mavenCentral()
13-
maven {
14-
url "https://clojars.org/repo"
15-
}
12+
mavenCentral()
13+
maven {
14+
url "https://clojars.org/repo"
15+
}
16+
// Added for opencharts dependency (required by biojava)
17+
maven {
18+
url "https://repository.jboss.org/nexus/content/repositories/thirdparty-releases/"
19+
}
20+
}
21+
22+
configurations.all {
23+
resolutionStrategy {
24+
force "com.sun.activation:jakarta.activation:${activationVersion}"
25+
force "javax.xml.bind:jaxb-api:${jaxbVersion}"
26+
// NOTE: this should be kept in sync with mcc module:
27+
force "jakarta.xml.bind:jakarta.xml.bind-api:2.3.3"
28+
}
1629
}
1730

1831
dependencies {
19-
apiImplementation "com.github.samtools:htsjdk:${htsjdkVersion}"
20-
BuildUtils.addExternalDependency(
21-
project,
22-
new ExternalDependency(
23-
"com.github.samtools:htsjdk:${htsjdkVersion}",
24-
'htsjdk',
25-
'htsjdk',
26-
'http://samtools.github.io/htsjdk/',
27-
ExternalDependency.MIT_LICENSE_NAME,
28-
ExternalDependency.MIT_LICENSE_URL,
29-
'A Java API for high-throughput sequencing data (HTS) formats'
30-
)
31-
)
32+
apiImplementation "com.github.samtools:htsjdk:${htsjdkVersion}"
33+
BuildUtils.addExternalDependency(
34+
project,
35+
new ExternalDependency(
36+
"com.github.samtools:htsjdk:${htsjdkVersion}",
37+
'htsjdk',
38+
'htsjdk',
39+
'http://samtools.github.io/htsjdk/',
40+
ExternalDependency.MIT_LICENSE_NAME,
41+
ExternalDependency.MIT_LICENSE_URL,
42+
'A Java API for high-throughput sequencing data (HTS) formats'
43+
)
44+
)
3245

33-
BuildUtils.addLabKeyDependency(project: project, config: "implementation", depProjectPath: ":server:modules:LabDevKitModules:laboratory", depProjectConfig: "apiJarFile")
34-
BuildUtils.addLabKeyDependency(project: project, config: "implementation", depProjectPath: ":server:modules:LabDevKitModules:LDK", depProjectConfig: "apiJarFile")
35-
BuildUtils.addExternalDependency(
36-
project,
37-
new ExternalDependency(
38-
'org.biojava:biojava3-core:3.0.7',
39-
'biojava3-core',
40-
'biojava',
41-
'http://biojava.org/wiki/Main_Page',
42-
ExternalDependency.GNU_LESSER_GPL_21_NAME,
43-
ExternalDependency.GNU_LESSER_GPL_21_URL,
44-
'Java framework for processing biological data'
45-
)
46-
)
46+
BuildUtils.addLabKeyDependency(project: project, config: "implementation", depProjectPath: ":server:modules:LabDevKitModules:laboratory", depProjectConfig: "apiJarFile")
47+
BuildUtils.addLabKeyDependency(project: project, config: "implementation", depProjectPath: ":server:modules:LabDevKitModules:LDK", depProjectConfig: "apiJarFile")
48+
BuildUtils.addExternalDependency(
49+
project,
50+
new ExternalDependency(
51+
'org.biojava:biojava-core:6.0.4',
52+
'biojava-core',
53+
'biojava',
54+
'http://biojava.org/wiki/Main_Page',
55+
ExternalDependency.GNU_LESSER_GPL_21_NAME,
56+
ExternalDependency.GNU_LESSER_GPL_21_URL,
57+
'Java framework for processing biological data'
58+
),
59+
{
60+
exclude group: 'jakarta.activation', module: 'jakarta.activation-api'
61+
exclude group: 'com.sun.activation', module: 'jakarta.activation'
62+
}
63+
)
4764

48-
BuildUtils.addExternalDependency(
49-
project,
50-
new ExternalDependency(
51-
'org.biojava:biojava3-genome:3.0.7',
52-
'biojava3-genome',
53-
'biojava',
54-
'http://biojava.org/wiki/Main_Page',
55-
ExternalDependency.GNU_LESSER_GPL_21_NAME,
56-
ExternalDependency.GNU_LESSER_GPL_21_URL,
57-
'Java framework for processing biological data'
58-
)
59-
)
65+
BuildUtils.addExternalDependency(
66+
project,
67+
new ExternalDependency(
68+
'org.biojava:biojava-genome:6.0.4',
69+
'biojava-genome',
70+
'biojava',
71+
'http://biojava.org/wiki/Main_Page',
72+
ExternalDependency.GNU_LESSER_GPL_21_NAME,
73+
ExternalDependency.GNU_LESSER_GPL_21_URL,
74+
'Java framework for processing biological data'
75+
),
76+
{
77+
exclude group: 'jakarta.activation', module: 'jakarta.activation-api'
78+
exclude group: 'com.sun.activation', module: 'jakarta.activation'
79+
}
80+
)
6081

61-
BuildUtils.addExternalDependency(
62-
project,
63-
new ExternalDependency(
64-
'org.itadaki:bzip2:0.9.1',
65-
'jbzip2',
66-
'jbzip2',
67-
'http://code.google.com/p/jbzip2/',
68-
ExternalDependency.MIT_LICENSE_NAME,
69-
ExternalDependency.MIT_LICENSE_URL,
70-
'BZIP compression/decompression library. Used by FastQC'
71-
)
72-
)
82+
BuildUtils.addExternalDependency(
83+
project,
84+
new ExternalDependency(
85+
'org.itadaki:bzip2:0.9.1',
86+
'jbzip2',
87+
'jbzip2',
88+
'http://code.google.com/p/jbzip2/',
89+
ExternalDependency.MIT_LICENSE_NAME,
90+
ExternalDependency.MIT_LICENSE_URL,
91+
'BZIP compression/decompression library. Used by FastQC'
92+
)
93+
)
7394

74-
BuildUtils.addExternalDependency(
75-
project,
76-
new ExternalDependency(
77-
'org.clojars.chapmanb:sam:1.96',
78-
'picard tools',
79-
'picard tools',
80-
'http://sourceforge.net/projects/picard/',
81-
ExternalDependency.MIT_LICENSE_NAME,
82-
ExternalDependency.MIT_LICENSE_URL,
83-
'Library for working with SAM/BAM files. Used by FastQC'
84-
)
85-
)
86-
implementation "net.sf.opencsv:opencsv:${opencsvVersion}"
95+
BuildUtils.addExternalDependency(
96+
project,
97+
new ExternalDependency(
98+
'org.clojars.chapmanb:sam:1.96',
99+
'picard tools',
100+
'picard tools',
101+
'http://sourceforge.net/projects/picard/',
102+
ExternalDependency.MIT_LICENSE_NAME,
103+
ExternalDependency.MIT_LICENSE_URL,
104+
'Library for working with SAM/BAM files. Used by FastQC'
105+
)
106+
)
107+
implementation "net.sf.opencsv:opencsv:${opencsvVersion}"
87108

88-
// picard brings in a version of servlet-api and a very old one at that, so we excluded it
89-
// Note: if changing this, we might need to match the htsjdk version set in gradle.properties
90-
BuildUtils.addExternalDependency(
91-
project,
92-
new ExternalDependency(
93-
"com.github.broadinstitute:picard:2.26.10",
94-
"Picard Tools Lib",
95-
"PicardTools",
96-
"https://github.com/broadinstitute/picard",
97-
ExternalDependency.APACHE_2_LICENSE_NAME,
98-
ExternalDependency.APACHE_2_LICENSE_URL,
99-
"Manipulating Sequence Data"
100-
),
101-
{
102-
exclude group: "javax.servlet", module: "servlet-api"
103-
exclude group: "org.apache.commons", module: "commons-collections4"
104-
}
105-
)
109+
// picard brings in a version of servlet-api and a very old one at that, so we excluded it
110+
// Note: if changing this, we might need to match the htsjdk version set in gradle.properties
111+
BuildUtils.addExternalDependency(
112+
project,
113+
new ExternalDependency(
114+
"com.github.broadinstitute:picard:2.26.10",
115+
"Picard Tools Lib",
116+
"PicardTools",
117+
"https://github.com/broadinstitute/picard",
118+
ExternalDependency.APACHE_2_LICENSE_NAME,
119+
ExternalDependency.APACHE_2_LICENSE_URL,
120+
"Manipulating Sequence Data"
121+
),
122+
{
123+
exclude group: "javax.servlet", module: "servlet-api"
124+
exclude group: "org.apache.commons", module: "commons-collections4"
125+
}
126+
)
106127

107-
BuildUtils.addExternalDependency(
108-
project,
109-
new ExternalDependency(
110-
"commons-net:commons-net:${commonsNetVersion}",
111-
"Commons Net",
112-
"Apache",
113-
"http://jakarta.apache.org/commons/net/",
114-
ExternalDependency.APACHE_2_LICENSE_NAME,
115-
ExternalDependency.APACHE_2_LICENSE_URL,
116-
"FTPClient used to retrieve resources from other servers (e.g., GO annotations)"
117-
)
118-
)
119-
BuildUtils.addExternalDependency(
120-
project,
121-
new ExternalDependency(
122-
"org.apache.commons:commons-math3:${commonsMath3Version}",
123-
"Commons Math",
124-
"Apache",
125-
"http://commons.apache.org/math/",
126-
ExternalDependency.APACHE_2_LICENSE_NAME,
127-
ExternalDependency.APACHE_2_LICENSE_URL,
128-
"Lightweight, self-contained mathematics and statistics components"
129-
)
130-
)
131-
apiImplementation "org.apache.commons:commons-math3:${commonsMath3Version}"
132-
BuildUtils.addLabKeyDependency(project: project, config: "modules", depProjectPath: ":server:modules:LabDevKitModules:laboratory", depProjectConfig: "published", depExtension: "module")
133-
BuildUtils.addLabKeyDependency(project: project, config: "modules", depProjectPath: ":server:modules:LabDevKitModules:LDK", depProjectConfig: "published", depExtension: "module")
128+
BuildUtils.addExternalDependency(
129+
project,
130+
new ExternalDependency(
131+
"commons-net:commons-net:${commonsNetVersion}",
132+
"Commons Net",
133+
"Apache",
134+
"http://jakarta.apache.org/commons/net/",
135+
ExternalDependency.APACHE_2_LICENSE_NAME,
136+
ExternalDependency.APACHE_2_LICENSE_URL,
137+
"FTPClient used to retrieve resources from other servers (e.g., GO annotations)"
138+
)
139+
)
140+
BuildUtils.addExternalDependency(
141+
project,
142+
new ExternalDependency(
143+
"org.apache.commons:commons-math3:${commonsMath3Version}",
144+
"Commons Math",
145+
"Apache",
146+
"http://commons.apache.org/math/",
147+
ExternalDependency.APACHE_2_LICENSE_NAME,
148+
ExternalDependency.APACHE_2_LICENSE_URL,
149+
"Lightweight, self-contained mathematics and statistics components"
150+
)
151+
)
152+
apiImplementation "org.apache.commons:commons-math3:${commonsMath3Version}"
153+
BuildUtils.addLabKeyDependency(project: project, config: "modules", depProjectPath: ":server:modules:LabDevKitModules:laboratory", depProjectConfig: "published", depExtension: "module")
154+
BuildUtils.addLabKeyDependency(project: project, config: "modules", depProjectPath: ":server:modules:LabDevKitModules:LDK", depProjectConfig: "published", depExtension: "module")
134155
}
135156

136157
if (project.findProject(BuildUtils.getTestProjectPath(project.gradle)) != null && project.hasProperty("teamcity"))
137158
{
138-
def testProject = project.findProject(BuildUtils.getTestProjectPath(project.gradle))
139-
def createPipelineConfigTask = project.tasks.register("createPipelineConfig", Copy) {
140-
Copy task ->
141-
task.group = GroupNames.TEST_SERVER
142-
task.description = "Create pipeline configs for running tests on the test server"
143-
task.from project.file("test/configs")
144-
task.include "pipelineConfig.xml"
145-
task.filter({ String line ->
146-
Matcher matcher = PropertiesUtils.PROPERTY_PATTERN.matcher(line)
147-
def extension = testProject.extensions.findByType(TeamCityExtension.class)
148-
String newLine = line
149-
while (matcher.find())
150-
{
151-
if (matcher.group(1).equals("SEQUENCEANALYSIS_TOOLS"))
152-
newLine = newLine.replace(matcher.group(), extension.getTeamCityProperty("additional.pipeline.tools"))
153-
}
154-
return newLine
159+
def testProject = project.findProject(BuildUtils.getTestProjectPath(project.gradle))
160+
def createPipelineConfigTask = project.tasks.register("createPipelineConfig", Copy) {
161+
Copy task ->
162+
task.group = GroupNames.TEST_SERVER
163+
task.description = "Create pipeline configs for running tests on the test server"
164+
task.from project.file("test/configs")
165+
task.include "pipelineConfig.xml"
166+
task.filter({ String line ->
167+
Matcher matcher = PropertiesUtils.PROPERTY_PATTERN.matcher(line)
168+
def extension = testProject.extensions.findByType(TeamCityExtension.class)
169+
String newLine = line
170+
while (matcher.find())
171+
{
172+
if (matcher.group(1).equals("SEQUENCEANALYSIS_TOOLS"))
173+
newLine = newLine.replace(matcher.group(), extension.getTeamCityProperty("additional.pipeline.tools"))
174+
}
175+
return newLine
155176

156-
})
157-
task.destinationDir = new File("${ServerDeployExtension.getServerDeployDirectory(project)}/config")
158-
}
159-
testProject.tasks.named("startTomcat").configure {
160-
dependsOn(createPipelineConfigTask)
161-
}
177+
})
178+
task.destinationDir = new File("${ServerDeployExtension.getServerDeployDirectory(project)}/config")
179+
}
180+
testProject.tasks.named("startTomcat").configure {
181+
dependsOn(createPipelineConfigTask)
182+
}
162183
}
163184

164185
project.task("copyJars",
165186
type: Copy,
166187
group: "Build",
167188
description: "Copy commons-math3 JAR to module's lib directory",
168189
{ CopySpec copy ->
169-
copy.setDuplicatesStrategy(DuplicatesStrategy.EXCLUDE)
170-
copy.from(project.configurations.external)
171-
copy.into new File("${project.labkey.explodedModuleLibDir}")
172-
copy.include {
173-
"**commons-math3-**.jar"
174-
}
190+
copy.setDuplicatesStrategy(DuplicatesStrategy.EXCLUDE)
191+
copy.from(project.configurations.external)
192+
copy.into new File("${project.labkey.explodedModuleLibDir}")
193+
copy.include {
194+
"**commons-math3-**.jar"
195+
}
175196
}
176197
)
177198

SequenceAnalysis/src/org/labkey/sequenceanalysis/SequenceAnalysisController.java

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -25,12 +25,12 @@
2525
import org.apache.commons.lang3.StringUtils;
2626
import org.apache.logging.log4j.LogManager;
2727
import org.apache.logging.log4j.Logger;
28-
import org.biojava3.core.sequence.DNASequence;
29-
import org.biojava3.core.sequence.compound.AmbiguityDNACompoundSet;
30-
import org.biojava3.core.sequence.compound.NucleotideCompound;
31-
import org.biojava3.core.sequence.io.DNASequenceCreator;
32-
import org.biojava3.core.sequence.io.FastaReader;
33-
import org.biojava3.core.sequence.io.GenericFastaHeaderParser;
28+
import org.biojava.nbio.core.sequence.DNASequence;
29+
import org.biojava.nbio.core.sequence.compound.AmbiguityDNACompoundSet;
30+
import org.biojava.nbio.core.sequence.compound.NucleotideCompound;
31+
import org.biojava.nbio.core.sequence.io.DNASequenceCreator;
32+
import org.biojava.nbio.core.sequence.io.FastaReader;
33+
import org.biojava.nbio.core.sequence.io.GenericFastaHeaderParser;
3434
import org.jetbrains.annotations.NotNull;
3535
import org.jfree.chart.JFreeChart;
3636
import org.json.JSONArray;
@@ -4558,9 +4558,9 @@ public ApiResponse execute(CompareFastaSequencesForm form, BindException errors)
45584558
allowedReferences = new TableSelector(ti, filter, null).getArrayList(RefNtSequenceModel.class);
45594559
}
45604560

4561-
try (InputStream is = IOUtils.toInputStream(form.getFasta()))
4561+
try (InputStream is = IOUtils.toInputStream(form.getFasta(), StringUtilsLabKey.DEFAULT_CHARSET))
45624562
{
4563-
FastaReader<DNASequence, NucleotideCompound> fastaReader = new FastaReader<>(is, new GenericFastaHeaderParser<DNASequence, NucleotideCompound>(), new DNASequenceCreator(AmbiguityDNACompoundSet.getDNACompoundSet()));
4563+
FastaReader<DNASequence, NucleotideCompound> fastaReader = new FastaReader<>(is, new GenericFastaHeaderParser<>(), new DNASequenceCreator(AmbiguityDNACompoundSet.getDNACompoundSet()));
45644564
LinkedHashMap<String, DNASequence> fastaData = fastaReader.process();
45654565

45664566
for (String fastaHeader : fastaData.keySet())

SequenceAnalysis/src/org/labkey/sequenceanalysis/SequenceAnalysisModule.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,7 @@
8181
import org.labkey.sequenceanalysis.pipeline.SequenceReadsetHandlerPipelineProvider;
8282
import org.labkey.sequenceanalysis.pipeline.VariantProcessingJob;
8383
import org.labkey.sequenceanalysis.query.SequenceAnalysisUserSchema;
84+
import org.labkey.sequenceanalysis.query.SequenceTriggerHelper;
8485
import org.labkey.sequenceanalysis.run.alignment.BWAMemWrapper;
8586
import org.labkey.sequenceanalysis.run.alignment.BWASWWrapper;
8687
import org.labkey.sequenceanalysis.run.alignment.BWAWrapper;
@@ -464,7 +465,8 @@ public Set<Class> getIntegrationTests()
464465
SequenceIntegrationTests.SequenceAnalysisPipelineTestCase1.class,
465466
SequenceIntegrationTests.SequenceAnalysisPipelineTestCase2.class,
466467
OutputIntegrationTests.VariantProcessingTest.class,
467-
SequenceRemoteIntegrationTests.class
468+
SequenceRemoteIntegrationTests.class,
469+
SequenceTriggerHelper.TestCase.class
468470
));
469471

470472
return testClasses;

0 commit comments

Comments
 (0)