Skip to content

Commit 4005734

Browse files
authored
Merge pull request #160 from PolinaBevad/add_java_11_support
Add Java 11 support
2 parents 387c163 + 84cc561 commit 4005734

File tree

14 files changed

+184
-146
lines changed

14 files changed

+184
-146
lines changed

.travis.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,10 @@ cache:
88
- $HOME/.gradle/wrapper/
99
jdk:
1010
- oraclejdk8
11-
- oraclejdk10
11+
- oraclejdk11
1212
- openjdk8
1313
- openjdk10
14+
- openjdk11
1415
script:
1516
- ./gradlew test jacocoTestReport
1617
- ./gradlew installDist

VarDict

build.gradle

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -27,12 +27,8 @@ dependencies {
2727
compile('com.github.samtools:htsjdk:2.8.0') {
2828
transitive = false
2929
}
30-
// https://mvnrepository.com/artifact/org.powermock/powermock-module-junit4
31-
testCompile group: 'org.powermock', name: 'powermock-api-mockito2', version: '2.0.0-beta.5'
32-
testCompile group: 'org.powermock', name: 'powermock-module-testng', version: '2.0.0-beta.5'
30+
testCompile 'org.mockito:mockito-core:2.23.0'
3331
testCompile 'org.testng:testng:6.9.13.6'
34-
testCompile 'net.bytebuddy:byte-buddy:1.8.3'
35-
testCompile 'net.bytebuddy:byte-buddy-agent:1.8.3'
3632
}
3733

3834
mainClassName = "com.astrazeneca.vardict.Main"
@@ -74,4 +70,7 @@ jar {
7470
}
7571
}
7672

73+
jacoco {
74+
toolVersion = "0.8.2"
75+
}
7776
applicationDistribution.from('VarDict/teststrandbias.R','VarDict/testsomatic.R','VarDict/var2vcf_valid.pl','VarDict/var2vcf_paired.pl').into('bin')

gradle/wrapper/gradle-wrapper.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME
33
distributionPath=wrapper/dists
44
zipStoreBase=GRADLE_USER_HOME
55
zipStorePath=wrapper/dists
6-
distributionUrl=https\://services.gradle.org/distributions/gradle-4.8-bin.zip
6+
distributionUrl=https\://services.gradle.org/distributions/gradle-4.10.2-bin.zip

src/main/java/com/astrazeneca/vardict/Main.java

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,11 @@ public static void main(String[] args) throws ParseException, IOException {
2828
if (cmd.getOptions().length == 0 || cmd.hasOption("H")) {
2929
help(options);
3030
}
31-
new Main().run(cmd);
31+
Configuration conf = new Main().run(cmd);
32+
33+
ReferenceResource referenceResource = new ReferenceResource();
34+
VarDict varDict = new VarDict(conf, referenceResource);
35+
varDict.start();
3236
} catch (MissingOptionException e) {
3337
List<?> missingOptions = e.getMissingOptions();
3438
System.err.print("Missing required option(s): ");
@@ -45,7 +49,7 @@ public static void main(String[] args) throws ParseException, IOException {
4549
}
4650
}
4751

48-
private void run(CommandLine cmd) throws ParseException, IOException {
52+
public Configuration run(CommandLine cmd) throws ParseException, IOException {
4953
Configuration conf = new Configuration();
5054

5155
// -v is not used
@@ -150,8 +154,7 @@ private void run(CommandLine cmd) throws ParseException, IOException {
150154
conf.threads = Math.max(readThreadsCount(cmd), 1);
151155
conf.referenceExtension = getIntValue(cmd, "Y", 1200);
152156

153-
VarDict.start(conf);
154-
157+
return conf;
155158
}
156159

157160
private int readThreadsCount(CommandLine cmd) throws ParseException {
@@ -183,7 +186,7 @@ private static int getColumnValue(CommandLine cmd, String opt, int defaultValue)
183186
}
184187

185188
@SuppressWarnings("static-access")
186-
private static Options buildOptions() {
189+
public static Options buildOptions() {
187190
Options options = new Options();
188191
options.addOption("H", "?", false, "Print this help page");
189192
options.addOption("h", "header", false, "Print a header row describing columns");

src/main/java/com/astrazeneca/vardict/ReferenceResource.java

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ synchronized private static IndexedFastaSequenceFile fetchFasta(String file) {
3636
* @param end end position of region
3737
* @return array of nucleotide bases in the region of fasta
3838
*/
39-
public static String[] retrieveSubSeq(String fasta, String chr, int start, int end) {
39+
public String[] retrieveSubSeq(String fasta, String chr, int start, int end) {
4040
IndexedFastaSequenceFile idx = fetchFasta(fasta);
4141
ReferenceSequence seq = idx.getSubsequenceAt(chr, start, end);
4242
byte[] bases = seq.getBases();
@@ -50,7 +50,7 @@ public static String[] retrieveSubSeq(String fasta, String chr, int start, int e
5050
* @param conf Vardict Configuration
5151
* @return reference object contains sequence map: key - position, value - base and seed map
5252
*/
53-
public static Reference getREF(Region region, Map<String, Integer> chrs, Configuration conf) {
53+
public Reference getREF(Region region, Map<String, Integer> chrs, Configuration conf) {
5454
Reference ref = new Reference();
5555
return getREF(region, chrs, conf, conf.referenceExtension, ref);
5656
}
@@ -64,7 +64,7 @@ public static Reference getREF(Region region, Map<String, Integer> chrs, Configu
6464
* @param ref reference
6565
* @return reference object contains sequence map: key - position, value - base and seed map
6666
*/
67-
public static Reference getREF(Region region, Map<String, Integer> chrs, Configuration conf, int extension, Reference ref) {
67+
public Reference getREF(Region region, Map<String, Integer> chrs, Configuration conf, int extension, Reference ref) {
6868
int sequenceStart = region.start - conf.numberNucleotideToExtend - extension < 1 ? 1
6969
: region.start - conf.numberNucleotideToExtend - extension;
7070
int len = chrs.containsKey(region.chr) ? chrs.get(region.chr) : 0;
@@ -98,7 +98,6 @@ public static Reference getREF(Region region, Map<String, Integer> chrs, Configu
9898

9999
keySequence = substr(exon, i, Configuration.SEED_2);
100100
ref = addPositionsToSeedSequence(ref, sequenceStart, i, keySequence);
101-
102101
}
103102

104103
if (conf.y) {
@@ -116,7 +115,7 @@ public static Reference getREF(Region region, Map<String, Integer> chrs, Configu
116115
* @param keySequence sequence length of SEED_1 parameter from chromosome
117116
* @return updated Reference
118117
*/
119-
public static Reference addPositionsToSeedSequence(Reference ref, int sequenceStart, int i, String keySequence) {
118+
private static Reference addPositionsToSeedSequence(Reference ref, int sequenceStart, int i, String keySequence) {
120119
List<Integer> seedPositions = ref.seed.getOrDefault(keySequence, new ArrayList<>());
121120
seedPositions.add(i + sequenceStart);
122121
ref.seed.put(keySequence, seedPositions);

0 commit comments

Comments
 (0)