Merge branch 'master' of ssh://ni.broadinstitute.org/humgen/gsa-scr1/chartl/dev/unstable
This commit is contained in:
commit
a6a8fc0521
|
|
@ -1,5 +1,6 @@
|
|||
package org.broadinstitute.sting.gatk.walkers.varianteval;
|
||||
|
||||
import com.google.java.contract.Requires;
|
||||
import net.sf.picard.reference.IndexedFastaSequenceFile;
|
||||
import net.sf.picard.util.IntervalTree;
|
||||
import net.sf.samtools.SAMSequenceRecord;
|
||||
|
|
@ -19,11 +20,8 @@ import org.broadinstitute.sting.gatk.walkers.TreeReducible;
|
|||
import org.broadinstitute.sting.gatk.walkers.Window;
|
||||
import org.broadinstitute.sting.gatk.walkers.varianteval.evaluators.VariantEvaluator;
|
||||
import org.broadinstitute.sting.gatk.walkers.varianteval.stratifications.IntervalStratification;
|
||||
import org.broadinstitute.sting.gatk.walkers.varianteval.stratifications.JexlExpression;
|
||||
import org.broadinstitute.sting.gatk.walkers.varianteval.stratifications.VariantStratifier;
|
||||
import org.broadinstitute.sting.gatk.walkers.varianteval.util.*;
|
||||
import org.broadinstitute.sting.gatk.walkers.variantrecalibration.Tranche;
|
||||
import org.broadinstitute.sting.gatk.walkers.variantrecalibration.VariantRecalibrator;
|
||||
import org.broadinstitute.sting.utils.GenomeLoc;
|
||||
import org.broadinstitute.sting.utils.GenomeLocParser;
|
||||
import org.broadinstitute.sting.utils.SampleUtils;
|
||||
|
|
@ -32,7 +30,6 @@ import org.broadinstitute.sting.utils.codecs.vcf.VCFUtils;
|
|||
import org.broadinstitute.sting.utils.exceptions.ReviewedStingException;
|
||||
import org.broadinstitute.sting.utils.exceptions.StingException;
|
||||
import org.broadinstitute.sting.utils.exceptions.UserException;
|
||||
import org.broadinstitute.sting.utils.interval.IntervalUtils;
|
||||
import org.broadinstitute.sting.utils.variantcontext.Allele;
|
||||
import org.broadinstitute.sting.utils.variantcontext.VariantContext;
|
||||
import org.broadinstitute.sting.utils.variantcontext.VariantContextBuilder;
|
||||
|
|
@ -389,9 +386,9 @@ public class VariantEvalWalker extends RodWalker<Integer, Integer> implements Tr
|
|||
nec.apply(tracker, ref, context, comp, eval);
|
||||
}
|
||||
|
||||
// eval=null against all comps of different type
|
||||
// eval=null against all comps of different type that aren't bound to another eval
|
||||
for ( VariantContext otherComp : compSet ) {
|
||||
if ( otherComp != comp ) {
|
||||
if ( otherComp != comp && ! compHasMatchingEval(otherComp, evalSetBySample) ) {
|
||||
synchronized (nec) {
|
||||
nec.apply(tracker, ref, context, otherComp, null);
|
||||
}
|
||||
|
|
@ -409,6 +406,35 @@ public class VariantEvalWalker extends RodWalker<Integer, Integer> implements Tr
|
|||
return null;
|
||||
}
|
||||
|
||||
@Requires({"comp != null", "evals != null"})
|
||||
private boolean compHasMatchingEval(final VariantContext comp, final Collection<VariantContext> evals) {
|
||||
// find all of the matching comps
|
||||
for ( final VariantContext eval : evals ) {
|
||||
if ( eval != null && doEvalAndCompMatch(comp, eval, requireStrictAlleleMatch) != EvalCompMatchType.NO_MATCH )
|
||||
return true;
|
||||
}
|
||||
|
||||
// nothing matched
|
||||
return false;
|
||||
}
|
||||
|
||||
private enum EvalCompMatchType { NO_MATCH, STRICT, LENIENT }
|
||||
|
||||
@Requires({"eval != null", "comp != null"})
|
||||
private EvalCompMatchType doEvalAndCompMatch(final VariantContext eval, final VariantContext comp, boolean requireStrictAlleleMatch) {
|
||||
// find all of the matching comps
|
||||
if ( comp.getType() != eval.getType() )
|
||||
return EvalCompMatchType.NO_MATCH;
|
||||
|
||||
// find the comp which matches both the reference allele and alternate allele from eval
|
||||
final Allele altEval = eval.getAlternateAlleles().size() == 0 ? null : eval.getAlternateAllele(0);
|
||||
final Allele altComp = comp.getAlternateAlleles().size() == 0 ? null : comp.getAlternateAllele(0);
|
||||
if ((altEval == null && altComp == null) || (altEval != null && altEval.equals(altComp) && eval.getReference().equals(comp.getReference())))
|
||||
return EvalCompMatchType.STRICT;
|
||||
else
|
||||
return requireStrictAlleleMatch ? EvalCompMatchType.NO_MATCH : EvalCompMatchType.LENIENT;
|
||||
}
|
||||
|
||||
private VariantContext findMatchingComp(final VariantContext eval, final Collection<VariantContext> comps) {
|
||||
// if no comps, return null
|
||||
if ( comps == null || comps.isEmpty() )
|
||||
|
|
@ -419,26 +445,21 @@ public class VariantEvalWalker extends RodWalker<Integer, Integer> implements Tr
|
|||
return comps.iterator().next();
|
||||
|
||||
// find all of the matching comps
|
||||
List<VariantContext> matchingComps = new ArrayList<VariantContext>(comps.size());
|
||||
for ( VariantContext comp : comps ) {
|
||||
if ( comp.getType() == eval.getType() )
|
||||
matchingComps.add(comp);
|
||||
VariantContext lenientMatch = null;
|
||||
for ( final VariantContext comp : comps ) {
|
||||
switch ( doEvalAndCompMatch(comp, eval, requireStrictAlleleMatch) ) {
|
||||
case STRICT:
|
||||
return comp;
|
||||
case LENIENT:
|
||||
if ( lenientMatch == null ) lenientMatch = comp;
|
||||
break;
|
||||
case NO_MATCH:
|
||||
;
|
||||
}
|
||||
}
|
||||
|
||||
// if no matching comp, return null
|
||||
if ( matchingComps.size() == 0 )
|
||||
return null;
|
||||
|
||||
// find the comp which matches both the reference allele and alternate allele from eval
|
||||
Allele altEval = eval.getAlternateAlleles().size() == 0 ? null : eval.getAlternateAllele(0);
|
||||
for ( VariantContext comp : matchingComps ) {
|
||||
Allele altComp = comp.getAlternateAlleles().size() == 0 ? null : comp.getAlternateAllele(0);
|
||||
if ( (altEval == null && altComp == null) || (altEval != null && altEval.equals(altComp) && eval.getReference().equals(comp.getReference())) )
|
||||
return comp;
|
||||
}
|
||||
|
||||
// if none match, just return the first one unless we require a strict match
|
||||
return (requireStrictAlleleMatch ? null : matchingComps.get(0));
|
||||
// nothing matched, just return lenientMatch, which might be null
|
||||
return lenientMatch;
|
||||
}
|
||||
|
||||
public Integer treeReduce(Integer lhs, Integer rhs) { return null; }
|
||||
|
|
|
|||
|
|
@ -417,8 +417,6 @@ public class VariantEvalUtils {
|
|||
}
|
||||
} else {
|
||||
stateKeys.add(stateKey);
|
||||
|
||||
return stateKeys;
|
||||
}
|
||||
|
||||
return stateKeys;
|
||||
|
|
|
|||
|
|
@ -30,7 +30,7 @@ public class VariantEvalIntegrationTest extends WalkerTest {
|
|||
"-o %s"
|
||||
),
|
||||
1,
|
||||
Arrays.asList("f909fd8374f663e983b9b3fda4cf5cf1")
|
||||
Arrays.asList("c8d8bffa5c572df9dec7364f71a1b943")
|
||||
);
|
||||
executeTest("testFunctionClassWithSnpeff", spec);
|
||||
}
|
||||
|
|
@ -277,7 +277,7 @@ public class VariantEvalIntegrationTest extends WalkerTest {
|
|||
" --eval " + validationDataLocation + "yri.trio.gatk_glftrio.intersection.annotated.filtered.chr1.vcf" +
|
||||
" --comp:comp_genotypes,VCF3 " + validationDataLocation + "yri.trio.gatk.ug.head.vcf";
|
||||
WalkerTestSpec spec = new WalkerTestSpec(withSelect(tests, "DP < 50", "DP50") + " " + extraArgs + " -ST CpG -o %s",
|
||||
1, Arrays.asList("4f60acc8a4b21c4b4ccb51ad9071449c"));
|
||||
1, Arrays.asList("c49e239292704447a36e01ee9a71e729"));
|
||||
executeTestParallel("testSelect1", spec);
|
||||
}
|
||||
|
||||
|
|
@ -335,7 +335,7 @@ public class VariantEvalIntegrationTest extends WalkerTest {
|
|||
" --dbsnp " + b37dbSNP132 +
|
||||
" --eval:evalBI " + validationDataLocation + "VariantEval/ALL.20100201.chr20.bi.sites.vcf" +
|
||||
" -noST -ST Novelty -o %s";
|
||||
WalkerTestSpec spec = new WalkerTestSpec(extraArgs,1,Arrays.asList("190e1a171132832bf92fbca56a9c40bb"));
|
||||
WalkerTestSpec spec = new WalkerTestSpec(extraArgs,1,Arrays.asList("e42cda858649a35eaa9d14ea2d70a956"));
|
||||
executeTestParallel("testEvalTrackWithoutGenotypes",spec);
|
||||
}
|
||||
|
||||
|
|
@ -347,7 +347,7 @@ public class VariantEvalIntegrationTest extends WalkerTest {
|
|||
" --eval:evalBI " + validationDataLocation + "VariantEval/ALL.20100201.chr20.bi.sites.vcf" +
|
||||
" --eval:evalBC " + validationDataLocation + "VariantEval/ALL.20100201.chr20.bc.sites.vcf" +
|
||||
" -noST -ST Novelty -o %s";
|
||||
WalkerTestSpec spec = new WalkerTestSpec(extraArgs,1,Arrays.asList("08586d443fdcf3b7f63b8f9e3a943c62"));
|
||||
WalkerTestSpec spec = new WalkerTestSpec(extraArgs,1,Arrays.asList("9561cb4c7aa36dcf30ba253385299859"));
|
||||
executeTestParallel("testMultipleEvalTracksWithoutGenotypes",spec);
|
||||
}
|
||||
|
||||
|
|
@ -463,7 +463,7 @@ public class VariantEvalIntegrationTest extends WalkerTest {
|
|||
"-o %s"
|
||||
),
|
||||
1,
|
||||
Arrays.asList("a6f8b32fa732632da13dfe3ddcc73cef")
|
||||
Arrays.asList("397b0e77459b9b69d2e0dd1dac320c3c")
|
||||
);
|
||||
executeTest("testModernVCFWithLargeIndels", spec);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -27,6 +27,7 @@ package org.broadinstitute.sting.utils.crypt;
|
|||
import org.broadinstitute.sting.BaseTest;
|
||||
import org.broadinstitute.sting.utils.exceptions.ReviewedStingException;
|
||||
import org.broadinstitute.sting.utils.exceptions.UserException;
|
||||
import org.testng.SkipException;
|
||||
import org.testng.annotations.DataProvider;
|
||||
import org.testng.annotations.Test;
|
||||
import org.testng.Assert;
|
||||
|
|
@ -64,11 +65,21 @@ public class CryptUtilsUnitTest extends BaseTest {
|
|||
|
||||
@Test
|
||||
public void testGATKMasterKeyPairMutualDecryption() {
|
||||
if ( gatkPrivateKeyExistsButReadPermissionDenied() ) {
|
||||
throw new SkipException(String.format("Skipping test %s because we do not have permission to read the GATK private key",
|
||||
"testGATKMasterKeyPairMutualDecryption"));
|
||||
}
|
||||
|
||||
Assert.assertTrue(CryptUtils.keysDecryptEachOther(CryptUtils.loadGATKMasterPrivateKey(), CryptUtils.loadGATKMasterPublicKey()));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testGATKMasterPrivateKeyWithDistributedPublicKeyMutualDecryption() {
|
||||
if ( gatkPrivateKeyExistsButReadPermissionDenied() ) {
|
||||
throw new SkipException(String.format("Skipping test %s because we do not have permission to read the GATK private key",
|
||||
"testGATKMasterPrivateKeyWithDistributedPublicKeyMutualDecryption"));
|
||||
}
|
||||
|
||||
Assert.assertTrue(CryptUtils.keysDecryptEachOther(CryptUtils.loadGATKMasterPrivateKey(), CryptUtils.loadGATKDistributedPublicKey()));
|
||||
}
|
||||
|
||||
|
|
@ -156,6 +167,11 @@ public class CryptUtilsUnitTest extends BaseTest {
|
|||
|
||||
@Test
|
||||
public void testLoadGATKMasterPrivateKey() {
|
||||
if ( gatkPrivateKeyExistsButReadPermissionDenied() ) {
|
||||
throw new SkipException(String.format("Skipping test %s because we do not have permission to read the GATK private key",
|
||||
"testLoadGATKMasterPrivateKey"));
|
||||
}
|
||||
|
||||
PrivateKey gatkMasterPrivateKey = CryptUtils.loadGATKMasterPrivateKey();
|
||||
}
|
||||
|
||||
|
|
@ -174,4 +190,9 @@ public class CryptUtilsUnitTest extends BaseTest {
|
|||
Assert.assertEquals(originalKey.getAlgorithm(), keyFromDisk.getAlgorithm());
|
||||
Assert.assertEquals(originalKey.getFormat(), keyFromDisk.getFormat());
|
||||
}
|
||||
|
||||
private boolean gatkPrivateKeyExistsButReadPermissionDenied() {
|
||||
File gatkPrivateKey = new File(CryptUtils.GATK_MASTER_PRIVATE_KEY_FILE);
|
||||
return gatkPrivateKey.exists() && ! gatkPrivateKey.canRead();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -27,6 +27,7 @@ package org.broadinstitute.sting.utils.crypt;
|
|||
import org.broadinstitute.sting.BaseTest;
|
||||
import org.broadinstitute.sting.utils.exceptions.ReviewedStingException;
|
||||
import org.broadinstitute.sting.utils.exceptions.UserException;
|
||||
import org.testng.SkipException;
|
||||
import org.testng.annotations.Test;
|
||||
import org.testng.Assert;
|
||||
|
||||
|
|
@ -39,6 +40,11 @@ public class GATKKeyUnitTest extends BaseTest {
|
|||
|
||||
@Test
|
||||
public void testCreateGATKKeyUsingMasterKeyPair() {
|
||||
if ( gatkPrivateKeyExistsButReadPermissionDenied() ) {
|
||||
throw new SkipException(String.format("Skipping test %s because we do not have permission to read the GATK private key",
|
||||
"testCreateGATKKeyUsingMasterKeyPair"));
|
||||
}
|
||||
|
||||
PrivateKey masterPrivateKey = CryptUtils.loadGATKMasterPrivateKey();
|
||||
PublicKey masterPublicKey = CryptUtils.loadGATKMasterPublicKey();
|
||||
|
||||
|
|
@ -49,6 +55,11 @@ public class GATKKeyUnitTest extends BaseTest {
|
|||
|
||||
@Test
|
||||
public void testCreateGATKKeyUsingMasterPrivateKeyAndDistributedPublicKey() {
|
||||
if ( gatkPrivateKeyExistsButReadPermissionDenied() ) {
|
||||
throw new SkipException(String.format("Skipping test %s because we do not have permission to read the GATK private key",
|
||||
"testCreateGATKKeyUsingMasterPrivateKeyAndDistributedPublicKey"));
|
||||
}
|
||||
|
||||
PrivateKey masterPrivateKey = CryptUtils.loadGATKMasterPrivateKey();
|
||||
PublicKey distributedPublicKey = CryptUtils.loadGATKDistributedPublicKey();
|
||||
|
||||
|
|
@ -82,8 +93,7 @@ public class GATKKeyUnitTest extends BaseTest {
|
|||
KeyPair keyPair = CryptUtils.generateKeyPair();
|
||||
|
||||
// Email addresses cannot contain the NUL byte, since it's used as a sectional delimiter in the key file:
|
||||
GATKKey key = new GATKKey(CryptUtils.loadGATKMasterPrivateKey(), CryptUtils.loadGATKDistributedPublicKey(),
|
||||
emailAddressWithNulByte);
|
||||
GATKKey key = new GATKKey(keyPair.getPrivate(), keyPair.getPublic(), emailAddressWithNulByte);
|
||||
}
|
||||
|
||||
@Test
|
||||
|
|
@ -110,4 +120,9 @@ public class GATKKeyUnitTest extends BaseTest {
|
|||
|
||||
GATKKey key = new GATKKey(CryptUtils.loadGATKDistributedPublicKey(), nonExistentFile);
|
||||
}
|
||||
|
||||
private boolean gatkPrivateKeyExistsButReadPermissionDenied() {
|
||||
File gatkPrivateKey = new File(CryptUtils.GATK_MASTER_PRIVATE_KEY_FILE);
|
||||
return gatkPrivateKey.exists() && ! gatkPrivateKey.canRead();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue