initial VariantEvalWalker test. More to be added soon...

Also fixed the case where MD5 sums had leading zero's clipped off

git-svn-id: file:///humgen/gsa-scr1/gsa-engineering/svn_contents/trunk@1551 348d0f76-0448-11de-a6fe-93d51630548a
This commit is contained in:
aaron 2009-09-09 01:02:04 +00:00
parent adce3bd536
commit ea6ffd3796
3 changed files with 64 additions and 20 deletions

View File

@ -52,6 +52,9 @@ public class VariantEvalWalker extends RefWalker<Integer, Integer> {
@Argument(fullName="extensiveSubsets", shortName = "A", doc="If provided, output will be calculated over a lot of subsets, by default we only operate over all variants", required=false)
public boolean extensiveSubsets = false;
@Argument(fullName="supressDateInformation", doc="This flag indicates that we want to suppress the date information from the output, so that if can be diff'ed against previous evals.", required=false)
public boolean supressDateInformation = false;
String analysisFilenameBase = null;
final String knownSNPDBName = "dbSNP";
@ -253,8 +256,8 @@ public class VariantEvalWalker extends RefWalker<Integer, Integer> {
//stream.printf("%s Analysis set %s%n", analysisSetName, , analysisSetName);
stream.printf("%sAnalysis name %s%n", header, analysis.getName());
stream.printf("%sAnalysis params %s%n", header, Utils.join(" ", analysis.getParams()));
stream.printf("%sAnalysis class %s%n", header, analysis);
stream.printf("%sAnalysis time %s%n", header, now);
stream.printf("%sAnalysis class %s%n", header, analysis.getClass().getName());
if (!supressDateInformation) stream.printf("%sAnalysis time %s%n", header, now);
for ( String line : analysis.done()) {
stream.printf("%s%s%n", header, line);
}

View File

@ -1,22 +1,20 @@
package org.broadinstitute.sting;
import org.broadinstitute.sting.BaseTest;
import org.broadinstitute.sting.utils.Utils;
import org.broadinstitute.sting.utils.Pair;
import org.broadinstitute.sting.utils.cmdLine.ArgumentException;
import org.junit.Test;
import org.broadinstitute.sting.gatk.walkers.Walker;
import org.broadinstitute.sting.gatk.CommandLineGATK;
import org.broadinstitute.sting.gatk.CommandLineExecutable;
import java.io.*;
import java.util.Arrays;
import java.util.List;
import java.util.ArrayList;
import java.security.MessageDigest;
import java.math.BigInteger;
import junit.framework.Assert;
import org.broadinstitute.sting.gatk.CommandLineExecutable;
import org.broadinstitute.sting.gatk.CommandLineGATK;
import org.broadinstitute.sting.utils.Pair;
import org.broadinstitute.sting.utils.Utils;
import org.junit.Test;
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.math.BigInteger;
import java.security.MessageDigest;
import java.util.ArrayList;
import java.util.List;
public class WalkerTest extends BaseTest {
public String assertMatchingMD5(final String name, final File resultsFile, final String expectedMD5 ) {
@ -25,13 +23,13 @@ public class WalkerTest extends BaseTest {
byte[] thedigest = MessageDigest.getInstance("MD5").digest(bytesOfMessage);
BigInteger bigInt = new BigInteger(1, thedigest);
String filemd5sum = bigInt.toString(16);
while (filemd5sum.length() < 32) filemd5sum = "0" + filemd5sum; // pad to length 32
if ( parameterize() || expectedMD5.equals("") ) {
logger.warn(String.format("PARAMETERIZATION[%s]: file %s has md5 = %s, stated expectation is %s, equal? = %b",
name, resultsFile, filemd5sum, expectedMD5, filemd5sum.equals(expectedMD5)));
} else {
logger.warn(String.format("Checking MD5 for %s [calculated=%s, expected=%s]", resultsFile, filemd5sum, expectedMD5));
Assert.assertEquals(name + "Mismatching MD5s", expectedMD5, filemd5sum);
Assert.assertEquals(name + " Mismatching MD5s", expectedMD5, filemd5sum);
logger.warn(String.format(" => %s PASSED", name));
}

View File

@ -0,0 +1,43 @@
package org.broadinstitute.sting.playground.gatk.walkers.varianteval;
import org.broadinstitute.sting.WalkerTest;
import org.junit.Test;
import java.io.File;
import java.util.ArrayList;
import java.util.List;
/**
* @author aaron
* <p/>
* Class VariantEvalWalkerTest
* <p/>
* test out the variant eval walker under a bunch of different runtime conditions.
*/
public class VariantEvalWalkerTest extends WalkerTest {
@Test
public void emptyTest() {
}
@Test
public void testEvalVariantROD() {
List <String> md5 = new ArrayList<String>();
md5.add("094c0adb8e4ae4de424f26482fd43152");
WalkerTest.WalkerTestSpec spec = new WalkerTest.WalkerTestSpec(
"-R /broad/1KG/reference/human_b36_both.fasta" +
" --rodBind eval,Variants,/humgen/gsa-scr1/GATK_Data/Validation_Data/NA12878.1kg.p2.chr1_10mb_11_mb.SLX.lod5.variants.geli.calls" +
" -T VariantEval" +
" --DBSNP /humgen/gsa-scr1/GATK_Data/dbsnp_129_b36.rod" +
" -L 1:10,000,000-11,000,000" +
" --outerr %s" +
" --supressDateInformation",
1, // just one output file
md5);
List<File> result = executeTest("testEvalVariantROD", spec).getFirst();
}
}