use of com.github.lindenb.jvarkit.tools.vcffilterso.VcfFilterSequenceOntology in project jvarkit by lindenb.
the class TestNg01 method testVcfFilterSo.
@Test
public void testVcfFilterSo() throws IOException {
File output = new File(TEST_RESULTS_DIR, "jeter.filrerso.vcf");
final AnnPredictionParser parser = new AnnPredictionParserFactory().createDefaultParser();
final SequenceOntologyTree tree = SequenceOntologyTree.getInstance();
String acn = "SO:0001583";
final SequenceOntologyTree.Term term = tree.getTermByAcn(acn);
final Set<SequenceOntologyTree.Term> terms = term.getAllDescendants();
Assert.assertNotNull(term);
Assert.assertTrue(terms.size() > 1);
Assert.assertTrue(terms.contains(term));
Assert.assertEquals(0, new VcfFilterSequenceOntology().instanceMain(new String[] { "-o", output.getPath(), "-A", acn, VCF01 }));
streamVcf(output).forEach(V -> {
// System.err.println(V.getAttribute("ANN")+" vs "+ terms);
Assert.assertTrue(parser.getPredictions(V).stream().flatMap(P -> P.getSOTerms().stream()).anyMatch(T -> terms.contains(T)));
});
Assert.assertEquals(0, new VcfFilterSequenceOntology().instanceMain(new String[] { "-o", output.getPath(), "-A", acn, "--rmatt", "--invert", VCF01 }));
streamVcf(output).forEach(V -> {
Assert.assertFalse(parser.getPredictions(V).stream().flatMap(P -> P.getSOTerms().stream()).anyMatch(T -> terms.contains(T)));
});
Assert.assertEquals(0, new VcfFilterSequenceOntology().instanceMain(new String[] { "-o", output.getPath(), "-A", acn, "--rmatt", VCF01 }));
Assert.assertTrue(streamVcf(output).findAny().isPresent());
Assert.assertTrue(output.delete());
}
Aggregations