Now annotations that require reads return null if there's no alignment context, so that running without reads adds annotations only for the appropriate fields.
Added an integration test for the read-less case. git-svn-id: file:///humgen/gsa-scr1/gsa-engineering/svn_contents/trunk@3525 348d0f76-0448-11de-a6fe-93d51630548a
This commit is contained in:
parent
6941c81bfa
commit
ca4eab1d23
|
|
@ -43,7 +43,9 @@ import java.util.Arrays;
|
|||
public class AlleleBalance implements InfoFieldAnnotation, StandardAnnotation {
|
||||
|
||||
public Map<String, Object> annotate(RefMetaDataTracker tracker, ReferenceContext ref, Map<String, StratifiedAlignmentContext> stratifiedContexts, VariantContext vc) {
|
||||
|
||||
if ( stratifiedContexts.size() == 0 )
|
||||
return null;
|
||||
|
||||
if ( !vc.isBiallelic() )
|
||||
return null;
|
||||
final Map<String, Genotype> genotypes = vc.getGenotypes();
|
||||
|
|
|
|||
|
|
@ -17,6 +17,9 @@ import java.util.Arrays;
|
|||
public class DepthOfCoverage implements InfoFieldAnnotation, StandardAnnotation {
|
||||
|
||||
public Map<String, Object> annotate(RefMetaDataTracker tracker, ReferenceContext ref, Map<String, StratifiedAlignmentContext> stratifiedContexts, VariantContext vc) {
|
||||
if ( stratifiedContexts.size() == 0 )
|
||||
return null;
|
||||
|
||||
int depth = 0;
|
||||
for ( String sample : stratifiedContexts.keySet() )
|
||||
depth += stratifiedContexts.get(sample).getContext(StratifiedAlignmentContext.StratifiedContextType.COMPLETE).size();
|
||||
|
|
|
|||
|
|
@ -18,6 +18,9 @@ import java.util.Arrays;
|
|||
public class LowMQ implements InfoFieldAnnotation {
|
||||
|
||||
public Map<String, Object> annotate(RefMetaDataTracker tracker, ReferenceContext ref, Map<String, StratifiedAlignmentContext> stratifiedContexts, VariantContext vc) {
|
||||
if ( stratifiedContexts.size() == 0 )
|
||||
return null;
|
||||
|
||||
double mq0 = 0;
|
||||
double mq10 = 0;
|
||||
double total = 0;
|
||||
|
|
|
|||
|
|
@ -19,6 +19,9 @@ import java.util.Arrays;
|
|||
public class MappingQualityZero implements InfoFieldAnnotation, StandardAnnotation {
|
||||
|
||||
public Map<String, Object> annotate(RefMetaDataTracker tracker, ReferenceContext ref, Map<String, StratifiedAlignmentContext> stratifiedContexts, VariantContext vc) {
|
||||
if ( stratifiedContexts.size() == 0 )
|
||||
return null;
|
||||
|
||||
int mq0 = 0;
|
||||
for ( String sample : stratifiedContexts.keySet() ) {
|
||||
ReadBackedPileup pileup = stratifiedContexts.get(sample).getContext(StratifiedAlignmentContext.StratifiedContextType.COMPLETE).getBasePileup();
|
||||
|
|
|
|||
|
|
@ -17,6 +17,9 @@ import java.util.Arrays;
|
|||
public class QualByDepth implements InfoFieldAnnotation, StandardAnnotation {
|
||||
|
||||
public Map<String, Object> annotate(RefMetaDataTracker tracker, ReferenceContext ref, Map<String, StratifiedAlignmentContext> stratifiedContexts, VariantContext vc) {
|
||||
if ( stratifiedContexts.size() == 0 )
|
||||
return null;
|
||||
|
||||
final Map<String, Genotype> genotypes = vc.getGenotypes();
|
||||
if ( genotypes == null || genotypes.size() == 0 )
|
||||
return null;
|
||||
|
|
|
|||
|
|
@ -18,6 +18,9 @@ import java.util.*;
|
|||
public class RMSMappingQuality implements InfoFieldAnnotation, StandardAnnotation {
|
||||
|
||||
public Map<String, Object> annotate(RefMetaDataTracker tracker, ReferenceContext ref, Map<String, StratifiedAlignmentContext> stratifiedContexts, VariantContext vc) {
|
||||
if ( stratifiedContexts.size() == 0 )
|
||||
return null;
|
||||
|
||||
ArrayList<Integer> qualities = new ArrayList<Integer>();
|
||||
for ( String sample : stratifiedContexts.keySet() ) {
|
||||
ReadBackedPileup pileup = stratifiedContexts.get(sample).getContext(StratifiedAlignmentContext.StratifiedContextType.COMPLETE).getBasePileup();
|
||||
|
|
|
|||
|
|
@ -19,7 +19,9 @@ public abstract class RankSumTest implements InfoFieldAnnotation, WorkInProgress
|
|||
private static final double minPValue = 1e-10;
|
||||
|
||||
public Map<String, Object> annotate(RefMetaDataTracker tracker, ReferenceContext ref, Map<String, StratifiedAlignmentContext> stratifiedContexts, VariantContext vc) {
|
||||
|
||||
if ( stratifiedContexts.size() == 0 )
|
||||
return null;
|
||||
|
||||
if ( !vc.isBiallelic() || !vc.isSNP() )
|
||||
return null;
|
||||
|
||||
|
|
|
|||
|
|
@ -53,6 +53,9 @@ public class SecondBaseSkew implements InfoFieldAnnotation, ExperimentalAnnotati
|
|||
public List<VCFInfoHeaderLine> getDescriptions() { return Arrays.asList(new VCFInfoHeaderLine(KEY_NAME, 1, VCFInfoHeaderLine.INFO_TYPE.Float, "Chi-square Secondary Base Skew")); }
|
||||
|
||||
public Map<String, Object> annotate(RefMetaDataTracker tracker, ReferenceContext ref, Map<String, StratifiedAlignmentContext> stratifiedContexts, VariantContext vc) {
|
||||
if ( stratifiedContexts.size() == 0 )
|
||||
return null;
|
||||
|
||||
String annotation = getAnnotation(ref, stratifiedContexts, vc);
|
||||
if ( annotation == null )
|
||||
return null;
|
||||
|
|
|
|||
|
|
@ -18,6 +18,9 @@ import java.util.Arrays;
|
|||
public class SpanningDeletions implements InfoFieldAnnotation, StandardAnnotation {
|
||||
|
||||
public Map<String, Object> annotate(RefMetaDataTracker tracker, ReferenceContext ref, Map<String, StratifiedAlignmentContext> stratifiedContexts, VariantContext vc) {
|
||||
if ( stratifiedContexts.size() == 0 )
|
||||
return null;
|
||||
|
||||
int deletions = 0;
|
||||
int depth = 0;
|
||||
for ( String sample : stratifiedContexts.keySet() ) {
|
||||
|
|
|
|||
|
|
@ -110,4 +110,11 @@ public class VariantAnnotatorIntegrationTest extends WalkerTest {
|
|||
executeTest("test file doesn't have annotations, asking for annotations, #2", spec);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testNoReads() {
|
||||
WalkerTestSpec spec = new WalkerTestSpec(
|
||||
baseTestString() + " -G \"Standard\" -B variant,VCF," + validationDataLocation + "vcfexample3empty.vcf -L 1:10,000,000-10,050,000", 1,
|
||||
Arrays.asList("07af9983127c62e96accc03db2fb523e"));
|
||||
executeTest("test file doesn't have annotations, not passing it any reads", spec);
|
||||
}
|
||||
}
|
||||
Loading…
Reference in New Issue