Fixing a VCF bug for Sendu: we weren't emitting flags (booleans) correctly in VCF3.3 (rev'ed tribble for this).
Updated dbsnp/hapmap membership info fields to be flags now instead of ints. While I was there, I added the change in the Annotator for Jan to force reads to be from a specific sample. git-svn-id: file:///humgen/gsa-scr1/gsa-engineering/svn_contents/trunk@3536 348d0f76-0448-11de-a6fe-93d51630548a
This commit is contained in:
parent
dde93e743f
commit
8c28be5933
|
|
@ -383,6 +383,8 @@ public class VariantContextAdaptors {
|
|||
result = VCFGenotypeRecord.getMissingFieldValue(key);
|
||||
else if ( val instanceof Double )
|
||||
result = String.format("%.2f", (Double)val);
|
||||
else if ( val instanceof Boolean )
|
||||
result = (Boolean)val ? "" : null; // empty string for true, null for false
|
||||
else if ( val instanceof List ) {
|
||||
List list = (List)val;
|
||||
if ( list.size() == 0 )
|
||||
|
|
|
|||
|
|
@ -73,6 +73,9 @@ public class VariantAnnotator extends RodWalker<Integer, Integer> {
|
|||
@Argument(fullName="list", shortName="ls", doc="List the available annotations and exit")
|
||||
protected Boolean LIST = false;
|
||||
|
||||
@Argument(fullName = "assume_single_sample_reads", shortName = "single_sample", doc = "The single sample that we should assume is represented in the input bam (and therefore associate with all reads regardless of whether they have read groups)", required = false)
|
||||
protected String ASSUME_SINGLE_SAMPLE = null;
|
||||
|
||||
@Argument(fullName="vcfContainsOnlyIndels", shortName="dels",doc="Use if you are annotating an indel vcf, currently VERY experimental", required = false)
|
||||
protected boolean indelsOnly = false;
|
||||
|
||||
|
|
@ -196,9 +199,9 @@ public class VariantAnnotator extends RodWalker<Integer, Integer> {
|
|||
Map<String, StratifiedAlignmentContext> stratifiedContexts;
|
||||
if ( BaseUtils.simpleBaseToBaseIndex(ref.getBase()) != -1 ) {
|
||||
if ( ! context.hasExtendedEventPileup() ) {
|
||||
stratifiedContexts = StratifiedAlignmentContext.splitContextBySample(context.getBasePileup());
|
||||
stratifiedContexts = StratifiedAlignmentContext.splitContextBySample(context.getBasePileup(), ASSUME_SINGLE_SAMPLE, null);
|
||||
} else {
|
||||
stratifiedContexts = StratifiedAlignmentContext.splitContextBySample(context.getExtendedEventPileup());
|
||||
stratifiedContexts = StratifiedAlignmentContext.splitContextBySample(context.getExtendedEventPileup(), ASSUME_SINGLE_SAMPLE, null);
|
||||
}
|
||||
if ( stratifiedContexts != null ) {
|
||||
annotatedVCs = engine.annotateContext(tracker, ref, stratifiedContexts, vc);
|
||||
|
|
@ -206,7 +209,6 @@ public class VariantAnnotator extends RodWalker<Integer, Integer> {
|
|||
}
|
||||
|
||||
if ( ! indelsOnly ) {
|
||||
|
||||
if ( variant instanceof VCFRecord ) {
|
||||
for(VariantContext annotatedVC : annotatedVCs ) {
|
||||
vcfWriter.addRecord(VariantContextAdaptors.toVCF(annotatedVC, ref.getBase()));
|
||||
|
|
|
|||
|
|
@ -186,11 +186,11 @@ public class VariantAnnotatorEngine {
|
|||
for ( GenotypeAnnotation annotation : requestedGenotypeAnnotations )
|
||||
descriptions.addAll(annotation.getDescriptions());
|
||||
if ( annotateDbsnp )
|
||||
descriptions.add(new VCFInfoHeaderLine(VCFRecord.DBSNP_KEY, 1, VCFInfoHeaderLine.INFO_TYPE.Integer, "dbSNP Membership"));
|
||||
descriptions.add(new VCFInfoHeaderLine(VCFRecord.DBSNP_KEY, 1, VCFInfoHeaderLine.INFO_TYPE.Flag, "dbSNP Membership"));
|
||||
if ( annotateHapmap2 )
|
||||
descriptions.add(new VCFInfoHeaderLine(VCFRecord.HAPMAP2_KEY, 1, VCFInfoHeaderLine.INFO_TYPE.Integer, "Hapmap 2 Membership"));
|
||||
descriptions.add(new VCFInfoHeaderLine(VCFRecord.HAPMAP2_KEY, 1, VCFInfoHeaderLine.INFO_TYPE.Flag, "Hapmap 2 Membership"));
|
||||
if ( annotateHapmap3 )
|
||||
descriptions.add(new VCFInfoHeaderLine(VCFRecord.HAPMAP3_KEY, 1, VCFInfoHeaderLine.INFO_TYPE.Integer, "Hapmap 3 Membership"));
|
||||
descriptions.add(new VCFInfoHeaderLine(VCFRecord.HAPMAP3_KEY, 1, VCFInfoHeaderLine.INFO_TYPE.Flag, "Hapmap 3 Membership"));
|
||||
|
||||
return descriptions;
|
||||
}
|
||||
|
|
@ -202,7 +202,7 @@ public class VariantAnnotatorEngine {
|
|||
// annotate dbsnp occurrence
|
||||
if ( annotateDbsnp ) {
|
||||
DbSNPFeature dbsnp = DbSNPHelper.getFirstRealSNP(tracker.getReferenceMetaData(DbSNPHelper.STANDARD_DBSNP_TRACK_NAME));
|
||||
infoAnnotations.put(VCFRecord.DBSNP_KEY, dbsnp == null ? "0" : "1");
|
||||
infoAnnotations.put(VCFRecord.DBSNP_KEY, dbsnp == null ? false : true);
|
||||
// annotate dbsnp id if available and not already there
|
||||
if ( dbsnp != null && (!vc.hasAttribute("ID") || vc.getAttribute("ID").equals(VCFRecord.EMPTY_ID_FIELD)) )
|
||||
infoAnnotations.put("ID", dbsnp.getRsID());
|
||||
|
|
@ -210,12 +210,12 @@ public class VariantAnnotatorEngine {
|
|||
|
||||
if ( annotateHapmap2 ) {
|
||||
List<Object> hapmap2 = tracker.getReferenceMetaData("hapmap2");
|
||||
infoAnnotations.put(VCFRecord.HAPMAP2_KEY, hapmap2.size() == 0 ? "0" : "1");
|
||||
infoAnnotations.put(VCFRecord.HAPMAP2_KEY, hapmap2.size() == 0 ? false : true);
|
||||
}
|
||||
|
||||
if ( annotateHapmap3 ) {
|
||||
List<Object> hapmap3 = tracker.getReferenceMetaData("hapmap3");
|
||||
infoAnnotations.put(VCFRecord.HAPMAP3_KEY, hapmap3.size() == 0 ? "0" : "1");
|
||||
infoAnnotations.put(VCFRecord.HAPMAP3_KEY, hapmap3.size() == 0 ? false : true);
|
||||
}
|
||||
|
||||
//Process the info field
|
||||
|
|
|
|||
|
|
@ -113,8 +113,16 @@ public class VariantAnnotatorIntegrationTest extends WalkerTest {
|
|||
@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,
|
||||
baseTestString() + " -G \"Standard\" -B variant,VCF," + validationDataLocation + "vcfexample3empty.vcf -BTI variant", 1,
|
||||
Arrays.asList("07af9983127c62e96accc03db2fb523e"));
|
||||
executeTest("test file doesn't have annotations, not passing it any reads", spec);
|
||||
executeTest("not passing it any reads", spec);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testDBTag() {
|
||||
WalkerTestSpec spec = new WalkerTestSpec(
|
||||
baseTestString() + " -D " + GATKDataLocation + "dbsnp_129_b36.rod -G \"Standard\" -B variant,VCF," + validationDataLocation + "vcfexample3empty.vcf -BTI variant", 1,
|
||||
Arrays.asList("286887826ab99bb2864f7f4db195e59e"));
|
||||
executeTest("getting DB tag", spec);
|
||||
}
|
||||
}
|
||||
|
|
@ -26,7 +26,7 @@ public class GenomicAnnotatorIntegrationTest extends WalkerTest {
|
|||
*/
|
||||
|
||||
|
||||
String[] md5WithDashSArg = {"fb6f52b72610a4f6bcf4c130ec14705a"};
|
||||
String[] md5WithDashSArg = {"35dffbdb99dbf480f4bc5169219bcfc1"};
|
||||
WalkerTestSpec specWithSArg = new WalkerTestSpec(
|
||||
"-T GenomicAnnotator -R " + oneKGLocation + "reference/human_b36_both.fasta " +
|
||||
"-B variant,vcf,/humgen/gsa-hpprojects/GATK/data/Annotations/examples/CEU_hapmap_nogt_23_subset.vcf " +
|
||||
|
|
|
|||
Binary file not shown.
|
|
@ -1,3 +1,3 @@
|
|||
<ivy-module version="1.0">
|
||||
<info organisation="org.broad" module="tribble" revision="102" status="integration" publication="201006101154200" />
|
||||
<info organisation="org.broad" module="tribble" revision="103" status="integration" publication="201006101154200" />
|
||||
</ivy-module>
|
||||
Loading…
Reference in New Issue