Skip to content

Commit 2d507a4

Browse files
Nikolai KarulinNikolai Karulin
authored andcommitted
VarDictJava inherited Perl version static procedural structure. In this release huge refactoring was provided. At the top level refactoring includes following steps:
Scopes decomposition Method decomposition Data aggregation Global scope extraction Entities extraction Data flow rerouting Extraction of Modules entities Pipeline organisation Extraction of Modes entities Also, custom htsjdk version was applied in the VarDict release 2.0, it includes new cache feature for bam-files.
1 parent d877aac commit 2d507a4

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

48 files changed

+8709
-7033
lines changed

Readme.md

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ Original coded by Zhongwu Lai 2014.
1818
VarDictJava can run in single sample (see Single sample mode section), paired sample (see Paired variant calling section), or amplicon bias aware modes. As input, VarDictJava takes reference genomes in FASTA format, aligned reads in BAM format, and target regions in BED format.
1919

2020
##Requirements
21-
1. JDK 1.7 or later
21+
1. JDK 1.8 or later
2222
2. R language (uses /usr/bin/env R)
2323
3. Perl (uses /usr/bin/env perl)
2424
4. Internet connection to download dependencies using gradle.
@@ -50,7 +50,6 @@ To generate Javadoc, in the build/docs/javadoc folder, run the following command
5050
./gradlew clean javadoc
5151
```
5252

53-
5453
###Single sample mode
5554

5655
To run VarDictJava in single sample mode, use a BAM file specified without the `|` symbol and perform Steps 3 and 4 (see the Program workflow section) using `teststrandbias.R` and `var2vcf_valid.pl.`
@@ -103,7 +102,11 @@ The VarDictJava program follows the workflow:
103102
4. Transform the intermediate tabular format to VCF. Output the variants with filtering and statistical data.
104103
**Note**: Use the Perl scripts `var2vcf_valid.pl` or `var2vcf_paired.pl` for this step.
105104

105+
###BAM caching
106106

107+
For enabling bam caching feature append the VARDICT_OPT parameter with:
108+
-Dsamjdk.bam_caching=true
109+
-Dsamjdk.cache_size=[value] (default value = 128, measured in MB).
107110

108111
##Program Options
109112

@@ -220,6 +223,7 @@ The VarDictJava program follows the workflow:
220223
18. PStd - flag for read position standard deviation
221224
19. QMean - mean base quality
222225
20. QStd - flag for base quality standard deviation
226+
21. Mapq - Mean mapping quality
223227
23. QRATIO - ratio of high quality reads to low-quality reads
224228
24. HIFREQ - variant frequency for high-quality reads
225229
25. EXTRAFR - Adjusted AF for indels due to local realignment

VarDictDescription.docx

-22.6 KB
Binary file not shown.
-514 KB
Binary file not shown.
26.3 KB
Binary file not shown.

build.gradle

Lines changed: 68 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,34 @@
1-
apply plugin: 'java'
2-
apply plugin:'application'
1+
plugins {
2+
id 'java'
3+
id 'application'
4+
id 'jacoco'
5+
id "org.sonarqube" version "2.2"
6+
}
37

4-
version = '1.4.8'
8+
version = '2.0b'
59

610

711
repositories {
8-
mavenCentral()
12+
mavenCentral()
13+
jcenter()
14+
//for building custom htsjdk with bam caching from our fork repo
15+
maven { url "https://jitpack.io" }
916
}
1017

1118
targetCompatibility = "1.8"
1219
sourceCompatibility = "1.8"
1320

21+
sourceSets {
22+
integrationTest {
23+
java {
24+
compileClasspath += main.output + test.output
25+
runtimeClasspath += main.output + test.output
26+
srcDir file('src/integration-test/java')
27+
}
28+
resources.srcDir file('src/integration-test/resources')
29+
}
30+
}
31+
1432

1533
afterEvaluate {
1634
if(project.hasProperty("hprof")) {
@@ -20,13 +38,22 @@ afterEvaluate {
2038
}
2139
}
2240

41+
configurations {
42+
integrationTestCompile.extendsFrom testCompile
43+
integrationTestRuntime.extendsFrom testRuntime
44+
}
45+
2346
dependencies {
2447
compile 'commons-cli:commons-cli:1.2'
2548
compile 'com.edropple.jregex:jregex:1.2_01'
26-
compile('com.github.samtools:htsjdk:2.8.0') {
27-
transitive = false
28-
}
29-
testCompile 'junit:junit:4.8.2'
49+
compile 'com.github.EpamLifeSciencesTeam:htsjdk:epam-ls_BAM_cache-SNAPSHOT'
50+
// https://mvnrepository.com/artifact/org.powermock/powermock-module-junit4
51+
testCompile group: 'org.powermock', name: 'powermock-api-mockito', version: '1.6.6'
52+
testCompile group: 'org.powermock', name: 'powermock-module-testng', version: '1.6.6'
53+
testCompile'org.testng:testng:6.9.13.6'
54+
55+
integrationTestCompile 'org.testng:testng:6.9.13.6'
56+
3057
}
3158

3259
mainClassName = "com.astrazeneca.vardict.Main"
@@ -50,7 +77,39 @@ javadoc {
5077
exclude '**/ConcurrentHashSet*'
5178
exclude '**/Utils*'
5279
exclude '**/Tuple*'
53-
exclude '**/Main*'
5480
}
5581

5682

83+
task integrationTest(type: Test) {
84+
testClassesDir = sourceSets.integrationTest.output.classesDir
85+
classpath = sourceSets.integrationTest.runtimeClasspath
86+
useTestNG()
87+
}
88+
89+
task integrationTestCoverageReport(type:JacocoReport) {
90+
dependsOn integrationTest
91+
executionData integrationTest
92+
sourceSets sourceSets.main
93+
}
94+
95+
test {
96+
// enable TestNG support (default is JUnit)
97+
useTestNG()
98+
99+
// show standard out and standard error of the test JVM(s) on the console
100+
testLogging.showStandardStreams = true
101+
102+
// set JVM arguments for the test JVM(s)
103+
jvmArgs '-XX:MaxPermSize=256m'
104+
105+
// listen to events in the test execution lifecycle
106+
beforeTest { descriptor ->
107+
logger.lifecycle("Running test: " + descriptor)
108+
}
109+
110+
// listen to standard out and standard error of the test JVM(s)
111+
onOutput { descriptor, event ->
112+
logger.lifecycle("Test: " + descriptor + " produced standard out/err: " + event.message )
113+
}
114+
}
115+
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
package com.astrazeneca;
2+
3+
import com.astrazeneca.vardict.Configuration;
4+
5+
import java.io.PrintStream;
6+
import java.util.Map;
7+
8+
public class GlobalReadOnlyScope {
9+
10+
private volatile static GlobalReadOnlyScope instance;
11+
12+
public static GlobalReadOnlyScope instance() {
13+
return instance;
14+
}
15+
16+
public static synchronized void init(Configuration conf, Map<String, Integer> chrLengths, String sample, String samplem, String ampliconBasedCalling) {
17+
if (instance != null) {
18+
throw new IllegalStateException("GlobalReadOnlyScope was already initialized. Must be initialized only once.");
19+
}
20+
instance = new GlobalReadOnlyScope(conf, chrLengths, sample, samplem, ampliconBasedCalling);
21+
}
22+
23+
public final Configuration conf;
24+
public final Map<String, Integer> chrLengths;
25+
public final String sample;
26+
public final String samplem;
27+
public final String ampliconBasedCalling;
28+
public final PrintStream out;
29+
30+
public GlobalReadOnlyScope(Configuration conf, Map<String, Integer> chrLengths, String sample, String samplem, String ampliconBasedCalling) {
31+
this.conf = conf;
32+
this.chrLengths = chrLengths;
33+
this.sample = sample;
34+
this.samplem = samplem;
35+
this.ampliconBasedCalling = ampliconBasedCalling;
36+
this.out = System.out;
37+
}
38+
}

src/main/java/com/astrazeneca/vardict/ConcurrentHashSet.java renamed to src/main/java/com/astrazeneca/utils/ConcurrentHashSet.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package com.astrazeneca.vardict;
1+
package com.astrazeneca.utils;
22

33
import java.util.Collection;
44
import java.util.Iterator;
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
package com.astrazeneca.utils;
2+
3+
import java.util.concurrent.Executor;
4+
5+
public class DirectThreadExecutor implements Executor {
6+
@Override
7+
public void execute(Runnable command) {
8+
command.run();
9+
}
10+
}

src/main/java/com/astrazeneca/vardict/Tuple.java renamed to src/main/java/com/astrazeneca/utils/Tuple.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package com.astrazeneca.vardict;
1+
package com.astrazeneca.utils;
22

33

44
public final class Tuple {

src/main/java/com/astrazeneca/vardict/Utils.java renamed to src/main/java/com/astrazeneca/utils/Utils.java

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package com.astrazeneca.vardict;
1+
package com.astrazeneca.utils;
22

33
import java.util.*;
44

@@ -139,4 +139,11 @@ public static List<String> globalFind(jregex.Pattern alignedLength, String strin
139139
}
140140

141141

142+
public static boolean isEquals(Character ch1, Character ch2) {
143+
if (ch1 == null && ch2 == null)
144+
return true;
145+
if (ch1 == null || ch2 == null)
146+
return false;
147+
return ch1.equals(ch2);
148+
}
142149
}

0 commit comments

Comments
 (0)