@Test public void interproTermsAreMapped() { when(interProTermTraderMock.get(anyString())).thenReturn(Optional.of(OntologyTerm.create("foobar"))); subject.mapToLinkText(BioentityPropertyName.INTERPRO, ImmutableSet.of("foobar"), false); verify(interProTermTraderMock, times(1)).get(eq("foobar")); }
Map<String, String> mapToLinkText(BioentityPropertyName propertyName, Collection<String> propertyValues, boolean isPlantSpecies) { switch (propertyName) { case ORTHOLOG: return propertyValues.stream() .collect(toMap(identity(), this::fetchSymbolAndSpeciesForOrtholog)); case PATHWAYID: return isPlantSpecies ? reactomeClient.getPlantPathwayNames(propertyValues) : reactomeClient.getPathwayNames(propertyValues); case GO: case PO: return propertyValues.stream() .collect(toMap(identity(), p -> goPoTermTrader.get(p).map(OntologyTerm::name).orElse(p))); case INTERPRO: return propertyValues.stream() .collect(toMap(identity(), p -> interProTermTrader.get(p).map(OntologyTerm::name).orElse(p))); default: return propertyValues.stream().collect(toMap(identity(), identity())); } }
BioEntityPropertyService { Map<String, String> mapToLinkText(BioentityPropertyName propertyName, Collection<String> propertyValues, boolean isPlantSpecies) { switch (propertyName) { case ORTHOLOG: return propertyValues.stream() .collect(toMap(identity(), this::fetchSymbolAndSpeciesForOrtholog)); case PATHWAYID: return isPlantSpecies ? reactomeClient.getPlantPathwayNames(propertyValues) : reactomeClient.getPathwayNames(propertyValues); case GO: case PO: return propertyValues.stream() .collect(toMap(identity(), p -> goPoTermTrader.get(p).map(OntologyTerm::name).orElse(p))); case INTERPRO: return propertyValues.stream() .collect(toMap(identity(), p -> interProTermTrader.get(p).map(OntologyTerm::name).orElse(p))); default: return propertyValues.stream().collect(toMap(identity(), identity())); } } }
BioEntityPropertyService { Map<String, String> mapToLinkText(BioentityPropertyName propertyName, Collection<String> propertyValues, boolean isPlantSpecies) { switch (propertyName) { case ORTHOLOG: return propertyValues.stream() .collect(toMap(identity(), this::fetchSymbolAndSpeciesForOrtholog)); case PATHWAYID: return isPlantSpecies ? reactomeClient.getPlantPathwayNames(propertyValues) : reactomeClient.getPathwayNames(propertyValues); case GO: case PO: return propertyValues.stream() .collect(toMap(identity(), p -> goPoTermTrader.get(p).map(OntologyTerm::name).orElse(p))); case INTERPRO: return propertyValues.stream() .collect(toMap(identity(), p -> interProTermTrader.get(p).map(OntologyTerm::name).orElse(p))); default: return propertyValues.stream().collect(toMap(identity(), identity())); } } @Inject  BioEntityPropertyService(SpeciesInferrer speciesInferrer,
                                    BioEntityPropertyDao bioEntityPropertyDao,
                                    ReactomeClient reactomeClient,
                                    GoPoTrader goPoTermTrader,
                                    InterProTrader interProTermTrader); }
BioEntityPropertyService { Map<String, String> mapToLinkText(BioentityPropertyName propertyName, Collection<String> propertyValues, boolean isPlantSpecies) { switch (propertyName) { case ORTHOLOG: return propertyValues.stream() .collect(toMap(identity(), this::fetchSymbolAndSpeciesForOrtholog)); case PATHWAYID: return isPlantSpecies ? reactomeClient.getPlantPathwayNames(propertyValues) : reactomeClient.getPathwayNames(propertyValues); case GO: case PO: return propertyValues.stream() .collect(toMap(identity(), p -> goPoTermTrader.get(p).map(OntologyTerm::name).orElse(p))); case INTERPRO: return propertyValues.stream() .collect(toMap(identity(), p -> interProTermTrader.get(p).map(OntologyTerm::name).orElse(p))); default: return propertyValues.stream().collect(toMap(identity(), identity())); } } @Inject  BioEntityPropertyService(SpeciesInferrer speciesInferrer,
                                    BioEntityPropertyDao bioEntityPropertyDao,
                                    ReactomeClient reactomeClient,
                                    GoPoTrader goPoTermTrader,
                                    InterProTrader interProTermTrader);  }
BioEntityPropertyService { Map<String, String> mapToLinkText(BioentityPropertyName propertyName, Collection<String> propertyValues, boolean isPlantSpecies) { switch (propertyName) { case ORTHOLOG: return propertyValues.stream() .collect(toMap(identity(), this::fetchSymbolAndSpeciesForOrtholog)); case PATHWAYID: return isPlantSpecies ? reactomeClient.getPlantPathwayNames(propertyValues) : reactomeClient.getPathwayNames(propertyValues); case GO: case PO: return propertyValues.stream() .collect(toMap(identity(), p -> goPoTermTrader.get(p).map(OntologyTerm::name).orElse(p))); case INTERPRO: return propertyValues.stream() .collect(toMap(identity(), p -> interProTermTrader.get(p).map(OntologyTerm::name).orElse(p))); default: return propertyValues.stream().collect(toMap(identity(), identity())); } } @Inject  BioEntityPropertyService(SpeciesInferrer speciesInferrer,
                                    BioEntityPropertyDao bioEntityPropertyDao,
                                    ReactomeClient reactomeClient,
                                    GoPoTrader goPoTermTrader,
                                    InterProTrader interProTermTrader);   }