GenotypeMap -> GenotypeCollection part 3
-- Test code actually builds
This commit is contained in:
parent
f0234ab67f
commit
4ff8225d78
|
|
@ -117,7 +117,7 @@ public class TestVariantContextWalker extends RodWalker<Integer, Integer> {
|
|||
}
|
||||
|
||||
private static VCFHeader createVCFHeader(VariantContext vc) {
|
||||
return new VCFHeader(new HashSet<VCFHeaderLine>(), vc.getGenotypes().getSampleNamesSorted());
|
||||
return new VCFHeader(new HashSet<VCFHeaderLine>(), vc.getGenotypes().getSampleNamesOrderedByName());
|
||||
}
|
||||
|
||||
public Integer reduceInit() {
|
||||
|
|
|
|||
|
|
@ -49,7 +49,7 @@ public class VariantContextBenchmark extends SimpleBenchmark {
|
|||
@Param({"READ", "READ_SUBSET"})
|
||||
Operation operation; // set automatically by framework
|
||||
|
||||
@Param({"OF_GENOTYPES", "OF_SAMPLES"})
|
||||
@Param({"OF_SAMPLES"})
|
||||
SubContextOp subContextOp; // set automatically by framework
|
||||
|
||||
private String INPUT_STRING;
|
||||
|
|
@ -60,7 +60,6 @@ public class VariantContextBenchmark extends SimpleBenchmark {
|
|||
}
|
||||
|
||||
public enum SubContextOp {
|
||||
OF_GENOTYPES,
|
||||
OF_SAMPLES
|
||||
}
|
||||
|
||||
|
|
@ -91,7 +90,7 @@ public class VariantContextBenchmark extends SimpleBenchmark {
|
|||
codec.readHeader(lineReader);
|
||||
|
||||
int counter = 0;
|
||||
List<String> samples = null;
|
||||
Set<String> samples = null;
|
||||
while (counter++ < linesToRead ) {
|
||||
String line = lineReader.readLine();
|
||||
if ( line == null )
|
||||
|
|
@ -99,7 +98,7 @@ public class VariantContextBenchmark extends SimpleBenchmark {
|
|||
|
||||
VariantContext vc = (VariantContext)codec.decode(line);
|
||||
if ( samples == null ) {
|
||||
samples = new ArrayList<String>(vc.getSampleNames()).subList(0, nSamplesToTake);
|
||||
samples = new HashSet<String>(new ArrayList<String>(vc.getSampleNames()).subList(0, nSamplesToTake));
|
||||
}
|
||||
|
||||
if ( op == Operation.READ_SUBSET)
|
||||
|
|
@ -119,13 +118,10 @@ public class VariantContextBenchmark extends SimpleBenchmark {
|
|||
CaliperMain.main(VariantContextBenchmark.class, args);
|
||||
}
|
||||
|
||||
private static final void processOneVC(VariantContext vc, List<String> samples, SubContextOp subop) {
|
||||
private static final void processOneVC(VariantContext vc, Set<String> samples, SubContextOp subop) {
|
||||
VariantContext sub;
|
||||
|
||||
switch ( subop ) {
|
||||
case OF_GENOTYPES:
|
||||
sub = vc.subContextFromGenotypes(vc.getGenotypes(samples).values(), vc.getAlleles());
|
||||
break;
|
||||
case OF_SAMPLES:
|
||||
sub = vc.subContextFromSamples(samples, vc.getAlleles());
|
||||
break;
|
||||
|
|
|
|||
|
|
@ -431,12 +431,12 @@ public class VariantContextUnitTest extends BaseTest {
|
|||
Genotype g5 = new Genotype("--", Arrays.asList(del, del), 10);
|
||||
VariantContext vc = new VariantContext("test", snpLoc,snpLocStart, snpLocStop , alleles, Arrays.asList(g1,g2,g3,g4,g5));
|
||||
|
||||
VariantContext vc12 = vc.subContextFromGenotypes(Arrays.asList(g1,g2));
|
||||
VariantContext vc1 = vc.subContextFromGenotypes(Arrays.asList(g1));
|
||||
VariantContext vc23 = vc.subContextFromGenotypes(Arrays.asList(g2, g3));
|
||||
VariantContext vc4 = vc.subContextFromGenotypes(Arrays.asList(g4));
|
||||
VariantContext vc14 = vc.subContextFromGenotypes(Arrays.asList(g1, g4));
|
||||
VariantContext vc5 = vc.subContextFromGenotypes(Arrays.asList(g5));
|
||||
VariantContext vc12 = vc.subContextFromSamples(new HashSet<String>(Arrays.asList(g1.getSampleName(),g2.getSampleName())));
|
||||
VariantContext vc1 = vc.subContextFromSamples(new HashSet<String>(Arrays.asList(g1.getSampleName())));
|
||||
VariantContext vc23 = vc.subContextFromSamples(new HashSet<String>(Arrays.asList(g2.getSampleName(), g3.getSampleName())));
|
||||
VariantContext vc4 = vc.subContextFromSamples(new HashSet<String>(Arrays.asList(g4.getSampleName())));
|
||||
VariantContext vc14 = vc.subContextFromSamples(new HashSet<String>(Arrays.asList(g1.getSampleName(), g4.getSampleName())));
|
||||
VariantContext vc5 = vc.subContextFromSamples(new HashSet<String>(Arrays.asList(g5.getSampleName())));
|
||||
|
||||
Assert.assertTrue(vc12.isPolymorphic());
|
||||
Assert.assertTrue(vc23.isPolymorphic());
|
||||
|
|
|
|||
Loading…
Reference in New Issue