Updates to CombineVariants for Tim. -setKey can be null. Integrationtests for -setKey foo and -setKey null.

git-svn-id: file:///humgen/gsa-scr1/gsa-engineering/svn_contents/trunk@3870 348d0f76-0448-11de-a6fe-93d51630548a
This commit is contained in:
depristo 2010-07-23 22:35:52 +00:00
parent 26bb1cd9ce
commit e21376219d
3 changed files with 14 additions and 4 deletions

View File

@ -310,7 +310,7 @@ public static VariantContext simpleMerge(Collection<VariantContext> unsortedVCs,
setValue = Utils.join("-", s);
}
attributes.put(setKey, setValue);
if ( setKey != null ) attributes.put(setKey, setValue);
}
if ( depth > 0 )

View File

@ -65,7 +65,7 @@ public class CombineVariants extends RodWalker<Integer, Integer> {
@Argument(fullName="printComplexMerges", shortName="printComplexMerges", doc="Print out interesting sites requiring complex compatibility merging", required=false)
public boolean printComplexMerges = false;
@Argument(fullName="setKey", shortName="setKey", doc="Key, by default set, in the INFO key=value tag emitted describing which set the combined VCF record came from.", required=false)
@Argument(fullName="setKey", shortName="setKey", doc="Key, by default set, in the INFO key=value tag emitted describing which set the combined VCF record came from. Set to null if you don't want the set field emitted.", required=false)
public String SET_KEY = "set";
private VCFWriter vcfWriter = null;
@ -84,9 +84,13 @@ public class CombineVariants extends RodWalker<Integer, Integer> {
String[] annotationClassesToUse = { "Standard" };
engine = new VariantAnnotatorEngine(getToolkit(), annotationClassesToUse, annotationsToUse);
if ( SET_KEY.toLowerCase().equals("null") )
SET_KEY = null;
Set<VCFHeaderLine> headerLines = VCFUtils.smartMergeHeaders(vcfRods.values(), logger);
headerLines.add(new VCFHeaderLine("source", "CombineVariants"));
headerLines.add(new VCFInfoHeaderLine(SET_KEY, 1, VCFHeaderLineType.String, "Source VCF for the merged record in CombineVariants"));
if ( SET_KEY != null )
headerLines.add(new VCFInfoHeaderLine(SET_KEY, 1, VCFHeaderLineType.String, "Source VCF for the merged record in CombineVariants"));
vcfWriter.writeHeader(new VCFHeader(headerLines, samples));
}

View File

@ -40,8 +40,12 @@ public class CombineVariantsIntegrationTest extends WalkerTest {
}
public void test1InOut(String file, String md5) {
test1InOut(file, md5, "");
}
public void test1InOut(String file, String md5, String args) {
WalkerTestSpec spec = new WalkerTestSpec(
baseTestString(" -priority v1 -B v1,VCF," + validationDataLocation + file),
baseTestString(" -priority v1 -B v1,VCF," + validationDataLocation + file + args),
1,
Arrays.asList(md5));
executeTest("testInOut1--" + file, spec);
@ -57,6 +61,8 @@ public class CombineVariantsIntegrationTest extends WalkerTest {
@Test public void test1SNP() { test1InOut("pilot2.snps.vcf4.genotypes.vcf", "bbeb813ff559b630570725419e4e1adc"); }
@Test public void test2SNP() { test1InOut("pilot2.snps.vcf4.genotypes.vcf", "5039478bd5bb05b4c4e8309cdd887e5f", " -setKey foo"); }
@Test public void test3SNP() { test1InOut("pilot2.snps.vcf4.genotypes.vcf", "8502338872d241857379fd25878a7700", " -setKey null"); }
@Test public void testOfficialCEUPilotCalls() { test1InOut("CEU.trio.2010_03.genotypes.vcf.gz", "38b7e64b91c726867a604cf95b9cb10a"); } // official project VCF files in tabix format
@Test public void test1Indel1() { test1InOut("CEU.dindel.vcf4.trio.2010_06.indel.genotypes.vcf", "4c667935099544a1863e70ae88ddd685"); }