a) Cleanups/bug fixes to previous commit to CombineVariants.
b) Change md5 to reflect records that are now merged correctly. c) Change unit merge alleles test to reflect the fact that a null non-variant vc object is not valid and not supported because there's no way to codify such object in a vcf. The code correctly converts this to a non-variant single-base event with whatever the reference is at that location.
This commit is contained in:
parent
cd058dd10f
commit
203517fbb7
|
|
@ -233,7 +233,7 @@ public class CombineVariants extends RodWalker<Integer, Integer> {
|
|||
|
||||
if (minimumN > 1 && (vcs.size() - numFilteredRecords < minimumN))
|
||||
return 0;
|
||||
|
||||
|
||||
List<VariantContext> mergedVCs = new ArrayList<VariantContext>();
|
||||
Map<VariantContext.Type, List<VariantContext>> VCsByType = VariantContextUtils.separateVariantContextsByType(vcs);
|
||||
// iterate over the types so that it's deterministic
|
||||
|
|
@ -248,7 +248,6 @@ public class CombineVariants extends RodWalker<Integer, Integer> {
|
|||
// only operate at the start of events
|
||||
if ( mergedVC == null )
|
||||
continue;
|
||||
System.out.println(mergedVC.toString());
|
||||
|
||||
HashMap<String, Object> attributes = new HashMap<String, Object>(mergedVC.getAttributes());
|
||||
// re-compute chromosome counts
|
||||
|
|
|
|||
|
|
@ -1495,7 +1495,7 @@ public class VariantContext implements Feature { // to enable tribble intergrati
|
|||
|
||||
// Do not change the filter state if filters were not applied to this context
|
||||
Set<String> inputVCFilters = inputVC.filtersWereAppliedToContext ? inputVC.getFilters() : null;
|
||||
return new VariantContext(inputVC.getSource(), inputVC.getChr(), inputVC.getStart(), inputVC.getEnd(), alleles, genotypes, inputVC.getNegLog10PError(), inputVCFilters, inputVC.getAttributes());
|
||||
return new VariantContext(inputVC.getSource(), inputVC.getChr(), inputVC.getStart(), inputVC.getEnd(), alleles, genotypes, inputVC.getNegLog10PError(), inputVCFilters, inputVC.getAttributes(),refByte);
|
||||
}
|
||||
else
|
||||
return inputVC;
|
||||
|
|
|
|||
|
|
@ -789,6 +789,7 @@ public class VariantContextUtils {
|
|||
// vc has a type different than otherVC and its alleles are a subset of VC: add vc to otherVC's type list and don't add to its own
|
||||
mappedVCs.get(type).add(vc);
|
||||
addtoOwnList = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -110,7 +110,7 @@ public class CombineVariantsIntegrationTest extends WalkerTest {
|
|||
" -priority NA19240_BGI,NA19240_ILLUMINA,NA19240_WUGSC,denovoInfo" +
|
||||
" -genotypeMergeOptions UNIQUIFY -L 1"),
|
||||
1,
|
||||
Arrays.asList("212d9d3df10bb29e2c7fb226da422dc0"));
|
||||
Arrays.asList("b14f8cbb5d03a2e613b12da4da9efd9a"));
|
||||
executeTest("threeWayWithRefs", spec);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -38,7 +38,7 @@ import java.io.FileNotFoundException;
|
|||
import java.util.*;
|
||||
|
||||
public class VariantContextUtilsUnitTest extends BaseTest {
|
||||
Allele Aref, T, C, delRef, ATC, ATCATC;
|
||||
Allele Aref, T, C, delRef, Cref, ATC, ATCATC;
|
||||
private GenomeLocParser genomeLocParser;
|
||||
|
||||
@BeforeSuite
|
||||
|
|
@ -54,6 +54,7 @@ public class VariantContextUtilsUnitTest extends BaseTest {
|
|||
|
||||
// alleles
|
||||
Aref = Allele.create("A", true);
|
||||
Cref = Allele.create("C", true);
|
||||
delRef = Allele.create("-", true);
|
||||
T = Allele.create("T");
|
||||
C = Allele.create("C");
|
||||
|
|
@ -94,7 +95,7 @@ public class VariantContextUtilsUnitTest extends BaseTest {
|
|||
int stop = start; // alleles.contains(ATC) ? start + 3 : start;
|
||||
return new VariantContext(source, "1", start, stop, alleles,
|
||||
genotypes == null ? null : VariantContext.genotypeCollectionToMap(new TreeMap<String, Genotype>(), genotypes),
|
||||
1.0, filters, null, (byte)'C');
|
||||
1.0, filters, null, Cref.getBases()[0]);
|
||||
}
|
||||
|
||||
// --------------------------------------------------------------------------------
|
||||
|
|
@ -148,8 +149,10 @@ public class VariantContextUtilsUnitTest extends BaseTest {
|
|||
Arrays.asList(Aref, C),
|
||||
Arrays.asList(Aref, C, T)); // sorted by allele
|
||||
|
||||
// The following is actually a pathological case - there's no way on a vcf to represent a null allele that's non-variant.
|
||||
// The code converts this (correctly) to a single-base non-variant vc with whatever base was there as a reference.
|
||||
new MergeAllelesTest(Arrays.asList(delRef),
|
||||
Arrays.asList(delRef)); // todo -- FIXME me GdA
|
||||
Arrays.asList(Cref));
|
||||
|
||||
new MergeAllelesTest(Arrays.asList(delRef),
|
||||
Arrays.asList(delRef, ATC),
|
||||
|
|
@ -186,6 +189,14 @@ public class VariantContextUtilsUnitTest extends BaseTest {
|
|||
inputs, priority,
|
||||
VariantContextUtils.FilteredRecordMergeType.KEEP_IF_ANY_UNFILTERED,
|
||||
VariantContextUtils.GenotypeMergeType.PRIORITIZE, false, false, "set", false, false);
|
||||
System.out.println("expected:");
|
||||
System.out.println(cfg.expected.toString());
|
||||
System.out.println("inputs");
|
||||
for (VariantContext vc:inputs)
|
||||
System.out.println(vc.toString());
|
||||
System.out.println("merged:");
|
||||
System.out.println(merged.toString());
|
||||
|
||||
Assert.assertEquals(merged.getAlleles(), cfg.expected);
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue