Skip to content

Commit 514215a

Browse files
authored
Merge pull request #88 from nh13/nh_add_ns_to_total_depth
Add an option to include Ns in the total depth
2 parents d1b0ca3 + 8190ad3 commit 514215a

File tree

10 files changed

+71
-6
lines changed

10 files changed

+71
-6
lines changed

Readme.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,8 @@ To run all integration tests, the command is:
9797
./gradlew test --tests com.astrazeneca.vardict.integrationtests.IntegrationTest
9898
```
9999

100+
The results of the tests can be viewed in the `build/reports/tests/index.html` file.
101+
100102
##### User extension of testcases
101103

102104
Each file in `testdata/intergationtestcases` directory represents a test case with input data and expected output
@@ -196,6 +198,8 @@ The VarDictJava program follows the workflow:
196198
Indicate to remove duplicated reads. Only one pair with identical start positions will be kept
197199
- `-3`
198200
Indicate to move indels to 3-prime if alternative alignment can be achieved.
201+
- `-K`
202+
Include Ns in the total depth calculation.
199203
- `-F bit`
200204
The hexical to filter reads. Default: `0x500` (filter 2nd alignments and duplicates). Use `-F 0` to turn it off.
201205
- `-z 0/1`

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

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -120,11 +120,11 @@ public class Configuration {
120120
*/
121121
double qratio = 1.5; //-o
122122
/**
123-
* The minimun mean mapping quality to be considered
123+
* The minimum mean mapping quality to be considered
124124
*/
125125
double mapq = 0; // -O default 0
126126
/**
127-
* Do pileup regarless the frequency
127+
* Do pileup regardless the frequency
128128
*/
129129
boolean doPileup = false; // -p
130130
/**
@@ -137,7 +137,11 @@ public class Configuration {
137137
boolean outputSplicing = false; // -i Output splicing read counts
138138

139139
ValidationStringency validationStringency = ValidationStringency.LENIENT;
140-
140+
141+
/**
142+
* Include Ns in the total depth calculation.
143+
*/
144+
boolean includeNInTotalDepth = false; // -K
141145

142146

143147
/**
@@ -194,4 +198,4 @@ public String getBamRaw() {
194198

195199
}
196200

197-
}
201+
}

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

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,10 @@ private void run(CommandLine cmd) throws ParseException, IOException {
128128
if (cmd.hasOption("VS")) {
129129
conf.validationStringency = ValidationStringency.valueOf(cmd.getParsedOptionValue("VS").toString().toUpperCase());
130130
}
131+
132+
if (cmd.hasOption("K")) {
133+
conf.includeNInTotalDepth = true;
134+
}
131135

132136
conf.threads = Math.max(readThreadsCount(cmd), 1);
133137

@@ -176,7 +180,7 @@ private static Options buildOptions() {
176180
// options.addOption("M", false, "Similar to -D, but will append individual quality and position data instead of mean");
177181
options.addOption("t", false, "Indicate to remove duplicated reads. Only one pair with same start positions will be kept");
178182
options.addOption("3", false, "Indicate to move indels to 3-prime if alternative alignment can be achieved.");
179-
183+
options.addOption("K", false, "Include Ns in the total depth calculation");
180184

181185
options.addOption(OptionBuilder.withArgName("bit")
182186
.hasArg(true)

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

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1380,6 +1380,7 @@ public void close() throws IOException {
13801380
* @throws IOException
13811381
*/
13821382
static Tuple4<Map<Integer, Map<String, Variation>>, Map<Integer, Map<String, Variation>>, Map<Integer, Integer>, Integer> parseSAM(Region region, String bam,
1383+
13831384
Map<String, Integer> chrs, String sample, Set<String> splice, String ampliconBasedCalling, int rlen, Map<Integer, Character> ref, Configuration conf) throws IOException {
13841385

13851386
String[] bams = bam.split(":");
@@ -2228,6 +2229,9 @@ && isHasAndEquals(querySequence.charAt(n - 1), ref, start - 1)) {
22282229
boolean startWithDelition = false;
22292230
//skip if base is unknown
22302231
if (ch1 == 'N') {
2232+
if (conf.includeNInTotalDepth) {
2233+
incCnt(cov, start, 1);
2234+
}
22312235
start++;
22322236
n++;
22332237
p++;
Binary file not shown.
Binary file not shown.

testdata/fastas/hs38DH.fa.csv

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
chr1,390320,392323,GACTAGACGGTTGGCTAATACTTCAGAGCTTGCAGAGCATCTTTATACACTTTTAATCCTCCTAACAACCGTGAGAGATGGAGCTTACTATTATCATCCGTGTTTGCAAATGAGGCCCTGAGAAGTTGAGTGATTTCTGTAAGGTCTCAGAGCCAATAGACACTGGTAATGAAATAAAATGCAAGGCCCCTTATCTTTGGAGCCCAGTGTTCCTTCCACATAGGTGGTTCTCCACCCAGGCTGCCCAGGAGAATGTGGAATCTCCAGCAGTTCTGACTTAACTGGCCTGGTGTGGATGTCTGTGATGGGTGAACATTCCCAGACCCTTTTAAGAACGTGATAGAAGTGGTAGACCCACTTCCCAGAAAAAGGGACGCACAACAAAATAATTGTCCTGAGTGGGTCTGACAGAATCAAGTGAACCCTTTAAATCTGGATCTAGAGGTCAGAGACTGAGAATGTCAGAGATGCAAAAGAGATTCAGTGCAAGAGAAATCCTCCTACTGGTTTTGAAGATAGATGTTGGCACCCTGTGTCAACAACCTGAGAGTGGCCTTGAGTTGCTGGGAGCACCCCAGACTGACAAACAGCAAGAAGAATATGGGGACCTCAGTCCTACAACCACAGGAACTGAATTCTACTGACAACCAGTGAGCTTGCAAAGAGGACTTGGAGCCCCAGATGAGAAGCAACCCTGGCTACCCCGATCTCAACCCTGTGAGATCCTAAACAGACAATCCAGCCATGCAACACCCAAACTTCTGACCTATAGAAACCCTGAGATAATAAATGGGCATTGCTCTAAATCACCAAGTTTGTGGTAATTTGTTACACAGCCATAGGAAGTGAATCGACCCGATGTATCTGAGCACCTGCTAGGTTATCATTAAGATTACTCTTCAAAGGTAAAAATTATTTTTCAAAATGTTTCTGCCCTACCTTCCGTGAGCATCTGGTGATGGATGGACACACACACATAAAGGTAGACTGTGTTTAGGTGGGCATGGTGGTGCATACCTGTGGTCCCAGCTACTCAGGAGGCTGAAAGAGGAGGATCACTAGGGCCCAGGAGTTCAAGGCTGCAGTGAAGCTGTGATTGAGCCATTGCACTCAAACTTGGGCAACAGAGCAAGACACCAGCTCTAAAAAAAAAAAAAACTGCTGAATGCTATAAATAAGATTGGAACTTGCTCTGCTTTTACAAGACCACTGTTAGATGACCACTGACAAGAAGACTGTGAGCTGGTCTCTGTAGGAAGCAGGGGCCTGGGCAGCTCTGGGGGCACAGGAGACAGGCCTGGGGCAGAGACACCTCAGGGCATTTTCAGAAGACAGCCAAAGCAGCCATTCCAGCTTGTCCAGGTAGATGGCAAGTCAATGGGAAATGATTCCAGGAAGGTAGGGAAAGATGGAATTCTGGAGAGCATTGGACCTCAGATTGGGAGTCTGAACGTCTTTCCATATGCATCAGGAAGCCATGGAAAATTCACAGACTGGAGTGACTTTGGCAAAGGTGGGATTTAGGAAGACTGATCAAGGCACGGGATAGACCCATGGATGAATAGCCTTCTGGTCAGTTTGTCCCTGTGGTTTTCTATGCTGAGGAGGTGGGAATGTGCTGGGTGAGTCAGCTGTGGATTTGTGTCCCTGCCTCACCTCACTCCCCACTGTCGTGGATTTGTCGGCTCATCTTTAGTGCGCTCCCTGAAGAAACACTCAGTTCACTCAGCTTGTTTCTAACCCAAAACACTCTGCAGGGCCCATCCTCTTGTCTTTGCCTGGGGATGCCAGACCATGCACTGCGGATGCCTTCCGCCTTAGCACTAGTGGGCTAAATGATGACTGCCTTGCTGTCCCAACACCACCCATCAAAGGGAAGACATCACCACTGGGGTCAGTACAGCCCAAGTGACAAACTCTATTCCCTCCTTTCTCTCCATCCCATGGACCCTTGATTTGCTAAGTGGGAAGACACTTTCTCGTGGTTCAACATCACCTAATCTG
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
Simple,hs38DH.fa,Count-Depth-With-Ns.bam,chr1,391310,391333,-K -p -r 1 -q 2 -f 0.0
2+
Count-Depth-With-Ns testbed chr1 391311 391311 0 0 0 0 0 0 0 0;0 0 0 0 0 0 0 0 0 0 0 0 0 0 chr1:391311-391333
3+
Count-Depth-With-Ns testbed chr1 391312 391312 0 0 0 0 0 0 0 0;0 0 0 0 0 0 0 0 0 0 0 0 0 0 chr1:391311-391333
4+
Count-Depth-With-Ns testbed chr1 391313 391313 0 0 0 0 0 0 0 0;0 0 0 0 0 0 0 0 0 0 0 0 0 0 chr1:391311-391333
5+
Count-Depth-With-Ns testbed chr1 391314 391314 0 0 0 0 0 0 0 0;0 0 0 0 0 0 0 0 0 0 0 0 0 0 chr1:391311-391333
6+
Count-Depth-With-Ns testbed chr1 391315 391315 0 0 0 0 0 0 0 0;0 0 0 0 0 0 0 0 0 0 0 0 0 0 chr1:391311-391333
7+
Count-Depth-With-Ns testbed chr1 391316 391316 0 0 0 0 0 0 0 0;0 0 0 0 0 0 0 0 0 0 0 0 0 0 chr1:391311-391333
8+
Count-Depth-With-Ns testbed chr1 391317 391317 0 0 0 0 0 0 0 0;0 0 0 0 0 0 0 0 0 0 0 0 0 0 chr1:391311-391333
9+
Count-Depth-With-Ns testbed chr1 391318 391318 0 0 0 0 0 0 0 0;0 0 0 0 0 0 0 0 0 0 0 0 0 0 chr1:391311-391333
10+
Count-Depth-With-Ns testbed chr1 391319 391319 0 0 0 0 0 0 0 0;0 0 0 0 0 0 0 0 0 0 0 0 0 0 chr1:391311-391333
11+
Count-Depth-With-Ns testbed chr1 391320 391320 0 0 0 0 0 0 0 0;0 0 0 0 0 0 0 0 0 0 0 0 0 0 chr1:391311-391333
12+
Count-Depth-With-Ns testbed chr1 391321 391321 G C 3 1 0 1 0 1 G/C 0.3333 0;0 1.0 0 27.0 0 0.0 2.000 0.5000 0 0 1.000 1 0.0 1 2 GGTAGACTGTGTTTAGGTGG CATGGTGGTGCATACCTGTG chr1:391311-391333 SNV
13+
Count-Depth-With-Ns testbed chr1 391322 391322 C G 3 1 0 2 0 1 C/G 0.3333 0;0 2.0 0 36.0 0 0.0 2.000 0.3333 0 0 1.000 1 0.0 1 3 GTAGACTGTGTTTAGGTGGG ATGGTGGTGCATACCTGTGG chr1:391311-391333 SNV
14+
Count-Depth-With-Ns testbed chr1 391323 391323 A A 3 0 0 3 0 0 A/A 0.0000 0;0 3.0 0 36.0 0 0.0 6.000 1.0000 0 0 0 0 0.0 3 3 0 0 chr1:391311-391333
15+
Count-Depth-With-Ns testbed chr1 391324 391324 T T 3 0 0 3 0 0 T/T 0.0000 0;0 4.0 0 36.0 0 0.0 6.000 1.0000 0 0 0 0 0.0 3 3 0 0 chr1:391311-391333
16+
Count-Depth-With-Ns testbed chr1 391325 391325 G G 3 0 0 3 0 0 G/G 0.0000 0;0 5.0 0 36.0 0 0.0 6.000 1.0000 0 0 0 0 0.0 3 3 0 0 chr1:391311-391333
17+
Count-Depth-With-Ns testbed chr1 391326 391326 G G 3 0 0 3 0 0 G/G 0.0000 0;0 6.0 0 36.0 0 0.0 6.000 1.0000 0 0 0 0 0.0 3 3 0 0 chr1:391311-391333
18+
Count-Depth-With-Ns testbed chr1 391327 391327 T T 3 0 0 3 0 0 T/T 0.0000 0;0 7.0 0 14.0 0 0.0 6.000 1.0000 0 0 0 0 0.0 3 3 0 0 chr1:391311-391333
19+
Count-Depth-With-Ns testbed chr1 391328 391328 G G 3 0 0 3 0 0 G/G 0.0000 0;0 8.0 0 36.0 0 0.0 6.000 1.0000 0 0 0 0 0.0 3 3 0 0 chr1:391311-391333
20+
Count-Depth-With-Ns testbed chr1 391329 391329 G G 3 0 0 3 0 0 G/G 0.0000 0;0 9.0 0 36.0 0 0.0 6.000 1.0000 0 0 0 0 0.0 3 3 0 0 chr1:391311-391333
21+
Count-Depth-With-Ns testbed chr1 391330 391330 T T 3 0 0 3 0 0 T/T 0.0000 0;0 10.0 0 32.0 0 0.0 6.000 1.0000 0 0 0 0 0.0 3 3 0 0 chr1:391311-391333
22+
Count-Depth-With-Ns testbed chr1 391331 391331 G G 3 0 0 3 0 0 G/G 0.0000 0;0 11.0 0 36.0 0 0.0 6.000 1.0000 0 0 0 0 0.0 3 3 0 0 chr1:391311-391333
23+
Count-Depth-With-Ns testbed chr1 391332 391332 C C 3 0 0 3 0 0 C/C 0.0000 0;0 12.0 0 36.0 0 0.0 6.000 1.0000 0 0 0 0 0.0 3 3 0 0 chr1:391311-391333
24+
Count-Depth-With-Ns testbed chr1 391333 391333 A A 3 0 0 3 0 0 A/A 0.0000 0;0 13.0 0 36.0 0 0.0 6.000 1.0000 0 0 0 0 0.0 3 3 0 0 chr1:391311-391333
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
Simple,hs38DH.fa,Count-Depth-With-Ns.bam,chr1,391310,391333,-p -r 1 -q 2 -f 0.0
2+
Count-Depth-With-Ns testbed chr1 391311 391311 0 0 0 0 0 0 0 0;0 0 0 0 0 0 0 0 0 0 0 0 0 0 chr1:391311-391333
3+
Count-Depth-With-Ns testbed chr1 391312 391312 0 0 0 0 0 0 0 0;0 0 0 0 0 0 0 0 0 0 0 0 0 0 chr1:391311-391333
4+
Count-Depth-With-Ns testbed chr1 391313 391313 0 0 0 0 0 0 0 0;0 0 0 0 0 0 0 0 0 0 0 0 0 0 chr1:391311-391333
5+
Count-Depth-With-Ns testbed chr1 391314 391314 0 0 0 0 0 0 0 0;0 0 0 0 0 0 0 0 0 0 0 0 0 0 chr1:391311-391333
6+
Count-Depth-With-Ns testbed chr1 391315 391315 0 0 0 0 0 0 0 0;0 0 0 0 0 0 0 0 0 0 0 0 0 0 chr1:391311-391333
7+
Count-Depth-With-Ns testbed chr1 391316 391316 0 0 0 0 0 0 0 0;0 0 0 0 0 0 0 0 0 0 0 0 0 0 chr1:391311-391333
8+
Count-Depth-With-Ns testbed chr1 391317 391317 0 0 0 0 0 0 0 0;0 0 0 0 0 0 0 0 0 0 0 0 0 0 chr1:391311-391333
9+
Count-Depth-With-Ns testbed chr1 391318 391318 0 0 0 0 0 0 0 0;0 0 0 0 0 0 0 0 0 0 0 0 0 0 chr1:391311-391333
10+
Count-Depth-With-Ns testbed chr1 391319 391319 0 0 0 0 0 0 0 0;0 0 0 0 0 0 0 0 0 0 0 0 0 0 chr1:391311-391333
11+
Count-Depth-With-Ns testbed chr1 391320 391320 0 0 0 0 0 0 0 0;0 0 0 0 0 0 0 0 0 0 0 0 0 0 chr1:391311-391333
12+
Count-Depth-With-Ns testbed chr1 391321 391321 G C 2 1 0 1 0 1 G/C 0.5000 0;0 1.0 0 27.0 0 0.0 2.000 0.5000 0 0 1.000 1 0.0 1 2 GGTAGACTGTGTTTAGGTGG CATGGTGGTGCATACCTGTG chr1:391311-391333 SNV
13+
Count-Depth-With-Ns testbed chr1 391322 391322 C G 3 1 0 2 0 1 C/G 0.3333 0;0 2.0 0 36.0 0 0.0 2.000 0.3333 0 0 1.000 1 0.0 1 3 GTAGACTGTGTTTAGGTGGG ATGGTGGTGCATACCTGTGG chr1:391311-391333 SNV
14+
Count-Depth-With-Ns testbed chr1 391323 391323 A A 3 0 0 3 0 0 A/A 0.0000 0;0 3.0 0 36.0 0 0.0 6.000 1.0000 0 0 0 0 0.0 3 3 0 0 chr1:391311-391333
15+
Count-Depth-With-Ns testbed chr1 391324 391324 T T 3 0 0 3 0 0 T/T 0.0000 0;0 4.0 0 36.0 0 0.0 6.000 1.0000 0 0 0 0 0.0 3 3 0 0 chr1:391311-391333
16+
Count-Depth-With-Ns testbed chr1 391325 391325 G G 3 0 0 3 0 0 G/G 0.0000 0;0 5.0 0 36.0 0 0.0 6.000 1.0000 0 0 0 0 0.0 3 3 0 0 chr1:391311-391333
17+
Count-Depth-With-Ns testbed chr1 391326 391326 G G 3 0 0 3 0 0 G/G 0.0000 0;0 6.0 0 36.0 0 0.0 6.000 1.0000 0 0 0 0 0.0 3 3 0 0 chr1:391311-391333
18+
Count-Depth-With-Ns testbed chr1 391327 391327 T T 3 0 0 3 0 0 T/T 0.0000 0;0 7.0 0 14.0 0 0.0 6.000 1.0000 0 0 0 0 0.0 3 3 0 0 chr1:391311-391333
19+
Count-Depth-With-Ns testbed chr1 391328 391328 G G 3 0 0 3 0 0 G/G 0.0000 0;0 8.0 0 36.0 0 0.0 6.000 1.0000 0 0 0 0 0.0 3 3 0 0 chr1:391311-391333
20+
Count-Depth-With-Ns testbed chr1 391329 391329 G G 3 0 0 3 0 0 G/G 0.0000 0;0 9.0 0 36.0 0 0.0 6.000 1.0000 0 0 0 0 0.0 3 3 0 0 chr1:391311-391333
21+
Count-Depth-With-Ns testbed chr1 391330 391330 T T 3 0 0 3 0 0 T/T 0.0000 0;0 10.0 0 32.0 0 0.0 6.000 1.0000 0 0 0 0 0.0 3 3 0 0 chr1:391311-391333
22+
Count-Depth-With-Ns testbed chr1 391331 391331 G G 3 0 0 3 0 0 G/G 0.0000 0;0 11.0 0 36.0 0 0.0 6.000 1.0000 0 0 0 0 0.0 3 3 0 0 chr1:391311-391333
23+
Count-Depth-With-Ns testbed chr1 391332 391332 C C 3 0 0 3 0 0 C/C 0.0000 0;0 12.0 0 36.0 0 0.0 6.000 1.0000 0 0 0 0 0.0 3 3 0 0 chr1:391311-391333
24+
Count-Depth-With-Ns testbed chr1 391333 391333 A A 3 0 0 3 0 0 A/A 0.0000 0;0 13.0 0 36.0 0 0.0 6.000 1.0000 0 0 0 0 0.0 3 3 0 0 chr1:391311-391333

0 commit comments

Comments
 (0)