SIFSearcher { public SIFSearcher(SIFType... types) { this(null, types); } SIFSearcher(SIFType... types);  SIFSearcher(SIFMiner... miners);  SIFSearcher(IDFetcher idFetcher, SIFType... types);  SIFSearcher(IDFetcher idFetcher, SIFMiner... miners); void setBlacklist(Blacklist blacklist); AdjacencyMatrix searchSIFGetMatrix(Model model); Set<SIFInteraction> searchSIF(final Model model); boolean searchSIF(Model model, OutputStream out); boolean searchSIF(Model model, OutputStream out, SIFToText stt);  }
@Test public void testSIFSearcher() throws IOException { final SIFType[] sifTypes = new SIFType[]{SIFEnum.IN_COMPLEX_WITH}; final SIFSearcher commonSifSearcher = new SIFSearcher(null, sifTypes); final SIFSearcher simpleSifSearcher = new SIFSearcher(new SimpleIDFetcher(), sifTypes); IDFetcher configurableIDFetcher = new ConfigurableIDFetcher() .seqDbStartsWithOrEquals("hgnc").useNameWhenNoDbMatch(true); final SIFSearcher customSifSearcher = new SIFSearcher(configurableIDFetcher, sifTypes); Model model = BioPAXLevel.L3.getDefaultFactory().createModel(); Complex c = model.addNew(Complex.class, "complex"); c.setDisplayName("KRAS-PIK3"); Protein p = model.addNew(Protein.class, "kras"); p.setDisplayName("RAS"); Protein pp = model.addNew(Protein.class, "pik3"); pp.setDisplayName("PIK3"); c.addComponent(p); c.addComponent(pp); Set<SIFInteraction> sifInteractions = customSifSearcher.searchSIF(model); assertTrue(sifInteractions.isEmpty()); sifInteractions = commonSifSearcher.searchSIF(model); assertTrue(sifInteractions.isEmpty()); Xref prx = model.addNew(RelationshipXref.class,"prx"); prx.setDb("HGNC Symbol"); prx.setId("KRAS"); p.addXref(prx); Xref pprx = model.addNew(RelationshipXref.class,"pprx"); pprx.setDb("HGNC Symbol"); pprx.setId("PIK3C3"); pp.addXref(pprx); sifInteractions = commonSifSearcher.searchSIF(model); assertTrue(sifInteractions.isEmpty()); sifInteractions = customSifSearcher.searchSIF(model); assertTrue(sifInteractions.isEmpty()); ProteinReference ppr = model.addNew(ProteinReference.class,"pik3_ref"); ppr.setDisplayName("PIK3 family"); pp.setEntityReference(ppr); ProteinReference pr = model.addNew(ProteinReference.class,"ras_ref"); pr.setDisplayName("RAS family"); p.setEntityReference(pr); assertEquals(7, model.getObjects().size()); sifInteractions = customSifSearcher.searchSIF(model); assertFalse(sifInteractions.isEmpty()); assertEquals(1, sifInteractions.size()); ByteArrayOutputStream bos = new ByteArrayOutputStream(); customSifSearcher.searchSIF(model, bos); System.out.println(bos.toString()); sifInteractions = commonSifSearcher.searchSIF(model); assertFalse(sifInteractions.isEmpty()); assertEquals(1, sifInteractions.size()); bos = new ByteArrayOutputStream(); commonSifSearcher.searchSIF(model, bos); System.out.println(bos.toString()); sifInteractions = simpleSifSearcher.searchSIF(model); assertFalse(sifInteractions.isEmpty()); assertEquals(1, sifInteractions.size()); bos = new ByteArrayOutputStream(); simpleSifSearcher.searchSIF(model, bos); System.out.println(bos.toString()); ppr.addXref(pprx); pr.addXref(prx); sifInteractions = customSifSearcher.searchSIF(model); assertFalse(sifInteractions.isEmpty()); assertEquals(1, sifInteractions.size()); bos = new ByteArrayOutputStream(); customSifSearcher.searchSIF(model, bos); System.out.println(bos.toString()); sifInteractions = commonSifSearcher.searchSIF(model); assertFalse(sifInteractions.isEmpty()); assertEquals(1, sifInteractions.size()); bos = new ByteArrayOutputStream(); commonSifSearcher.searchSIF(model, bos); System.out.println(bos.toString()); }