Skip to content

Commit

Permalink
Completes #5260 on GitHub. (#5464)
Browse files Browse the repository at this point in the history
* Changed SelectVariants so that it van handle multiple rsIDs separated by ';' in a VCF file.

* The tests testKeepSelectionIDLiteral and testKeepSelectionIDFromFile broke due to the change in the test file complexExample1.vcf. I modified the file testSelectVariants_KeepSelectionID.vcf appropriately so that the tests pass as they should.

* Changes due to review by David Benjamin and Phil Shapiro.

* Made the code in VariantIDsVariantFilter's test function more concise.
  • Loading branch information
MartonKN authored Nov 30, 2018
1 parent d95ceec commit fb01bf3
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@

import java.util.Set;
import java.util.LinkedHashSet;
import java.util.*;
import java.util.stream.*;

/**
* Keep only variants with any of these IDs.
Expand All @@ -22,6 +24,6 @@ public VariantIDsVariantFilter(Set<String> keepIDs) {

@Override
public boolean test(final VariantContext vc) {
return includeIDs.contains(vc.getID());
return Arrays.stream(vc.getID().split(";")).anyMatch(includeIDs::contains);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -29,5 +29,6 @@
1 10044557 . C T 62.22 . AF=0.50;AlleleBalance=0.68;DoC=31;HomopolymerRun=16;MAPQ0=0;NS=1;RMSMAPQ=85.34;SB=-0.00;SpanningDeletions=0 GT:DP:GQ ./. ./. 0/1:31:15
1 10045603 . AAAA A 40.26 PASS AF=0.50 GT:DP:GQ 0/1:15:8 0/0:15:8 1/1:15:8
1 10045604 . A ACAT 41.26 PASS AF=0.50 GT:DP:GQ 1/1:14:7 0/0:15:8 1/0:15:8
1 10046982 testid0;testid1 C T 32.01 PASS AF=0.40;AlleleBalance=0.37;DoC=21;HomopolymerRun=0;MAPQ0=8;NS=1;RMSMAPQ=12.31;SB=-4.2;SpanningDeletions=0 GT:DP:GQ 1/0:3:49 ./. ./.
1 10048142 . A G 126.81 foo AF=1.00;DoC=36;HomopolymerRun=4;MAPQ0=0;NS=1;RMSMAPQ=82.11;SB=-85.45;SpanningDeletions=0 GT:DP:GQ 0/1:15:8 0/0:15:8 1/1:15:8
1 10048580 . T A 72.22 bar;baz AF=0.50;AlleleBalance=0.69;DoC=33;HomopolymerRun=6;MAPQ0=0;NS=1;RMSMAPQ=84.45;SB=-27.41;SpanningDeletions=0 GT:DP:GQ 0/1:15:8 0/0:15:8 1/1:15:8
Original file line number Diff line number Diff line change
Expand Up @@ -23,3 +23,4 @@
##source=ArbitrarySource
#CHROM POS ID REF ALT QUAL FILTER INFO FORMAT NA00001 NA00002 NA00003
1 10001292 testid1 G A 12.22 PASS AF=0.50;AlleleBalance=0.57;DoC=23;HomopolymerRun=0;MAPQ0=8;NS=1;RMSMAPQ=46.31;SB=-24.92;SpanningDeletions=0 GT:DP:GQ 1/0:23:19 ./. ./.
1 10046982 testid0;testid1 C T 32.01 PASS AF=0.40;AlleleBalance=0.37;DoC=21;HomopolymerRun=0;MAPQ0=8;NS=1;RMSMAPQ=12.31;SB=-4.2;SpanningDeletions=0 GT:DP:GQ 1/0:3:49 ./. ./.

0 comments on commit fb01bf3

Please sign in to comment.