ensure that in the indel case we don't allow identification as both an insertion and deletion at the same location in the VCF ROD
git-svn-id: file:///humgen/gsa-scr1/gsa-engineering/svn_contents/trunk@1875 348d0f76-0448-11de-a6fe-93d51630548a
This commit is contained in:
parent
3d50c72d74
commit
cfa86d52c2
|
|
@ -77,6 +77,10 @@ public class RodVCF extends BasicReferenceOrderedDatum implements VariationRod,
|
|||
return vcf;
|
||||
}
|
||||
|
||||
public void assertBiAllelic() {
|
||||
if (!this.isBiallelic()) throw new StingException("We're not bi-allelic.");
|
||||
}
|
||||
|
||||
/**
|
||||
* get the frequency of this variant
|
||||
*
|
||||
|
|
@ -116,8 +120,7 @@ public class RodVCF extends BasicReferenceOrderedDatum implements VariationRod,
|
|||
@Override
|
||||
public boolean isSNP() {
|
||||
this.assertNotNull();
|
||||
if (!mCurrentRecord.hasAlternateAllele())
|
||||
return false;
|
||||
assertBiAllelic();
|
||||
for (VCFGenotypeEncoding alt : this.mCurrentRecord.getAlternateAlleles()) {
|
||||
if (alt.getType() != VCFGenotypeEncoding.TYPE.SINGLE_BASE)
|
||||
return false;
|
||||
|
|
@ -133,6 +136,7 @@ public class RodVCF extends BasicReferenceOrderedDatum implements VariationRod,
|
|||
@Override
|
||||
public boolean isInsertion() {
|
||||
this.assertNotNull();
|
||||
assertBiAllelic();
|
||||
if (!mCurrentRecord.hasAlternateAllele())
|
||||
return false;
|
||||
for (VCFGenotypeEncoding alt : this.mCurrentRecord.getAlternateAlleles()) {
|
||||
|
|
@ -150,6 +154,7 @@ public class RodVCF extends BasicReferenceOrderedDatum implements VariationRod,
|
|||
@Override
|
||||
public boolean isDeletion() {
|
||||
this.assertNotNull();
|
||||
assertBiAllelic();
|
||||
if (!mCurrentRecord.hasAlternateAllele())
|
||||
return false;
|
||||
for (VCFGenotypeEncoding alt : this.mCurrentRecord.getAlternateAlleles()) {
|
||||
|
|
|
|||
|
|
@ -113,7 +113,7 @@ public class RodVCFTest extends BaseTest {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void testType() {
|
||||
public void testInsertion() {
|
||||
RodVCF vcf = getVCFObject();
|
||||
Iterator<RodVCF> iter = vcf.createIterator("VCF", vcfFile);
|
||||
RodVCF rec = iter.next();
|
||||
|
|
@ -123,10 +123,24 @@ public class RodVCFTest extends BaseTest {
|
|||
rec = iter.next();
|
||||
rec = iter.next();
|
||||
Assert.assertTrue(rec.isIndel());
|
||||
Assert.assertTrue(rec.isInsertion());
|
||||
Assert.assertTrue(rec.isDeletion());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testDeletion() {
|
||||
RodVCF vcf = getVCFObject();
|
||||
Iterator<RodVCF> iter = vcf.createIterator("VCF", vcfFile);
|
||||
RodVCF rec = iter.next();
|
||||
Assert.assertTrue(rec.isSNP());
|
||||
rec = iter.next();
|
||||
rec = iter.next();
|
||||
rec = iter.next();
|
||||
rec = iter.next();
|
||||
rec = iter.next();
|
||||
|
||||
Assert.assertTrue(rec.isIndel());
|
||||
Assert.assertTrue(rec.isInsertion());
|
||||
}
|
||||
@Test
|
||||
public void testGetGenotypes() {
|
||||
RodVCF vcf = getVCFObject();
|
||||
|
|
|
|||
|
|
@ -22,7 +22,7 @@ public class VCFReaderTest extends BaseTest {
|
|||
counter++;
|
||||
reader.next();
|
||||
}
|
||||
Assert.assertEquals(5, counter);
|
||||
Assert.assertEquals(6, counter);
|
||||
}
|
||||
|
||||
@Test
|
||||
|
|
|
|||
Loading…
Reference in New Issue