use of org.broadinstitute.hellbender.utils.SimpleInterval in project gatk by broadinstitute.
the class TargetUnitTest method testEquals.
@Test()
public void testEquals() {
final Target subject1 = new Target("my-name");
final Target subject1bis = new Target("my-name", new SimpleInterval("1", 1, 2));
final Target subject1tris = new Target("my-name", new SimpleInterval("2", 1, 2));
final Target subject2 = new Target("other-name");
Assert.assertTrue(subject1.equals(subject1bis));
Assert.assertTrue(subject1.equals(subject1tris));
Assert.assertTrue(subject1bis.equals(subject1));
Assert.assertTrue(subject1bis.equals(subject1tris));
Assert.assertTrue(subject1tris.equals(subject1));
Assert.assertTrue(subject1tris.equals(subject1bis));
Assert.assertTrue(subject1.equals(subject1));
Assert.assertTrue(subject1bis.equals(subject1bis));
Assert.assertTrue(subject1tris.equals(subject1tris));
Assert.assertTrue(subject2.equals(subject2));
Assert.assertFalse(subject1.equals(null));
Assert.assertFalse(subject1.equals(subject2));
Assert.assertFalse(subject2.equals(subject1));
Assert.assertFalse(subject1bis.equals(subject2));
Assert.assertFalse(subject2.equals(subject1bis));
Assert.assertFalse(subject1tris.equals(subject2));
Assert.assertFalse(subject2.equals(subject1tris));
}
use of org.broadinstitute.hellbender.utils.SimpleInterval in project gatk by broadinstitute.
the class TargetUnitTest method testGetStartWithInterval.
@Test()
public void testGetStartWithInterval() {
final Target subject = new Target("my-name", new SimpleInterval("1", 1, 2));
Assert.assertEquals(subject.getStart(), 1);
}
use of org.broadinstitute.hellbender.utils.SimpleInterval in project gatk by broadinstitute.
the class TargetUnitTest method testGetContigWithInterval.
@Test()
public void testGetContigWithInterval() {
final Target subject = new Target("my-name", new SimpleInterval("1", 1, 2));
Assert.assertEquals(subject.getContig(), "1");
}
use of org.broadinstitute.hellbender.utils.SimpleInterval in project gatk by broadinstitute.
the class ReferenceBasesUnitTest method test.
@Test
public void test() {
final File refFasta = new File(b37_reference_20_21);
final ReferenceDataSource refDataSource = new ReferenceFileSource(refFasta);
final ReferenceContext ref = new ReferenceContext(refDataSource, new SimpleInterval("20", 10_000_000, 10_000_200));
final VariantContext vc = new VariantContextBuilder("source", "20", 10_000_100, 10_000_100, Collections.singleton(Allele.create((byte) 'A', true))).make();
final String refBases = (String) new ReferenceBases().annotate(ref, vc, null).get(ReferenceBases.REFERENCE_BASES_KEY);
Assert.assertEquals(refBases, "ACTGCATCCCTTGCATTTCC");
}
use of org.broadinstitute.hellbender.utils.SimpleInterval in project gatk by broadinstitute.
the class VariantAnnotatorEngineUnitTest method testCoverageAnnotationOnDbSnpSite.
@Test
public void testCoverageAnnotationOnDbSnpSite() throws Exception {
final List<String> annotationGroupsToUse = Collections.emptyList();
//good one
final List<String> annotationsToUse = Arrays.asList(Coverage.class.getSimpleName());
final List<String> annotationsToExclude = Collections.emptyList();
final String path = publicTestDir + "Homo_sapiens_assembly19.dbsnp135.chr1_1M.exome_intervals.vcf";
final FeatureInput<VariantContext> dbSNPBinding = new FeatureInput<>(path, "dbsnp", Collections.emptyMap());
final List<FeatureInput<VariantContext>> features = Collections.emptyList();
final VariantAnnotatorEngine vae = VariantAnnotatorEngine.ofSelectedMinusExcluded(annotationGroupsToUse, annotationsToUse, annotationsToExclude, dbSNPBinding, features);
final Set<VCFHeaderLine> vcfAnnotationDescriptions = vae.getVCFAnnotationDescriptions();
Assert.assertTrue(vcfAnnotationDescriptions.contains(VCFStandardHeaderLines.getInfoLine(VCFConstants.DBSNP_KEY)));
final int alt = 5;
final int ref = 3;
final SimpleInterval loc = new SimpleInterval("1", 69428, 69428);
final VariantContext vcRS = new FeatureDataSource<VariantContext>(path, null, 0, VariantContext.class).query(loc).next();
final Allele refAllele = vcRS.getReference();
final Allele altAllele = vcRS.getAlternateAllele(0);
final VariantContext vcToAnnotate = makeVC(refAllele, altAllele, loc);
final ReadLikelihoods<Allele> likelihoods = makeReadLikelihoods(ref, alt, refAllele, altAllele, loc.getContig(), loc.getStart() - 5);
final FeatureContext featureContext = when(mock(FeatureContext.class).getValues(dbSNPBinding, loc.getStart())).thenReturn(Arrays.<VariantContext>asList(vcRS)).getMock();
final VariantContext resultVC = vae.annotateContext(vcToAnnotate, featureContext, null, likelihoods, a -> true);
Assert.assertEquals(resultVC.getCommonInfo().getAttribute(VCFConstants.DEPTH_KEY), String.valueOf(ref + alt));
Assert.assertEquals(resultVC.getID(), vcRS.getID());
}
Aggregations