@Test public void unknownSpeciesAreOmittedFromOrthologs() { when(speciesInferrerMock.inferSpeciesForGeneQuery( argThat(semanticQuery -> semanticQuery.iterator().next().value().startsWith("ENSCING")))) .thenReturn(new Species("Ciona intestinalis", SpeciesProperties.UNKNOWN)); assertThat( subject.mapToLinkText(BioentityPropertyName.ORTHOLOG, ImmutableSet.of("ENSCING00000014543"), false), hasEntry("ENSCING00000014543", "ENSCING00000014543")); verifyZeroInteractions(bioEntityPropertyDaoMock); }
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);   }