From 8c94df6f00537ac0c8e516bd8addf6dec8be706f Mon Sep 17 00:00:00 2001 From: ebanks Date: Thu, 22 Apr 2010 18:34:41 +0000 Subject: [PATCH] Bug fix for Chris: deal with sites that have "semi-deletions" git-svn-id: file:///humgen/gsa-scr1/gsa-engineering/svn_contents/trunk@3241 348d0f76-0448-11de-a6fe-93d51630548a --- .../sting/gatk/refdata/VariantContextAdaptors.java | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/java/src/org/broadinstitute/sting/gatk/refdata/VariantContextAdaptors.java b/java/src/org/broadinstitute/sting/gatk/refdata/VariantContextAdaptors.java index 8fb9f9ba3..a519f9db1 100755 --- a/java/src/org/broadinstitute/sting/gatk/refdata/VariantContextAdaptors.java +++ b/java/src/org/broadinstitute/sting/gatk/refdata/VariantContextAdaptors.java @@ -171,13 +171,21 @@ public class VariantContextAdaptors { Allele refAllele = determineRefAllele(vcf, ref); alleles.add(refAllele); - for ( String alt : vcf.getAlternateAlleleList() ) { - if ( ! Allele.acceptableAlleleBases(alt) ) { + for ( VCFGenotypeEncoding alt : vcf.getAlternateAlleles() ) { + if ( ! Allele.acceptableAlleleBases(alt.getBases()) ) { //System.out.printf("Excluding vcf record %s%n", vcf); return null; } - Allele allele = new Allele(alt, false); + Allele allele; + // special case: semi-deletion + if ( vcf.isDeletion() && refAllele.length() > alt.getLength() ) { + char[] semiDeletion = new char[refAllele.length() - alt.getLength()]; + System.arraycopy(ref.getBases(), alt.getLength(), semiDeletion, 0, refAllele.length() - alt.getLength()); + allele = new Allele(String.valueOf(semiDeletion), false); + } else { + allele = new Allele(alt.getBases(), false); + } if ( ! allele.isNoCall() ) alleles.add(allele); }