Refactoring of the annotation system:
1. VA is now a ROD walker so it no longer requires reads (needs a little more testing) 2. Annotations can now represent multiple INFO fields (i.e. sets of key/value pairs) 3. The chromosome count annotations have been pulled out of UG and the VCF writer code and into VA where they belong. Fixed the headers too. git-svn-id: file:///humgen/gsa-scr1/gsa-engineering/svn_contents/trunk@3513 348d0f76-0448-11de-a6fe-93d51630548a
This commit is contained in:
parent
84563b37e5
commit
9b2fcc4711
|
|
@ -383,7 +383,17 @@ public class VariantContextAdaptors {
|
|||
result = VCFGenotypeRecord.getMissingFieldValue(key);
|
||||
else if ( val instanceof Double )
|
||||
result = String.format("%.2f", (Double)val);
|
||||
else
|
||||
else if ( val instanceof List ) {
|
||||
List list = (List)val;
|
||||
if ( list.size() == 0 )
|
||||
return formatVCFField(key, null);
|
||||
StringBuffer sb = new StringBuffer(formatVCFField(key, list.get(0)));
|
||||
for ( int i = 1; i < list.size(); i++) {
|
||||
sb.append(",");
|
||||
sb.append(formatVCFField(key, list.get(i)));
|
||||
}
|
||||
result = sb.toString();
|
||||
} else
|
||||
result = val.toString();
|
||||
|
||||
return result;
|
||||
|
|
|
|||
|
|
@ -10,6 +10,8 @@ import org.broadinstitute.sting.gatk.walkers.annotator.interfaces.InfoFieldAnnot
|
|||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.List;
|
||||
import java.util.Arrays;
|
||||
|
||||
|
||||
public class Alignability implements InfoFieldAnnotation {
|
||||
|
|
@ -29,11 +31,11 @@ public class Alignability implements InfoFieldAnnotation {
|
|||
int value = Integer.parseInt(record.get("alignability"));
|
||||
|
||||
Map<String, Object> map = new HashMap<String, Object>();
|
||||
map.put(getKeyName(), String.format("%d", value));
|
||||
map.put(getKeyNames().get(0), String.format("%d", value));
|
||||
return map;
|
||||
}
|
||||
|
||||
public String getKeyName() { return "Alignability"; }
|
||||
public List<String> getKeyNames() { return Arrays.asList("Alignability"); }
|
||||
|
||||
public VCFInfoHeaderLine getDescription() { return new VCFInfoHeaderLine(getKeyName(), 1, VCFInfoHeaderLine.INFO_TYPE.Integer, "Alignability according to a mask file (3 is best, 0 is worst)"); }
|
||||
public List<VCFInfoHeaderLine> getDescriptions() { return Arrays.asList(new VCFInfoHeaderLine(getKeyNames().get(0), 1, VCFInfoHeaderLine.INFO_TYPE.Integer, "Alignability according to a mask file (3 is best, 0 is worst)")); }
|
||||
}
|
||||
|
|
|
|||
|
|
@ -26,7 +26,6 @@
|
|||
package org.broadinstitute.sting.gatk.walkers.annotator;
|
||||
|
||||
import org.broad.tribble.vcf.VCFInfoHeaderLine;
|
||||
import org.broadinstitute.sting.gatk.contexts.AlignmentContext;
|
||||
import org.broadinstitute.sting.gatk.contexts.ReferenceContext;
|
||||
import org.broadinstitute.sting.gatk.contexts.StratifiedAlignmentContext;
|
||||
import org.broadinstitute.sting.gatk.contexts.variantcontext.*;
|
||||
|
|
@ -37,6 +36,8 @@ import org.broadinstitute.sting.utils.pileup.ReadBackedExtendedEventPileup;
|
|||
|
||||
import java.util.Map;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Arrays;
|
||||
|
||||
|
||||
public class AlleleBalance implements InfoFieldAnnotation, StandardAnnotation {
|
||||
|
|
@ -46,10 +47,8 @@ public class AlleleBalance implements InfoFieldAnnotation, StandardAnnotation {
|
|||
if ( !vc.isBiallelic() )
|
||||
return null;
|
||||
final Map<String, Genotype> genotypes = vc.getGenotypes();
|
||||
if ( genotypes == null || genotypes.size() == 0 ) {
|
||||
System.out.println("No genotypes for vc at "+ref.getLocus().toString());
|
||||
if ( !vc.hasGenotypes() )
|
||||
return null;
|
||||
}
|
||||
|
||||
double ratio = 0.0;
|
||||
double totalWeights = 0.0;
|
||||
|
|
@ -102,11 +101,11 @@ public class AlleleBalance implements InfoFieldAnnotation, StandardAnnotation {
|
|||
return null;
|
||||
|
||||
Map<String, Object> map = new HashMap<String, Object>();
|
||||
map.put(getKeyName(), String.format("%.2f", (ratio / totalWeights)));
|
||||
map.put(getKeyNames().get(0), String.format("%.2f", (ratio / totalWeights)));
|
||||
return map;
|
||||
}
|
||||
|
||||
public String getKeyName() { return "AB"; }
|
||||
public List<String> getKeyNames() { return Arrays.asList("AB"); }
|
||||
|
||||
public VCFInfoHeaderLine getDescription() { return new VCFInfoHeaderLine("AB", 1, VCFInfoHeaderLine.INFO_TYPE.Float, "Allele Balance for hets (ref/(ref+alt))"); }
|
||||
public List<VCFInfoHeaderLine> getDescriptions() { return Arrays.asList(new VCFInfoHeaderLine("AB", 1, VCFInfoHeaderLine.INFO_TYPE.Float, "Allele Balance for hets (ref/(ref+alt))")); }
|
||||
}
|
||||
|
|
|
|||
|
|
@ -5,24 +5,24 @@ import org.broadinstitute.sting.utils.pileup.ReadBackedPileup;
|
|||
import org.broadinstitute.sting.utils.pileup.PileupElement;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Arrays;
|
||||
|
||||
|
||||
public class BaseQualityRankSumTest /*extends RankSumTest*/ {
|
||||
// todo -- seems math in this test is dubious, need to recheck and verify (p-values wildly divergent from R or MATLAB)
|
||||
public String getKeyName() { return "BaseQRankSum"; }
|
||||
public List<String> getKeyNames() { return Arrays.asList("BaseQRankSum"); }
|
||||
|
||||
public VCFInfoHeaderLine getDescription() { return new VCFInfoHeaderLine("BaseQRankSum", 1, VCFInfoHeaderLine.INFO_TYPE.Float, "Phred-scaled p-value From Wilcoxon Rank Sum Test of Het Vs. Ref Base Qualities"); }
|
||||
public List<VCFInfoHeaderLine> getDescriptions() { return Arrays.asList(new VCFInfoHeaderLine("BaseQRankSum", 1, VCFInfoHeaderLine.INFO_TYPE.Float, "Phred-scaled p-value From Wilcoxon Rank Sum Test of Het Vs. Ref Base Qualities")); }
|
||||
|
||||
protected void fillQualsFromPileup(char ref, char alt, ReadBackedPileup pileup, List<Integer> refQuals, List<Integer> altQuals) {
|
||||
protected void fillQualsFromPileup(byte ref, char alt, ReadBackedPileup pileup, List<Integer> refQuals, List<Integer> altQuals) {
|
||||
for ( PileupElement p : pileup ) {
|
||||
// ignore deletions
|
||||
if ( p.isDeletion() )
|
||||
continue;
|
||||
|
||||
char base = (char)p.getBase();
|
||||
if ( base == ref )
|
||||
if ( p.getBase() == ref )
|
||||
refQuals.add((int)p.getQual());
|
||||
else if ( base == alt )
|
||||
else if ( (char)p.getBase() == alt )
|
||||
altQuals.add((int)p.getQual());
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,74 @@
|
|||
/*
|
||||
* Copyright (c) 2010.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person
|
||||
* obtaining a copy of this software and associated documentation
|
||||
* files (the "Software"), to deal in the Software without
|
||||
* restriction, including without limitation the rights to use,
|
||||
* copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the
|
||||
* Software is furnished to do so, subject to the following
|
||||
* conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be
|
||||
* included in all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
|
||||
* OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
|
||||
* HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
||||
* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR
|
||||
* THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
package org.broadinstitute.sting.gatk.walkers.annotator;
|
||||
|
||||
import org.broad.tribble.vcf.VCFInfoHeaderLine;
|
||||
import org.broad.tribble.vcf.VCFRecord;
|
||||
import org.broadinstitute.sting.gatk.contexts.ReferenceContext;
|
||||
import org.broadinstitute.sting.gatk.contexts.StratifiedAlignmentContext;
|
||||
import org.broadinstitute.sting.gatk.contexts.variantcontext.*;
|
||||
import org.broadinstitute.sting.gatk.refdata.RefMetaDataTracker;
|
||||
import org.broadinstitute.sting.gatk.walkers.annotator.interfaces.*;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
|
||||
public class ChromosomeCounts implements InfoFieldAnnotation, StandardAnnotation {
|
||||
|
||||
private String[] keyNames = { VCFRecord.ALLELE_NUMBER_KEY, VCFRecord.ALLELE_COUNT_KEY, VCFRecord.ALLELE_FREQUENCY_KEY };
|
||||
private VCFInfoHeaderLine[] descriptions = { new VCFInfoHeaderLine(VCFRecord.ALLELE_FREQUENCY_KEY, -1, VCFInfoHeaderLine.INFO_TYPE.Float, "Allele Frequency"),
|
||||
new VCFInfoHeaderLine(VCFRecord.ALLELE_COUNT_KEY, -1, VCFInfoHeaderLine.INFO_TYPE.Integer, "Allele count in genotypes, for each ALT allele, in the same order as listed"),
|
||||
new VCFInfoHeaderLine(VCFRecord.ALLELE_NUMBER_KEY, 1, VCFInfoHeaderLine.INFO_TYPE.Integer, "Total number of alleles in called genotypes") };
|
||||
|
||||
public Map<String, Object> annotate(RefMetaDataTracker tracker, ReferenceContext ref, Map<String, StratifiedAlignmentContext> stratifiedContexts, VariantContext vc) {
|
||||
|
||||
if ( vc.getChromosomeCount() == 0 )
|
||||
return null;
|
||||
|
||||
Map<String, Object> map = new HashMap<String, Object>();
|
||||
map.put(VCFRecord.ALLELE_NUMBER_KEY, vc.getChromosomeCount());
|
||||
|
||||
if ( vc.getAlternateAlleles().size() > 0 ) {
|
||||
ArrayList<Double> alleleFreqs = new ArrayList<Double>();
|
||||
ArrayList<Integer> alleleCounts = new ArrayList<Integer>();
|
||||
for ( Allele allele : vc.getAlternateAlleles() ) {
|
||||
alleleCounts.add(vc.getChromosomeCount(allele));
|
||||
alleleFreqs.add((double)vc.getChromosomeCount(allele) / (double)vc.getChromosomeCount());
|
||||
}
|
||||
|
||||
map.put(VCFRecord.ALLELE_COUNT_KEY, alleleCounts);
|
||||
map.put(VCFRecord.ALLELE_FREQUENCY_KEY, alleleFreqs);
|
||||
}
|
||||
|
||||
return map;
|
||||
}
|
||||
|
||||
public List<String> getKeyNames() {
|
||||
return Arrays.asList(keyNames);
|
||||
}
|
||||
|
||||
public List<VCFInfoHeaderLine> getDescriptions() { return Arrays.asList(descriptions); }
|
||||
}
|
||||
|
|
@ -10,6 +10,8 @@ import org.broadinstitute.sting.gatk.walkers.annotator.interfaces.*;
|
|||
|
||||
import java.util.Map;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Arrays;
|
||||
|
||||
|
||||
public class DepthOfCoverage implements InfoFieldAnnotation, StandardAnnotation {
|
||||
|
|
@ -19,11 +21,11 @@ public class DepthOfCoverage implements InfoFieldAnnotation, StandardAnnotation
|
|||
for ( String sample : stratifiedContexts.keySet() )
|
||||
depth += stratifiedContexts.get(sample).getContext(StratifiedAlignmentContext.StratifiedContextType.COMPLETE).size();
|
||||
Map<String, Object> map = new HashMap<String, Object>();
|
||||
map.put(getKeyName(), String.format("%d", depth));
|
||||
map.put(getKeyNames().get(0), String.format("%d", depth));
|
||||
return map;
|
||||
}
|
||||
|
||||
public String getKeyName() { return VCFRecord.DEPTH_KEY; }
|
||||
public List<String> getKeyNames() { return Arrays.asList(VCFRecord.DEPTH_KEY); }
|
||||
|
||||
public VCFInfoHeaderLine getDescription() { return new VCFInfoHeaderLine(getKeyName(), 1, VCFInfoHeaderLine.INFO_TYPE.Integer, "Total Depth"); }
|
||||
public List<VCFInfoHeaderLine> getDescriptions() { return Arrays.asList(new VCFInfoHeaderLine(getKeyNames().get(0), 1, VCFInfoHeaderLine.INFO_TYPE.Integer, "Total Depth")); }
|
||||
}
|
||||
|
|
|
|||
|
|
@ -13,20 +13,19 @@ import java.util.*;
|
|||
public class DepthPerAlleleBySample implements GenotypeAnnotation, ExperimentalAnnotation {
|
||||
|
||||
public Map<String, Object> annotate(RefMetaDataTracker tracker, ReferenceContext ref, StratifiedAlignmentContext stratifiedContext, VariantContext vc, Genotype g) {
|
||||
// for now, we don't support indels
|
||||
if ( g == null || !g.isCalled() )
|
||||
return null;
|
||||
|
||||
if ( vc.isSNP() ) {
|
||||
return annotateSNP(tracker,ref,stratifiedContext,vc,g);
|
||||
return annotateSNP(stratifiedContext, vc);
|
||||
} else if ( vc.isIndel() ) {
|
||||
return annotateIndel(tracker,ref,stratifiedContext,vc,g);
|
||||
return annotateIndel(stratifiedContext, vc);
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
public Map<String,Object> annotateSNP(RefMetaDataTracker tracker, ReferenceContext ref, StratifiedAlignmentContext stratifiedContext, VariantContext vc, Genotype g) {
|
||||
private Map<String,Object> annotateSNP(StratifiedAlignmentContext stratifiedContext, VariantContext vc) {
|
||||
|
||||
Set<Allele> altAlleles = vc.getAlternateAlleles();
|
||||
if ( altAlleles.size() == 0 )
|
||||
|
|
@ -53,11 +52,11 @@ public class DepthPerAlleleBySample implements GenotypeAnnotation, ExperimentalA
|
|||
}
|
||||
|
||||
Map<String, Object> map = new HashMap<String, Object>();
|
||||
map.put(getKeyName(), sb.toString());
|
||||
map.put(getKeyNames().get(0), sb.toString());
|
||||
return map;
|
||||
}
|
||||
|
||||
public Map<String,Object> annotateIndel(RefMetaDataTracker tracker, ReferenceContext ref, StratifiedAlignmentContext stratifiedContext, VariantContext vc, Genotype g) {
|
||||
private Map<String,Object> annotateIndel(StratifiedAlignmentContext stratifiedContext, VariantContext vc) {
|
||||
ReadBackedExtendedEventPileup pileup = stratifiedContext.getContext(StratifiedAlignmentContext.StratifiedContextType.COMPLETE).getExtendedEventPileup();
|
||||
if ( pileup == null ) {
|
||||
return null;
|
||||
|
|
@ -88,11 +87,11 @@ public class DepthPerAlleleBySample implements GenotypeAnnotation, ExperimentalA
|
|||
}
|
||||
|
||||
Map<String,Object> map = new HashMap<String,Object>();
|
||||
map.put(getKeyName(),sb.toString());
|
||||
map.put(getKeyNames().get(0),sb.toString());
|
||||
return map;
|
||||
}
|
||||
|
||||
public String getKeyName() { return "AD"; }
|
||||
public List<String> getKeyNames() { return Arrays.asList("AD"); }
|
||||
|
||||
public VCFFormatHeaderLine getDescription() { return new VCFFormatHeaderLine(getKeyName(), 1, VCFFormatHeaderLine.FORMAT_TYPE.Integer, "Depth in genotypes for each ALT allele, in the same order as listed"); }
|
||||
public List<VCFFormatHeaderLine> getDescriptions() { return Arrays.asList(new VCFFormatHeaderLine(getKeyNames().get(0), -1, VCFFormatHeaderLine.FORMAT_TYPE.Integer, "Depth in genotypes for each ALT allele, in the same order as listed")); }
|
||||
}
|
||||
|
|
@ -10,6 +10,8 @@ import org.broadinstitute.sting.utils.BaseUtils;
|
|||
|
||||
import java.util.Map;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Arrays;
|
||||
|
||||
|
||||
public class GCContent implements InfoFieldAnnotation, ExperimentalAnnotation {
|
||||
|
|
@ -17,13 +19,13 @@ public class GCContent implements InfoFieldAnnotation, ExperimentalAnnotation {
|
|||
public Map<String, Object> annotate(RefMetaDataTracker tracker, ReferenceContext ref, Map<String, StratifiedAlignmentContext> stratifiedContexts, VariantContext vc) {
|
||||
double content = computeGCContent(ref);
|
||||
Map<String, Object> map = new HashMap<String, Object>();
|
||||
map.put(getKeyName(), String.format("%.2f", content));
|
||||
map.put(getKeyNames().get(0), String.format("%.2f", content));
|
||||
return map;
|
||||
}
|
||||
|
||||
public String getKeyName() { return "GC"; }
|
||||
public List<String> getKeyNames() { return Arrays.asList("GC"); }
|
||||
|
||||
public VCFInfoHeaderLine getDescription() { return new VCFInfoHeaderLine("GC", 1, VCFInfoHeaderLine.INFO_TYPE.Integer, "GC content within 20 bp +/- the variant"); }
|
||||
public List<VCFInfoHeaderLine> getDescriptions() { return Arrays.asList(new VCFInfoHeaderLine("GC", 1, VCFInfoHeaderLine.INFO_TYPE.Integer, "GC content within 20 bp +/- the variant")); }
|
||||
|
||||
public boolean useZeroQualityReads() { return false; }
|
||||
|
||||
|
|
|
|||
|
|
@ -69,7 +69,7 @@ public class HaplotypeScore implements InfoFieldAnnotation, StandardAnnotation {
|
|||
|
||||
// return the score
|
||||
Map<String, Object> map = new HashMap<String, Object>();
|
||||
map.put(getKeyName(), String.format("%.2f", score));
|
||||
map.put(getKeyNames().get(0), String.format("%.2f", score));
|
||||
return map;
|
||||
}
|
||||
|
||||
|
|
@ -281,6 +281,6 @@ public class HaplotypeScore implements InfoFieldAnnotation, StandardAnnotation {
|
|||
return new ReadBackedPileup(pileup.getLocation(), filteredPileup);
|
||||
}
|
||||
|
||||
public String getKeyName() { return "HaplotypeScore"; }
|
||||
public VCFInfoHeaderLine getDescription() { return new VCFInfoHeaderLine("HaplotypeScore", 1, VCFInfoHeaderLine.INFO_TYPE.Float, "Consistency of the site with two (and only two) segregating haplotypes"); }
|
||||
public List<String> getKeyNames() { return Arrays.asList("HaplotypeScore"); }
|
||||
public List<VCFInfoHeaderLine> getDescriptions() { return Arrays.asList(new VCFInfoHeaderLine("HaplotypeScore", 1, VCFInfoHeaderLine.INFO_TYPE.Float, "Consistency of the site with two (and only two) segregating haplotypes")); }
|
||||
}
|
||||
|
|
@ -11,6 +11,8 @@ import org.broadinstitute.sting.utils.QualityUtils;
|
|||
|
||||
import java.util.Map;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Arrays;
|
||||
|
||||
|
||||
public class HardyWeinberg implements InfoFieldAnnotation, WorkInProgressAnnotation {
|
||||
|
|
@ -55,11 +57,11 @@ public class HardyWeinberg implements InfoFieldAnnotation, WorkInProgressAnnotat
|
|||
double pvalue = HardyWeinbergCalculation.hwCalculate(refCount, hetCount, homCount);
|
||||
//System.out.println(refCount + " " + hetCount + " " + homCount + " " + pvalue);
|
||||
Map<String, Object> map = new HashMap<String, Object>();
|
||||
map.put(getKeyName(), String.format("%.1f", QualityUtils.phredScaleErrorRate(pvalue)));
|
||||
map.put(getKeyNames().get(0), String.format("%.1f", QualityUtils.phredScaleErrorRate(pvalue)));
|
||||
return map;
|
||||
}
|
||||
|
||||
public String getKeyName() { return "HW"; }
|
||||
public List<String> getKeyNames() { return Arrays.asList("HW"); }
|
||||
|
||||
public VCFInfoHeaderLine getDescription() { return new VCFInfoHeaderLine("HW", 1, VCFInfoHeaderLine.INFO_TYPE.Float, "Phred-scaled p-value for Hardy-Weinberg violation"); }
|
||||
public List<VCFInfoHeaderLine> getDescriptions() { return Arrays.asList(new VCFInfoHeaderLine("HW", 1, VCFInfoHeaderLine.INFO_TYPE.Float, "Phred-scaled p-value for Hardy-Weinberg violation")); }
|
||||
}
|
||||
|
|
@ -11,6 +11,8 @@ import org.broadinstitute.sting.utils.GenomeLoc;
|
|||
|
||||
import java.util.Map;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Arrays;
|
||||
|
||||
|
||||
public class HomopolymerRun implements InfoFieldAnnotation, StandardAnnotation {
|
||||
|
|
@ -32,13 +34,13 @@ public class HomopolymerRun implements InfoFieldAnnotation, StandardAnnotation {
|
|||
}
|
||||
|
||||
Map<String, Object> map = new HashMap<String, Object>();
|
||||
map.put(getKeyName(), String.format("%d", run));
|
||||
map.put(getKeyNames().get(0), String.format("%d", run));
|
||||
return map;
|
||||
}
|
||||
|
||||
public String getKeyName() { return "HRun"; }
|
||||
public List<String> getKeyNames() { return Arrays.asList("HRun"); }
|
||||
|
||||
public VCFInfoHeaderLine getDescription() { return new VCFInfoHeaderLine("HRun", 1, VCFInfoHeaderLine.INFO_TYPE.Integer, "Largest Contiguous Homopolymer Run of Variant Allele In Either Direction"); }
|
||||
public List<VCFInfoHeaderLine> getDescriptions() { return Arrays.asList(new VCFInfoHeaderLine("HRun", 1, VCFInfoHeaderLine.INFO_TYPE.Integer, "Largest Contiguous Homopolymer Run of Variant Allele In Either Direction")); }
|
||||
|
||||
public boolean useZeroQualityReads() { return false; }
|
||||
|
||||
|
|
|
|||
|
|
@ -11,6 +11,8 @@ import org.broadinstitute.sting.utils.pileup.PileupElement;
|
|||
|
||||
import java.util.Map;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Arrays;
|
||||
|
||||
|
||||
public class LowMQ implements InfoFieldAnnotation {
|
||||
|
|
@ -30,11 +32,11 @@ public class LowMQ implements InfoFieldAnnotation {
|
|||
}
|
||||
}
|
||||
Map<String, Object> map = new HashMap<String, Object>();
|
||||
map.put(getKeyName(), String.format("%.04f,%.04f,%.00f", mq0/total, mq10/total, total));
|
||||
map.put(getKeyNames().get(0), String.format("%.04f,%.04f,%.00f", mq0/total, mq10/total, total));
|
||||
return map;
|
||||
}
|
||||
|
||||
public String getKeyName() { return "LowMQ"; }
|
||||
public List<String> getKeyNames() { return Arrays.asList("LowMQ"); }
|
||||
|
||||
public VCFInfoHeaderLine getDescription() { return new VCFInfoHeaderLine(getKeyName(), 1, VCFInfoHeaderLine.INFO_TYPE.Integer, "3-tuple: <fraction of reads with MQ=0>,<fraction of reads with MQ<=10>,<total nubmer of reads>"); }
|
||||
public List<VCFInfoHeaderLine> getDescriptions() { return Arrays.asList(new VCFInfoHeaderLine(getKeyNames().get(0), 3, VCFInfoHeaderLine.INFO_TYPE.Integer, "3-tuple: <fraction of reads with MQ=0>,<fraction of reads with MQ<=10>,<total nubmer of reads>")); }
|
||||
}
|
||||
|
|
|
|||
|
|
@ -5,24 +5,24 @@ import org.broadinstitute.sting.utils.pileup.ReadBackedPileup;
|
|||
import org.broadinstitute.sting.utils.pileup.PileupElement;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Arrays;
|
||||
|
||||
|
||||
public class MappingQualityRankSumTest extends RankSumTest {
|
||||
public class MappingQualityRankSumTest /*extends RankSumTest*/ {
|
||||
|
||||
public String getKeyName() { return "MQRankSum"; }
|
||||
public List<String> getKeyNames() { return Arrays.asList("MQRankSum"); }
|
||||
|
||||
public VCFInfoHeaderLine getDescription() { return new VCFInfoHeaderLine("MQRankSum", 1, VCFInfoHeaderLine.INFO_TYPE.Float, "Phred-scaled p-value From Wilcoxon Rank Sum Test of Het Vs. Ref Read Mapping Qualities"); }
|
||||
public List<VCFInfoHeaderLine> getDescriptions() { return Arrays.asList(new VCFInfoHeaderLine("MQRankSum", 1, VCFInfoHeaderLine.INFO_TYPE.Float, "Phred-scaled p-value From Wilcoxon Rank Sum Test of Het Vs. Ref Read Mapping Qualities")); }
|
||||
|
||||
protected void fillQualsFromPileup(char ref, char alt, ReadBackedPileup pileup, List<Integer> refQuals, List<Integer> altQuals) {
|
||||
protected void fillQualsFromPileup(byte ref, char alt, ReadBackedPileup pileup, List<Integer> refQuals, List<Integer> altQuals) {
|
||||
for ( PileupElement p : pileup ) {
|
||||
// ignore deletions
|
||||
if ( p.isDeletion() )
|
||||
continue;
|
||||
|
||||
char base = (char)p.getBase();
|
||||
if ( base == ref )
|
||||
if ( p.getBase() == ref )
|
||||
refQuals.add(p.getMappingQual());
|
||||
else if ( base == alt )
|
||||
else if ( (char)p.getBase() == alt )
|
||||
altQuals.add(p.getMappingQual());
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -12,6 +12,8 @@ import org.broadinstitute.sting.utils.pileup.PileupElement;
|
|||
|
||||
import java.util.Map;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Arrays;
|
||||
|
||||
|
||||
public class MappingQualityZero implements InfoFieldAnnotation, StandardAnnotation {
|
||||
|
|
@ -26,11 +28,11 @@ public class MappingQualityZero implements InfoFieldAnnotation, StandardAnnotati
|
|||
}
|
||||
}
|
||||
Map<String, Object> map = new HashMap<String, Object>();
|
||||
map.put(getKeyName(), String.format("%d", mq0));
|
||||
map.put(getKeyNames().get(0), String.format("%d", mq0));
|
||||
return map;
|
||||
}
|
||||
|
||||
public String getKeyName() { return "MQ0"; }
|
||||
public List<String> getKeyNames() { return Arrays.asList("MQ0"); }
|
||||
|
||||
public VCFInfoHeaderLine getDescription() { return new VCFInfoHeaderLine(getKeyName(), 1, VCFInfoHeaderLine.INFO_TYPE.Integer, "Total Mapping Quality Zero Reads"); }
|
||||
public List<VCFInfoHeaderLine> getDescriptions() { return Arrays.asList(new VCFInfoHeaderLine(getKeyNames().get(0), 1, VCFInfoHeaderLine.INFO_TYPE.Integer, "Total Mapping Quality Zero Reads")); }
|
||||
}
|
||||
|
|
@ -10,6 +10,8 @@ import org.broadinstitute.sting.gatk.walkers.annotator.interfaces.StandardAnnota
|
|||
|
||||
import java.util.Map;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Arrays;
|
||||
|
||||
|
||||
public class QualByDepth implements InfoFieldAnnotation, StandardAnnotation {
|
||||
|
|
@ -26,13 +28,13 @@ public class QualByDepth implements InfoFieldAnnotation, StandardAnnotation {
|
|||
|
||||
double QbyD = 10.0 * vc.getNegLog10PError() / (double)qDepth;
|
||||
Map<String, Object> map = new HashMap<String, Object>();
|
||||
map.put(getKeyName(), String.format("%.2f", QbyD));
|
||||
map.put(getKeyNames().get(0), String.format("%.2f", QbyD));
|
||||
return map;
|
||||
}
|
||||
|
||||
public String getKeyName() { return "QD"; }
|
||||
public List<String> getKeyNames() { return Arrays.asList("QD"); }
|
||||
|
||||
public VCFInfoHeaderLine getDescription() { return new VCFInfoHeaderLine(getKeyName(), 1, VCFInfoHeaderLine.INFO_TYPE.Float, "Variant Confidence/Quality by Depth"); }
|
||||
public List<VCFInfoHeaderLine> getDescriptions() { return Arrays.asList(new VCFInfoHeaderLine(getKeyNames().get(0), 1, VCFInfoHeaderLine.INFO_TYPE.Float, "Variant Confidence/Quality by Depth")); }
|
||||
|
||||
private int variationQualByDepth(final Map<String, Genotype> genotypes, Map<String, StratifiedAlignmentContext> stratifiedContexts) {
|
||||
int depth = 0;
|
||||
|
|
|
|||
|
|
@ -9,6 +9,8 @@ import org.broadinstitute.sting.gatk.walkers.annotator.interfaces.*;
|
|||
|
||||
import java.util.Map;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Arrays;
|
||||
|
||||
public class QualityAdjustedSecondBaseLod implements InfoFieldAnnotation, ExperimentalAnnotation {
|
||||
private final String KEY_NAME = "Qual_Adjusted_2blod";
|
||||
|
|
@ -17,9 +19,9 @@ public class QualityAdjustedSecondBaseLod implements InfoFieldAnnotation, Experi
|
|||
private final double log10e = Math.log10(Math.E);
|
||||
private final double log10half = Math.log10(1.0/2);
|
||||
|
||||
public String getKeyName() { return KEY_NAME; }
|
||||
public List<String> getKeyNames() { return Arrays.asList(KEY_NAME); }
|
||||
|
||||
public VCFInfoHeaderLine getDescription() { return new VCFInfoHeaderLine(KEY_NAME, 1, VCFInfoHeaderLine.INFO_TYPE.Float, "Adjusted residual quality based on second-base skew"); }
|
||||
public List<VCFInfoHeaderLine> getDescriptions() { return Arrays.asList(new VCFInfoHeaderLine(KEY_NAME, 1, VCFInfoHeaderLine.INFO_TYPE.Float, "Adjusted residual quality based on second-base skew")); }
|
||||
|
||||
public Map<String, Object> annotate( RefMetaDataTracker tracker, ReferenceContext ref, Map<String, StratifiedAlignmentContext> contexts, VariantContext vc) {
|
||||
String chi = skewCalc.getAnnotation(ref, contexts, vc);
|
||||
|
|
@ -28,7 +30,7 @@ public class QualityAdjustedSecondBaseLod implements InfoFieldAnnotation, Experi
|
|||
double chi_square = Double.valueOf(chi);
|
||||
double chi_loglik = chi_square <= 0.0 ? 0.0 : Math.max(-(chi_square/2.0)*log10e + log10half,CHI_LOD_MAX); // cap it...
|
||||
Map<String, Object> map = new HashMap<String, Object>();
|
||||
map.put(getKeyName(), String.format("%f", 10*(vc.getNegLog10PError() + chi_loglik)));
|
||||
map.put(getKeyNames().get(0), String.format("%f", 10*(vc.getNegLog10PError() + chi_loglik)));
|
||||
return map;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -12,9 +12,7 @@ import org.broadinstitute.sting.utils.MathUtils;
|
|||
import org.broadinstitute.sting.utils.pileup.ReadBackedPileup;
|
||||
import org.broadinstitute.sting.utils.pileup.PileupElement;
|
||||
|
||||
import java.util.Map;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.*;
|
||||
|
||||
|
||||
public class RMSMappingQuality implements InfoFieldAnnotation, StandardAnnotation {
|
||||
|
|
@ -32,11 +30,11 @@ public class RMSMappingQuality implements InfoFieldAnnotation, StandardAnnotatio
|
|||
quals[index++] = i;
|
||||
double rms = MathUtils.rms(quals);
|
||||
Map<String, Object> map = new HashMap<String, Object>();
|
||||
map.put(getKeyName(), String.format("%.2f", rms));
|
||||
map.put(getKeyNames().get(0), String.format("%.2f", rms));
|
||||
return map;
|
||||
}
|
||||
|
||||
public String getKeyName() { return VCFRecord.RMS_MAPPING_QUALITY_KEY; }
|
||||
public List<String> getKeyNames() { return Arrays.asList(VCFRecord.RMS_MAPPING_QUALITY_KEY); }
|
||||
|
||||
public VCFInfoHeaderLine getDescription() { return new VCFInfoHeaderLine(getKeyName(), 1, VCFInfoHeaderLine.INFO_TYPE.Float, "RMS Mapping Quality"); }
|
||||
public List<VCFInfoHeaderLine> getDescriptions() { return Arrays.asList(new VCFInfoHeaderLine(getKeyNames().get(0), 1, VCFInfoHeaderLine.INFO_TYPE.Float, "RMS Mapping Quality")); }
|
||||
}
|
||||
|
|
@ -37,7 +37,7 @@ public abstract class RankSumTest implements InfoFieldAnnotation, WorkInProgress
|
|||
if ( context == null )
|
||||
continue;
|
||||
|
||||
fillQualsFromPileup(ref.getBaseAsChar(), vc.getAlternateAllele(0).toString().charAt(0), context.getContext(StratifiedAlignmentContext.StratifiedContextType.COMPLETE).getBasePileup(), refQuals, altQuals);
|
||||
fillQualsFromPileup(ref.getBase(), vc.getAlternateAllele(0).toString().charAt(0), context.getContext(StratifiedAlignmentContext.StratifiedContextType.COMPLETE).getBasePileup(), refQuals, altQuals);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -65,9 +65,9 @@ public abstract class RankSumTest implements InfoFieldAnnotation, WorkInProgress
|
|||
pvalue = minPValue;
|
||||
|
||||
Map<String, Object> map = new HashMap<String, Object>();
|
||||
map.put(getKeyName(), String.format("%.1f", QualityUtils.phredScaleErrorRate(pvalue)));
|
||||
map.put(getKeyNames().get(0), String.format("%.1f", QualityUtils.phredScaleErrorRate(pvalue)));
|
||||
return map;
|
||||
}
|
||||
|
||||
protected abstract void fillQualsFromPileup(char ref, char alt, ReadBackedPileup pileup, List<Integer> refQuals, List<Integer> altQuals);
|
||||
protected abstract void fillQualsFromPileup(byte ref, char alt, ReadBackedPileup pileup, List<Integer> refQuals, List<Integer> altQuals);
|
||||
}
|
||||
|
|
@ -38,6 +38,8 @@ import org.broadinstitute.sting.gatk.walkers.annotator.interfaces.*;
|
|||
|
||||
import java.util.Map;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Arrays;
|
||||
|
||||
|
||||
public class SecondBaseSkew implements InfoFieldAnnotation, ExperimentalAnnotation {
|
||||
|
|
@ -46,16 +48,16 @@ public class SecondBaseSkew implements InfoFieldAnnotation, ExperimentalAnnotati
|
|||
private final static double[] UNIFORM_ON_OFF_RATIO = {1.0/3.0, 2.0/3.0};
|
||||
private double[] proportionExpectations = UNIFORM_ON_OFF_RATIO;
|
||||
|
||||
public String getKeyName() { return KEY_NAME; }
|
||||
public List<String> getKeyNames() { return Arrays.asList(KEY_NAME); }
|
||||
|
||||
public VCFInfoHeaderLine getDescription() { return new VCFInfoHeaderLine(KEY_NAME, 1, VCFInfoHeaderLine.INFO_TYPE.Float, "Chi-square Secondary Base Skew"); }
|
||||
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) {
|
||||
String annotation = getAnnotation(ref, stratifiedContexts, vc);
|
||||
if ( annotation == null )
|
||||
return null;
|
||||
Map<String, Object> map = new HashMap<String, Object>();
|
||||
map.put(getKeyName(), annotation);
|
||||
map.put(getKeyNames().get(0), annotation);
|
||||
return map;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -11,6 +11,8 @@ import org.broadinstitute.sting.utils.pileup.ReadBackedPileup;
|
|||
|
||||
import java.util.Map;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Arrays;
|
||||
|
||||
|
||||
public class SpanningDeletions implements InfoFieldAnnotation, StandardAnnotation {
|
||||
|
|
@ -24,11 +26,11 @@ public class SpanningDeletions implements InfoFieldAnnotation, StandardAnnotatio
|
|||
depth += pileup.size();
|
||||
}
|
||||
Map<String, Object> map = new HashMap<String, Object>();
|
||||
map.put(getKeyName(), String.format("%.2f", depth == 0 ? 0.0 : (double)deletions/(double)depth));
|
||||
map.put(getKeyNames().get(0), String.format("%.2f", depth == 0 ? 0.0 : (double)deletions/(double)depth));
|
||||
return map;
|
||||
}
|
||||
|
||||
public String getKeyName() { return "Dels"; }
|
||||
public List<String> getKeyNames() { return Arrays.asList("Dels"); }
|
||||
|
||||
public VCFInfoHeaderLine getDescription() { return new VCFInfoHeaderLine("Dels", 1, VCFInfoHeaderLine.INFO_TYPE.Float, "Fraction of Reads Containing Spanning Deletions"); }
|
||||
public List<VCFInfoHeaderLine> getDescriptions() { return Arrays.asList(new VCFInfoHeaderLine("Dels", 1, VCFInfoHeaderLine.INFO_TYPE.Float, "Fraction of Reads Containing Spanning Deletions")); }
|
||||
}
|
||||
|
|
@ -56,7 +56,7 @@ import java.util.*;
|
|||
@Allows(value={DataSource.READS, DataSource.REFERENCE})
|
||||
@Reference(window=@Window(start=-50,stop=50))
|
||||
@By(DataSource.REFERENCE)
|
||||
public class VariantAnnotator extends LocusWalker<Integer, Integer> {
|
||||
public class VariantAnnotator extends RodWalker<Integer, Integer> {
|
||||
|
||||
@Argument(fullName="sampleName", shortName="sample", doc="The sample (NA-ID) corresponding to the variant input (for non-VCF input only)", required=false)
|
||||
protected String sampleName = null;
|
||||
|
|
|
|||
|
|
@ -182,9 +182,9 @@ public class VariantAnnotatorEngine {
|
|||
Set<VCFHeaderLine> descriptions = new HashSet<VCFHeaderLine>();
|
||||
|
||||
for ( InfoFieldAnnotation annotation : requestedInfoAnnotations )
|
||||
descriptions.add(annotation.getDescription());
|
||||
descriptions.addAll(annotation.getDescriptions());
|
||||
for ( GenotypeAnnotation annotation : requestedGenotypeAnnotations )
|
||||
descriptions.add(annotation.getDescription());
|
||||
descriptions.addAll(annotation.getDescriptions());
|
||||
if ( annotateDbsnp )
|
||||
descriptions.add(new VCFInfoHeaderLine(VCFRecord.DBSNP_KEY, 1, VCFInfoHeaderLine.INFO_TYPE.Integer, "dbSNP Membership"));
|
||||
if ( annotateHapmap2 )
|
||||
|
|
|
|||
|
|
@ -8,16 +8,17 @@ import org.broadinstitute.sting.gatk.contexts.variantcontext.VariantContext;
|
|||
import org.broadinstitute.sting.gatk.contexts.variantcontext.Genotype;
|
||||
|
||||
import java.util.Map;
|
||||
import java.util.List;
|
||||
|
||||
public interface GenotypeAnnotation {
|
||||
|
||||
// return annotations for the given contexts/genotype split by sample
|
||||
public Map<String, Object> annotate(RefMetaDataTracker tracker, ReferenceContext ref, StratifiedAlignmentContext stratifiedContext, VariantContext vc, Genotype g);
|
||||
|
||||
// return the FORMAT key
|
||||
public String getKeyName();
|
||||
// return the FORMAT keys
|
||||
public List<String> getKeyNames();
|
||||
|
||||
// return the description used for the VCF FORMAT meta field
|
||||
public VCFFormatHeaderLine getDescription();
|
||||
// return the descriptions used for the VCF FORMAT meta field
|
||||
public List<VCFFormatHeaderLine> getDescriptions();
|
||||
|
||||
}
|
||||
|
|
@ -7,16 +7,17 @@ import org.broadinstitute.sting.gatk.contexts.StratifiedAlignmentContext;
|
|||
import org.broadinstitute.sting.gatk.contexts.variantcontext.VariantContext;
|
||||
|
||||
import java.util.Map;
|
||||
import java.util.List;
|
||||
|
||||
public interface InfoFieldAnnotation {
|
||||
|
||||
// return annotations for the given contexts split by sample
|
||||
public Map<String, Object> annotate(RefMetaDataTracker tracker, ReferenceContext ref, Map<String, StratifiedAlignmentContext> stratifiedContexts, VariantContext vc);
|
||||
|
||||
// return the INFO key
|
||||
public String getKeyName();
|
||||
// return the INFO keys
|
||||
public List<String> getKeyNames();
|
||||
|
||||
// return the description used for the VCF INFO meta field
|
||||
public VCFInfoHeaderLine getDescription();
|
||||
// return the descriptions used for the VCF INFO meta field
|
||||
public List<VCFInfoHeaderLine> getDescriptions();
|
||||
|
||||
}
|
||||
|
|
@ -1,7 +1,6 @@
|
|||
package org.broadinstitute.sting.gatk.walkers.genotyper;
|
||||
|
||||
import org.broad.tribble.dbsnp.DbSNPFeature;
|
||||
import org.broad.tribble.vcf.VCFRecord;
|
||||
import org.broadinstitute.sting.utils.*;
|
||||
import org.broadinstitute.sting.utils.pileup.*;
|
||||
import org.broadinstitute.sting.gatk.refdata.RefMetaDataTracker;
|
||||
|
|
@ -385,8 +384,6 @@ public abstract class JointEstimateGenotypeCalculationModel extends GenotypeCalc
|
|||
|
||||
// *** note that calculating strand bias involves overwriting data structures, so we do that last
|
||||
HashMap<String, Object> attributes = new HashMap<String, Object>();
|
||||
if ( bestAFguess != 0 )
|
||||
attributes.put(VCFRecord.ALLELE_FREQUENCY_KEY, new Double((double)bestAFguess / (double)(frequencyEstimationPoints-1)));
|
||||
|
||||
DbSNPFeature dbsnp = getDbSNP(tracker);
|
||||
if ( dbsnp != null )
|
||||
|
|
|
|||
|
|
@ -146,7 +146,6 @@ public class UnifiedGenotyper extends LocusWalker<VariantCallContext, UnifiedGen
|
|||
headerInfo.addAll(annotationEngine.getVCFAnnotationDescriptions());
|
||||
|
||||
// annotation (INFO) fields from UnifiedGenotyper
|
||||
headerInfo.add(new VCFInfoHeaderLine(VCFRecord.ALLELE_FREQUENCY_KEY, 1, VCFInfoHeaderLine.INFO_TYPE.Float, "Allele Frequency"));
|
||||
if ( UG_engine.annotateDbsnp )
|
||||
headerInfo.add(new VCFInfoHeaderLine(VCFRecord.DBSNP_KEY, 1, VCFInfoHeaderLine.INFO_TYPE.Integer, "dbSNP Membership"));
|
||||
if ( UG_engine.annotateHapmap2 )
|
||||
|
|
@ -158,8 +157,6 @@ public class UnifiedGenotyper extends LocusWalker<VariantCallContext, UnifiedGen
|
|||
|
||||
// FORMAT and INFO fields
|
||||
headerInfo.addAll(VCFGenotypeRecord.getSupportedHeaderStrings());
|
||||
headerInfo.add(new VCFInfoHeaderLine(VCFRecord.ALLELE_COUNT_KEY, 1, VCFInfoHeaderLine.INFO_TYPE.Integer, "Allele count in genotypes, for each ALT allele, in the same order as listed"));
|
||||
headerInfo.add(new VCFInfoHeaderLine(VCFRecord.ALLELE_NUMBER_KEY, 1, VCFInfoHeaderLine.INFO_TYPE.Integer, "Total number of alleles in called genotypes"));
|
||||
|
||||
// all of the arguments from the argument collection
|
||||
Set<Object> args = new HashSet<Object>();
|
||||
|
|
|
|||
|
|
@ -34,7 +34,6 @@ import org.broadinstitute.sting.gatk.walkers.RodWalker;
|
|||
import org.broadinstitute.sting.gatk.walkers.annotator.interfaces.AnnotationType;
|
||||
import org.broadinstitute.sting.gatk.walkers.annotator.interfaces.GenotypeAnnotation;
|
||||
import org.broadinstitute.sting.gatk.walkers.annotator.interfaces.InfoFieldAnnotation;
|
||||
import org.broadinstitute.sting.playground.gatk.walkers.annotator.GenomicAnnotation;
|
||||
import org.broadinstitute.sting.utils.GenomeLoc;
|
||||
import org.broadinstitute.sting.utils.StingException;
|
||||
import org.broadinstitute.sting.utils.classloader.PackageUtils;
|
||||
|
|
@ -183,7 +182,7 @@ public class AnnotationByAlleleFrequencyWalker extends RodWalker<Integer, Integ
|
|||
for ( InfoFieldAnnotation annotationType : requestedInfoAnnotations )
|
||||
{
|
||||
|
||||
String key = annotationType.getKeyName();
|
||||
String key = annotationType.getKeyNames().get(0);
|
||||
String value_str = vc_eval.getAttributeAsString(key);
|
||||
System.out.format("%s: %s ", key, value_str);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -10,6 +10,8 @@ import org.broadinstitute.sting.utils.pileup.ReadBackedPileup;
|
|||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.List;
|
||||
import java.util.Arrays;
|
||||
|
||||
/**
|
||||
* IF THERE IS NO JAVADOC RIGHT HERE, YELL AT chartl
|
||||
|
|
@ -19,8 +21,8 @@ import java.util.Map;
|
|||
*/
|
||||
public class InsertSizeDistribution implements InfoFieldAnnotation {
|
||||
private final long INSERT_SIZE_LOWER_BOUND = 500;
|
||||
public String getKeyName() { return "INSIZE"; }
|
||||
public VCFInfoHeaderLine getDescription() { return new VCFInfoHeaderLine(getKeyName(),1,VCFInfoHeaderLine.INFO_TYPE.Integer,"Do not use this if your name is not Chris"); }
|
||||
public List<String> getKeyNames() { return Arrays.asList("INSIZE"); }
|
||||
public List<VCFInfoHeaderLine> getDescriptions() { return Arrays.asList(new VCFInfoHeaderLine(getKeyNames().get(0),1,VCFInfoHeaderLine.INFO_TYPE.Integer,"Do not use this if your name is not Chris")); }
|
||||
|
||||
public Map<String,Object> annotate(RefMetaDataTracker tracker, ReferenceContext ref, Map<String, StratifiedAlignmentContext> context, VariantContext variant) {
|
||||
int weirdInsertSizeReads = 0;
|
||||
|
|
@ -34,7 +36,7 @@ public class InsertSizeDistribution implements InfoFieldAnnotation {
|
|||
}
|
||||
|
||||
Map<String,Object> toReturn = new HashMap<String,Object>();
|
||||
toReturn.put(getKeyName(),String.format("%d",weirdInsertSizeReads));
|
||||
toReturn.put(getKeyNames().get(0),String.format("%d",weirdInsertSizeReads));
|
||||
return toReturn;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -37,6 +37,8 @@ import org.broadinstitute.sting.gatk.contexts.variantcontext.VariantContext;
|
|||
|
||||
import java.util.Map;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Arrays;
|
||||
|
||||
/**
|
||||
* Created by IntelliJ IDEA.
|
||||
|
|
@ -48,11 +50,10 @@ import java.util.HashMap;
|
|||
public class ProportionOfNonrefBasesSupportingSNP implements InfoFieldAnnotation {
|
||||
private String KEY_NAME = "prop_nonref_that_are_snp";
|
||||
|
||||
public String getKeyName() { return KEY_NAME; }
|
||||
public List<String> getKeyNames() { return Arrays.asList(KEY_NAME); }
|
||||
|
||||
public VCFInfoHeaderLine getDescription() {
|
||||
return new VCFInfoHeaderLine(KEY_NAME,
|
||||
1,VCFInfoHeaderLine.INFO_TYPE.Float,"Simple proportion of non-reference bases that are the SNP base");
|
||||
public List<VCFInfoHeaderLine> getDescriptions() {
|
||||
return Arrays.asList(new VCFInfoHeaderLine(KEY_NAME,1,VCFInfoHeaderLine.INFO_TYPE.Float,"Simple proportion of non-reference bases that are the SNP base"));
|
||||
}
|
||||
|
||||
public Map<String, Object> annotate(RefMetaDataTracker tracker, ReferenceContext ref, Map<String, StratifiedAlignmentContext> context, VariantContext vc) {
|
||||
|
|
@ -69,7 +70,7 @@ public class ProportionOfNonrefBasesSupportingSNP implements InfoFieldAnnotation
|
|||
return null;
|
||||
double p = getProportionOfNonrefBasesThatAreSNP(totalNonref_totalSNP);
|
||||
Map<String, Object> map = new HashMap<String, Object>();
|
||||
map.put(getKeyName(), String.format("%f", p ));
|
||||
map.put(getKeyNames().get(0), String.format("%f", p ));
|
||||
return map;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -38,6 +38,8 @@ import org.broadinstitute.sting.gatk.contexts.variantcontext.VariantContext;
|
|||
|
||||
import java.util.Map;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Arrays;
|
||||
|
||||
/**
|
||||
* Created by IntelliJ IDEA.
|
||||
|
|
@ -50,7 +52,7 @@ public class ProportionOfRefSecondBasesSupportingSNP implements InfoFieldAnnotat
|
|||
private String KEY_NAME = "ref_2bb_snp_prop";
|
||||
private boolean USE_MAPQ0_READS = false;
|
||||
|
||||
public String getKeyName() { return KEY_NAME; }
|
||||
public List<String> getKeyNames() { return Arrays.asList(KEY_NAME); }
|
||||
|
||||
public Map<String, Object> annotate(RefMetaDataTracker tracker, ReferenceContext ref, Map<String, StratifiedAlignmentContext> context, VariantContext vc) {
|
||||
if ( ! vc.isSNP() || ! vc.isBiallelic() )
|
||||
|
|
@ -67,7 +69,7 @@ public class ProportionOfRefSecondBasesSupportingSNP implements InfoFieldAnnotat
|
|||
|
||||
double p = getProportionOfRefSecondaryBasesSupportingSNP(totalAndSNPSupporting);
|
||||
Map<String, Object> map = new HashMap<String, Object>();
|
||||
map.put(getKeyName(), String.format("%f", p ));
|
||||
map.put(getKeyNames().get(0), String.format("%f", p ));
|
||||
return map;
|
||||
}
|
||||
|
||||
|
|
@ -94,8 +96,8 @@ public class ProportionOfRefSecondBasesSupportingSNP implements InfoFieldAnnotat
|
|||
return refAndSNPCounts;
|
||||
}
|
||||
|
||||
public VCFInfoHeaderLine getDescription() {
|
||||
return new VCFInfoHeaderLine(KEY_NAME,
|
||||
1,VCFInfoHeaderLine.INFO_TYPE.Float,"Simple proportion of second best base calls for reference base that support the SNP base");
|
||||
public List<VCFInfoHeaderLine> getDescriptions() {
|
||||
return Arrays.asList(new VCFInfoHeaderLine(KEY_NAME,
|
||||
1,VCFInfoHeaderLine.INFO_TYPE.Float,"Simple proportion of second best base calls for reference base that support the SNP base"));
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -38,6 +38,8 @@ import org.broadinstitute.sting.utils.pileup.PileupElement;
|
|||
|
||||
import java.util.Map;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Arrays;
|
||||
|
||||
/**
|
||||
* Created by IntelliJ IDEA.
|
||||
|
|
@ -51,7 +53,7 @@ public class ProportionOfSNPSecondBasesSupportingRef implements InfoFieldAnnotat
|
|||
public boolean USE_MAPQ0_READS = false;
|
||||
public String debug_file = "/humgen/gsa-scr1/chartl/temporary/ProportionOfRefSecondBasesSupportingSNP.debug.txt";
|
||||
|
||||
public String getKeyName() { return KEY_NAME; }
|
||||
public List<String> getKeyNames() { return Arrays.asList(KEY_NAME); }
|
||||
|
||||
public boolean useZeroQualityReads() { return USE_MAPQ0_READS; }
|
||||
|
||||
|
|
@ -70,7 +72,7 @@ public class ProportionOfSNPSecondBasesSupportingRef implements InfoFieldAnnotat
|
|||
|
||||
double p = getProportionOfSNPSecondaryBasesSupportingRef(totalAndSNPSupporting);
|
||||
Map<String, Object> map = new HashMap<String, Object>();
|
||||
map.put(getKeyName(), String.format("%f", p ));
|
||||
map.put(getKeyNames().get(0), String.format("%f", p ));
|
||||
return map;
|
||||
}
|
||||
|
||||
|
|
@ -102,9 +104,9 @@ public class ProportionOfSNPSecondBasesSupportingRef implements InfoFieldAnnotat
|
|||
return BaseUtils.isRegularBase(e.getSecondBase());
|
||||
}
|
||||
|
||||
public VCFInfoHeaderLine getDescription() {
|
||||
return new VCFInfoHeaderLine(KEY_NAME,
|
||||
1,VCFInfoHeaderLine.INFO_TYPE.Float,"Simple proportion of second best base calls for SNP base that support the Ref base");
|
||||
public List<VCFInfoHeaderLine> getDescriptions() {
|
||||
return Arrays.asList(new VCFInfoHeaderLine(KEY_NAME,
|
||||
1,VCFInfoHeaderLine.INFO_TYPE.Float,"Simple proportion of second best base calls for SNP base that support the Ref base"));
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -10,6 +10,8 @@ import org.broadinstitute.sting.oneoffprojects.refdata.HapmapVCFROD;
|
|||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.List;
|
||||
import java.util.Arrays;
|
||||
|
||||
/**
|
||||
* IF THERE IS NO JAVADOC RIGHT HERE, YELL AT chartl
|
||||
|
|
@ -19,13 +21,13 @@ import java.util.Map;
|
|||
*/
|
||||
public class ThousandGenomesAnnotator implements InfoFieldAnnotation {
|
||||
|
||||
public String getKeyName() {
|
||||
return "1KG";
|
||||
public List<String> getKeyNames() {
|
||||
return Arrays.asList("1KG");
|
||||
}
|
||||
|
||||
public VCFInfoHeaderLine getDescription() {
|
||||
return new VCFInfoHeaderLine(getKeyName(),
|
||||
1,VCFInfoHeaderLine.INFO_TYPE.String,"Is this site seen in Pilot1 or Pilot2 of 1KG?");
|
||||
public List<VCFInfoHeaderLine> getDescriptions() {
|
||||
return Arrays.asList(new VCFInfoHeaderLine(getKeyNames().get(0),
|
||||
1,VCFInfoHeaderLine.INFO_TYPE.String,"Is this site seen in Pilot1 or Pilot2 of 1KG?"));
|
||||
}
|
||||
|
||||
public Map<String, Object> annotate(RefMetaDataTracker tracker, ReferenceContext ref, Map<String, StratifiedAlignmentContext> context, VariantContext vc) {
|
||||
|
|
@ -49,7 +51,7 @@ public class ThousandGenomesAnnotator implements InfoFieldAnnotation {
|
|||
}
|
||||
}
|
||||
Map<String, Object> map = new HashMap<String, Object>();
|
||||
map.put(getKeyName(), result);
|
||||
map.put(getKeyNames().get(0), result);
|
||||
return map;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -25,11 +25,7 @@
|
|||
|
||||
package org.broadinstitute.sting.playground.gatk.walkers.annotator;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.*;
|
||||
import java.util.Map.Entry;
|
||||
|
||||
import org.broad.tribble.vcf.VCFInfoHeaderLine;
|
||||
|
|
@ -258,12 +254,12 @@ public class GenomicAnnotation implements InfoFieldAnnotation {
|
|||
|
||||
|
||||
|
||||
public VCFInfoHeaderLine getDescription() {
|
||||
return new VCFInfoHeaderLine("GenericAnnotation", 1, VCFInfoHeaderLine.INFO_TYPE.Integer, "For each variant in the 'variants' ROD, finds all entries in the other -B files that overlap the variant's position. ");
|
||||
public List<VCFInfoHeaderLine> getDescriptions() {
|
||||
return Arrays.asList(new VCFInfoHeaderLine("GenericAnnotation", 1, VCFInfoHeaderLine.INFO_TYPE.Integer, "For each variant in the 'variants' ROD, finds all entries in the other -B files that overlap the variant's position. "));
|
||||
}
|
||||
|
||||
public String getKeyName() {
|
||||
return "GenericAnnotation";
|
||||
public List<String> getKeyNames() {
|
||||
return Arrays.asList("GenericAnnotation");
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -5,7 +5,6 @@ import org.broad.tribble.vcf.VCFHeader;
|
|||
import org.broad.tribble.vcf.VCFHeaderLine;
|
||||
import org.broad.tribble.vcf.VCFRecord;
|
||||
import org.broadinstitute.sting.gatk.contexts.variantcontext.VariantContext;
|
||||
import org.broadinstitute.sting.gatk.contexts.variantcontext.Allele;
|
||||
import org.broadinstitute.sting.gatk.refdata.VariantContextAdaptors;
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
|
|
@ -95,19 +94,6 @@ public class VCFGenotypeWriterAdapter implements VCFGenotypeWriter {
|
|||
|
||||
VCFRecord call = VariantContextAdaptors.toVCF(vc, (byte)refAllele.charAt(0), allowedGenotypeFormatStrings, false, false);
|
||||
|
||||
Set<Allele> altAlleles = vc.getAlternateAlleles();
|
||||
StringBuffer altAlleleCountString = new StringBuffer();
|
||||
for ( Allele allele : altAlleles ) {
|
||||
if ( altAlleleCountString.length() > 0 )
|
||||
altAlleleCountString.append(",");
|
||||
altAlleleCountString.append(vc.getChromosomeCount(allele));
|
||||
}
|
||||
if ( vc.getChromosomeCount() > 0 ) {
|
||||
call.addInfoField(VCFRecord.ALLELE_NUMBER_KEY, String.format("%d", vc.getChromosomeCount()));
|
||||
if ( altAlleleCountString.length() > 0 )
|
||||
call.addInfoField(VCFRecord.ALLELE_COUNT_KEY, altAlleleCountString.toString());
|
||||
}
|
||||
|
||||
mWriter.addRecord(call, validationStringency);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -66,7 +66,7 @@ public class VariantAnnotatorIntegrationTest extends WalkerTest {
|
|||
public void testHasAnnotsAsking1() {
|
||||
WalkerTestSpec spec = new WalkerTestSpec(
|
||||
baseTestString() + " -G \"Standard\" -B variant,VCF," + validationDataLocation + "vcfexample2.vcf -I " + validationDataLocation + "low_coverage_CEU.chr1.10k-11k.bam -L 1:10,020,000-10,021,000", 1,
|
||||
Arrays.asList("a3d781ed67bd80b02eeeba4407af93d1"));
|
||||
Arrays.asList("dff7c888fbd142b6eff27c3233c1292d"));
|
||||
executeTest("test file has annotations, asking for annotations, #1", spec);
|
||||
}
|
||||
|
||||
|
|
@ -74,7 +74,7 @@ public class VariantAnnotatorIntegrationTest extends WalkerTest {
|
|||
public void testHasAnnotsAsking2() {
|
||||
WalkerTestSpec spec = new WalkerTestSpec(
|
||||
baseTestString() + " -G \"Standard\" -B variant,VCF," + validationDataLocation + "vcfexample3.vcf -I " + validationDataLocation + "NA12878.1kg.p2.chr1_10mb_11_mb.SLX.bam -L 1:10,000,000-10,050,000", 1,
|
||||
Arrays.asList("8d57463554486cf077faf190b5af5f2d"));
|
||||
Arrays.asList("45c9d5136900d9ab347f489d6f442bb4"));
|
||||
executeTest("test file has annotations, asking for annotations, #2", spec);
|
||||
}
|
||||
|
||||
|
|
@ -98,7 +98,7 @@ public class VariantAnnotatorIntegrationTest extends WalkerTest {
|
|||
public void testNoAnnotsAsking1() {
|
||||
WalkerTestSpec spec = new WalkerTestSpec(
|
||||
baseTestString() + " -G \"Standard\" -B variant,VCF," + validationDataLocation + "vcfexample2empty.vcf -I " + validationDataLocation + "low_coverage_CEU.chr1.10k-11k.bam -L 1:10,020,000-10,021,000", 1,
|
||||
Arrays.asList("bfbdd00135812778138443ff1c45ac1f"));
|
||||
Arrays.asList("7c13af3226a92bfc3826c37b30f179e0"));
|
||||
executeTest("test file doesn't have annotations, asking for annotations, #1", spec);
|
||||
}
|
||||
|
||||
|
|
@ -106,7 +106,7 @@ public class VariantAnnotatorIntegrationTest extends WalkerTest {
|
|||
public void testNoAnnotsAsking2() {
|
||||
WalkerTestSpec spec = new WalkerTestSpec(
|
||||
baseTestString() + " -G \"Standard\" -B variant,VCF," + validationDataLocation + "vcfexample3empty.vcf -I " + validationDataLocation + "NA12878.1kg.p2.chr1_10mb_11_mb.SLX.bam -L 1:10,000,000-10,050,000", 1,
|
||||
Arrays.asList("9d8b72384e90c5f8f278da9558ac2419"));
|
||||
Arrays.asList("369ad538eacdc0943b58a807d92d823c"));
|
||||
executeTest("test file doesn't have annotations, asking for annotations, #2", spec);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -35,7 +35,7 @@ public class UnifiedGenotyperIntegrationTest extends WalkerTest {
|
|||
public void testMultiSamplePilot1Joint() {
|
||||
WalkerTest.WalkerTestSpec spec = new WalkerTest.WalkerTestSpec(
|
||||
"-T UnifiedGenotyper -R " + oneKGLocation + "reference/human_b36_both.fasta -I " + validationDataLocation + "low_coverage_CEU.chr1.10k-11k.bam -varout %s -L 1:10,022,000-10,025,000", 1,
|
||||
Arrays.asList("4e403194fd00552804a0907bf905cffb"));
|
||||
Arrays.asList("27917d676d6cc89e5b690dc1e982f670"));
|
||||
executeTest("testMultiSamplePilot1 - Joint Estimate", spec);
|
||||
}
|
||||
|
||||
|
|
@ -43,7 +43,7 @@ public class UnifiedGenotyperIntegrationTest extends WalkerTest {
|
|||
public void testMultiSamplePilot2Joint() {
|
||||
WalkerTest.WalkerTestSpec spec = new WalkerTest.WalkerTestSpec(
|
||||
"-T UnifiedGenotyper -R " + oneKGLocation + "reference/human_b36_both.fasta -I " + validationDataLocation + "pilot2_daughters.chr20.10k-11k.bam -varout %s -L 20:10,000,000-10,050,000", 1,
|
||||
Arrays.asList("987aaf0268a364d35e4375bab2d69c9e"));
|
||||
Arrays.asList("1319891457e0d7859a0859de7b9eb59f"));
|
||||
executeTest("testMultiSamplePilot2 - Joint Estimate", spec);
|
||||
}
|
||||
|
||||
|
|
@ -51,7 +51,7 @@ public class UnifiedGenotyperIntegrationTest extends WalkerTest {
|
|||
public void testSingleSamplePilot2Joint() {
|
||||
WalkerTest.WalkerTestSpec spec = new WalkerTest.WalkerTestSpec(
|
||||
"-T UnifiedGenotyper -R " + oneKGLocation + "reference/human_b36_both.fasta -I " + validationDataLocation + "NA12878.1kg.p2.chr1_10mb_11_mb.SLX.bam -varout %s -L 1:10,000,000-10,100,000", 1,
|
||||
Arrays.asList("5ad0d5e8180f5290f511723392a54d03"));
|
||||
Arrays.asList("4157f43949aa2ee514131d7719d51d39"));
|
||||
executeTest("testSingleSamplePilot2 - Joint Estimate", spec);
|
||||
}
|
||||
|
||||
|
|
@ -63,7 +63,7 @@ public class UnifiedGenotyperIntegrationTest extends WalkerTest {
|
|||
|
||||
@Test
|
||||
public void testParallelization() {
|
||||
String md5 = "c7bfe0500e933d1546cb40448d7b4c61";
|
||||
String md5 = "bc96dbb14581f46f6fc751d982cce566";
|
||||
|
||||
WalkerTest.WalkerTestSpec spec1 = new WalkerTest.WalkerTestSpec(
|
||||
"-T UnifiedGenotyper -R " + oneKGLocation + "reference/human_b36_both.fasta -I " + validationDataLocation + "NA12878.1kg.p2.chr1_10mb_11_mb.SLX.bam -varout %s -L 1:10,000,000-10,075,000", 1,
|
||||
|
|
@ -85,11 +85,11 @@ public class UnifiedGenotyperIntegrationTest extends WalkerTest {
|
|||
@Test
|
||||
public void testParameter() {
|
||||
HashMap<String, String> e = new HashMap<String, String>();
|
||||
e.put( "-genotype", "96106a735876dc4ca9aa839610bee56f" );
|
||||
e.put( "-all_bases", "85b7bd300cc6852e25be430dd02e789f" );
|
||||
e.put( "--min_base_quality_score 26", "ecc1b0dd618eae9b9f62db2742ac3306" );
|
||||
e.put( "--min_mapping_quality_score 26", "75bd53d5070f1146350d633321a165e3" );
|
||||
e.put( "--max_mismatches_in_40bp_window 5", "8e1236b7f0f6c19a0be808b2d44e3255" );
|
||||
e.put( "-genotype", "0f6b11868a057db246145c98119cb8f7" );
|
||||
e.put( "-all_bases", "e45b5efc4aa285a7cebfb771da49ebe2" );
|
||||
e.put( "--min_base_quality_score 26", "a132bdcd9300b6483f78bd34d99bd794" );
|
||||
e.put( "--min_mapping_quality_score 26", "edce61eba0e6e65156452fe3476d6cfc" );
|
||||
e.put( "--max_mismatches_in_40bp_window 5", "56d3c59532b6e81e835f55bc1135f990" );
|
||||
|
||||
for ( Map.Entry<String, String> entry : e.entrySet() ) {
|
||||
WalkerTest.WalkerTestSpec spec = new WalkerTest.WalkerTestSpec(
|
||||
|
|
@ -103,12 +103,12 @@ public class UnifiedGenotyperIntegrationTest extends WalkerTest {
|
|||
public void testConfidence() {
|
||||
WalkerTest.WalkerTestSpec spec1 = new WalkerTest.WalkerTestSpec(
|
||||
"-T UnifiedGenotyper -R " + oneKGLocation + "reference/human_b36_both.fasta -I " + validationDataLocation + "NA12878.1kg.p2.chr1_10mb_11_mb.SLX.bam -varout %s -L 1:10,000,000-10,010,000 -stand_call_conf 10 ", 1,
|
||||
Arrays.asList("ff8a1008ddfd342a20b3e032bade61bc"));
|
||||
Arrays.asList("522f67194bf1849115775b3c24f8fcf1"));
|
||||
executeTest("testConfidence1", spec1);
|
||||
|
||||
WalkerTest.WalkerTestSpec spec2 = new WalkerTest.WalkerTestSpec(
|
||||
"-T UnifiedGenotyper -R " + oneKGLocation + "reference/human_b36_both.fasta -I " + validationDataLocation + "NA12878.1kg.p2.chr1_10mb_11_mb.SLX.bam -varout %s -L 1:10,000,000-10,010,000 -stand_emit_conf 10 ", 1,
|
||||
Arrays.asList("d469b4367188dd2b9be37ab8effc65c4"));
|
||||
Arrays.asList("226ca8079db4e46a61367db49bac8b2b"));
|
||||
executeTest("testConfidence2", spec2);
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue