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
This commit is contained in:
ebanks 2010-04-22 18:34:41 +00:00
parent 121163dd49
commit 8c94df6f00
1 changed files with 11 additions and 3 deletions

View File

@ -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);
}