From 551ce9130fa7d19b955c0cedca905557ceb44a55 Mon Sep 17 00:00:00 2001 From: asivache Date: Sat, 4 Apr 2009 21:31:16 +0000 Subject: [PATCH] added isBiallelic() to the AllelicVariant interface and to rodDbSNP implementation. We probably don't really know how to deal with non-biallelic sites just as yet... git-svn-id: file:///humgen/gsa-scr1/gsa-engineering/svn_contents/trunk@294 348d0f76-0448-11de-a6fe-93d51630548a --- .../broadinstitute/sting/gatk/refdata/AllelicVariant.java | 8 ++++++++ .../org/broadinstitute/sting/gatk/refdata/rodDbSNP.java | 6 ++++++ 2 files changed, 14 insertions(+) diff --git a/java/src/org/broadinstitute/sting/gatk/refdata/AllelicVariant.java b/java/src/org/broadinstitute/sting/gatk/refdata/AllelicVariant.java index 720f5bc09..99160d2e0 100644 --- a/java/src/org/broadinstitute/sting/gatk/refdata/AllelicVariant.java +++ b/java/src/org/broadinstitute/sting/gatk/refdata/AllelicVariant.java @@ -119,4 +119,12 @@ public interface AllelicVariant extends Comparable { * @return */ int getPloidy() throws IllegalStateException; + + /** Returns true if the site has at most two known or observed alleles (ref and non-ref), or false if there are > 2 allelic variants known or observed. When + * the implementing class is a genotype, alleles should be always counted including the reference allele whether it was observed in the particular + * individual or not: i.e. if the reference is 'C', then both 'CA' and 'AA' genotypes must be reported as bi-allelic, while 'AT' is not bi-allelic (since there are + * two allelic variants, 'A' and 'T' in addition to the (known) reference variant 'C'). + * @return + */ + boolean isBiallelic() ; } diff --git a/java/src/org/broadinstitute/sting/gatk/refdata/rodDbSNP.java b/java/src/org/broadinstitute/sting/gatk/refdata/rodDbSNP.java index 286b02b31..d62c9d067 100644 --- a/java/src/org/broadinstitute/sting/gatk/refdata/rodDbSNP.java +++ b/java/src/org/broadinstitute/sting/gatk/refdata/rodDbSNP.java @@ -222,4 +222,10 @@ public class rodDbSNP extends ReferenceOrderedDatum implements AllelicVariant { // TODO Auto-generated method stub return false; } + + @Override + public boolean isBiallelic() { + // TODO Auto-generated method stub + return observed.indexOf('/')==observed.lastIndexOf('/'); + } }