Test to ensure that ConcordanceTruthTable and those walkers which rely on it for tabulating pooled truth information from truth information of the individuals within the pool is doing that calculation correctly. Tests single het, single hom (with/without reference), together, together without reference, and a mix of everything.
git-svn-id: file:///humgen/gsa-scr1/gsa-engineering/svn_contents/trunk@2082 348d0f76-0448-11de-a6fe-93d51630548a
This commit is contained in:
parent
eeb3a3fffb
commit
b3872386c9
|
|
@ -0,0 +1,94 @@
|
|||
package org.broadinstitute.sting.playground.gatk.walkers;
|
||||
|
||||
import org.junit.Test;
|
||||
import org.junit.Assert;
|
||||
import org.broadinstitute.sting.utils.genotype.Genotype;
|
||||
import org.broadinstitute.sting.utils.genotype.BasicGenotype;
|
||||
import org.broadinstitute.sting.utils.GenomeLoc;
|
||||
import org.broadinstitute.sting.utils.Pair;
|
||||
import org.broadinstitute.sting.playground.gatk.walkers.varianteval.ConcordanceTruthTable;
|
||||
import org.broadinstitute.sting.BaseTest;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.ArrayList;
|
||||
|
||||
/**
|
||||
* Created by IntelliJ IDEA.
|
||||
* User: chartl
|
||||
* Date: Nov 19, 2009
|
||||
* Time: 9:40:51 AM
|
||||
* To change this template use File | Settings | File Templates.
|
||||
*/
|
||||
public class ConcordanceTruthTableTest extends BaseTest {
|
||||
|
||||
@Test
|
||||
public void testAlleleFrequencyCalculation() {
|
||||
|
||||
ConcordanceTruthTable ctt = new ConcordanceTruthTable(3);
|
||||
// this will test the count of non-reference alleles at a T/G polymorphic site
|
||||
Genotype ref1 = new BasicGenotype(null,"GG",'G',30);
|
||||
Genotype ref2 = new BasicGenotype(null,"GG",'G',30);
|
||||
Genotype ref3 = new BasicGenotype(null,"GG",'G',30);
|
||||
Genotype het1 = new BasicGenotype(null,"GT",'G',32);
|
||||
Genotype het2 = new BasicGenotype(null,"GT",'G',28);
|
||||
Genotype hom1 = new BasicGenotype(null,"TT",'G',40);
|
||||
Genotype hom2 = new BasicGenotype(null,"TT",'G',27);
|
||||
|
||||
List<Pair<Genotype,Genotype>> oneHom = new ArrayList<Pair<Genotype,Genotype>>(4);
|
||||
oneHom.add(new Pair<Genotype,Genotype>(ref1,null));
|
||||
oneHom.add(new Pair<Genotype,Genotype>(ref2,null));
|
||||
oneHom.add(new Pair<Genotype,Genotype>(ref3,null));
|
||||
oneHom.add(new Pair<Genotype,Genotype>(hom2,null));
|
||||
|
||||
List<Pair<Genotype,Genotype>> oneHet = new ArrayList<Pair<Genotype,Genotype>>(4);
|
||||
oneHet.add(new Pair<Genotype,Genotype>(ref1,null));
|
||||
oneHet.add(new Pair<Genotype,Genotype>(ref2,null));
|
||||
oneHet.add(new Pair<Genotype,Genotype>(ref3,null));
|
||||
oneHet.add(new Pair<Genotype,Genotype>(het1,null));
|
||||
|
||||
List<Pair<Genotype,Genotype>> twoHetOneHom = new ArrayList<Pair<Genotype,Genotype>>(5);
|
||||
twoHetOneHom.add(new Pair<Genotype,Genotype>(ref1,null));
|
||||
twoHetOneHom.add(new Pair<Genotype,Genotype>(ref2,null));
|
||||
twoHetOneHom.add(new Pair<Genotype,Genotype>(ref3,null));
|
||||
twoHetOneHom.add(new Pair<Genotype,Genotype>(het1,null));
|
||||
twoHetOneHom.add(new Pair<Genotype,Genotype>(het2,null));
|
||||
twoHetOneHom.add(new Pair<Genotype,Genotype>(hom1,null));
|
||||
|
||||
List<Pair<Genotype,Genotype>> twoHetTwoHom = new ArrayList<Pair<Genotype,Genotype>>(7);
|
||||
twoHetTwoHom.add(new Pair<Genotype,Genotype>(ref1,null));
|
||||
twoHetTwoHom.add(new Pair<Genotype,Genotype>(ref2,null));
|
||||
twoHetTwoHom.add(new Pair<Genotype,Genotype>(ref3,null));
|
||||
twoHetTwoHom.add(new Pair<Genotype,Genotype>(het1,null));
|
||||
twoHetTwoHom.add(new Pair<Genotype,Genotype>(het2,null));
|
||||
twoHetTwoHom.add(new Pair<Genotype,Genotype>(hom1,null));
|
||||
twoHetTwoHom.add(new Pair<Genotype,Genotype>(hom2,null));
|
||||
|
||||
List<Pair<Genotype,Genotype>> hetHomNoRef = new ArrayList<Pair<Genotype,Genotype>>(2);
|
||||
hetHomNoRef.add(new Pair<Genotype,Genotype>(het2,null));
|
||||
hetHomNoRef.add(new Pair<Genotype,Genotype>(hom2,null));
|
||||
|
||||
List<Pair<Genotype,Genotype>> homNoRef = new ArrayList<Pair<Genotype,Genotype>>(1);
|
||||
homNoRef.add(new Pair<Genotype,Genotype>(hom1,null));
|
||||
|
||||
Pair<Genotype,Integer> countShouldBeOne = ctt.getPooledAlleleFrequency(oneHet,'G');
|
||||
Pair<Genotype,Integer> countShouldBeTwo = ctt.getPooledAlleleFrequency(oneHom,'G');
|
||||
Pair<Genotype,Integer> countShouldBeFour = ctt.getPooledAlleleFrequency(twoHetOneHom,'G');
|
||||
Pair<Genotype,Integer> countShouldBeSix = ctt.getPooledAlleleFrequency(twoHetTwoHom,'G');
|
||||
Pair<Genotype,Integer> countShouldBeThree = ctt.getPooledAlleleFrequency(hetHomNoRef,'G');
|
||||
Pair<Genotype,Integer> countShouldBeTwoHereToo = ctt.getPooledAlleleFrequency(homNoRef, 'G');
|
||||
|
||||
|
||||
logger.warn("Testing single het");
|
||||
Assert.assertTrue(countShouldBeOne.getSecond() == 1);
|
||||
logger.warn("Testing single hom");
|
||||
Assert.assertTrue(countShouldBeTwo.getSecond() == 2);
|
||||
logger.warn("Testing two hets + hom");
|
||||
Assert.assertTrue(countShouldBeFour.getSecond() == 4);
|
||||
logger.warn("Testing two hets + two homs");
|
||||
Assert.assertTrue(countShouldBeSix.getSecond() == 6);
|
||||
logger.warn("Testing het + hom without ref");
|
||||
Assert.assertTrue(countShouldBeThree.getSecond() == 3);
|
||||
logger.warn("Testing hom without ref");
|
||||
Assert.assertTrue(countShouldBeTwoHereToo.getSecond() == 2);
|
||||
}
|
||||
}
|
||||
Loading…
Reference in New Issue