-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #87 from MICommunity/develop
Develop > Master
- Loading branch information
Showing
70 changed files
with
2,575 additions
and
305 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,36 +3,45 @@ | |
import psidev.psi.mi.jami.bridges.exception.BridgeFailedException; | ||
import psidev.psi.mi.jami.model.Interactor; | ||
|
||
import java.util.ArrayList; | ||
import java.util.Collection; | ||
import java.util.List; | ||
|
||
/** | ||
* Fetches the complete records which match an interactor. | ||
* | ||
* @author Gabriel Aldam ([email protected]) | ||
* @since 14/05/13 | ||
*/ | ||
public interface InteractorFetcher<I extends Interactor> { | ||
|
||
/** | ||
* Takes a string identifier and returns the interactors which match. | ||
* Returns an empty collection of no entries are returned | ||
* | ||
* @param identifier The identifier to search for. | ||
* @return The proteins which match the search term. Empty if no matches. | ||
* @param identifier The identifier to search for. | ||
* @return The proteins which match the search term. Empty if no matches. | ||
* @throws psidev.psi.mi.jami.bridges.exception.BridgeFailedException A problem has been encountered when contacting the service | ||
*/ | ||
public Collection<I> fetchByIdentifier(String identifier) | ||
throws BridgeFailedException; | ||
default Collection<I> fetchByIdentifier(String identifier) | ||
throws BridgeFailedException { | ||
return fetchByIdentifiers(List.of(identifier)); | ||
} | ||
|
||
/** | ||
* Takes a collection of string identifiers and returns the interactors which match. | ||
* Returns an empty collection of no entries are returned. | ||
* | ||
* @param identifiers The identifiers to search for. | ||
* @return The proteins which match the search term. Empty if no matches. | ||
* @param identifiers The identifiers to search for. | ||
* @return The proteins which match the search term. Empty if no matches. | ||
* @throws psidev.psi.mi.jami.bridges.exception.BridgeFailedException if any. | ||
*/ | ||
public Collection<I> fetchByIdentifiers(Collection<String> identifiers) | ||
throws BridgeFailedException; | ||
default Collection<I> fetchByIdentifiers(Collection<String> identifiers) | ||
throws BridgeFailedException { | ||
List<I> list = new ArrayList<>(); | ||
for (String identifier : identifiers) { | ||
list.addAll(fetchByIdentifier(identifier)); | ||
} | ||
return list; | ||
} | ||
} |
49 changes: 49 additions & 0 deletions
49
...ges/bridges-core/src/main/java/psidev/psi/mi/jami/bridges/fetcher/NucleicAcidFetcher.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
package psidev.psi.mi.jami.bridges.fetcher; | ||
|
||
import psidev.psi.mi.jami.bridges.exception.BridgeFailedException; | ||
import psidev.psi.mi.jami.model.Gene; | ||
import psidev.psi.mi.jami.model.NucleicAcid; | ||
|
||
import java.util.ArrayList; | ||
import java.util.Collection; | ||
import java.util.List; | ||
import java.util.stream.Collectors; | ||
|
||
/** | ||
* A fetcher for genes. | ||
* | ||
* @author Gabriel Aldam ([email protected]) | ||
* @since 08/08/13 | ||
*/ | ||
public interface NucleicAcidFetcher extends InteractorFetcher<NucleicAcid> { | ||
|
||
/** | ||
* <p>fetchByIdentifier.</p> | ||
* | ||
* @param identifier The identifier of the Nucleic Acid | ||
* @param taxID The organism the gene is from. | ||
* @return The genes matching the search terms. | ||
* @throws BridgeFailedException if any. | ||
*/ | ||
Collection<NucleicAcid> fetchByIdentifier(String identifier, int taxID) | ||
throws BridgeFailedException; | ||
|
||
|
||
/** | ||
* <p>fetchByIdentifiers.</p> | ||
* | ||
* @param identifiers The identifiers of the Nucleic Acid | ||
* @param taxID The organism the gene is from. | ||
* @return The genes matching the search terms. | ||
* @throws BridgeFailedException if any. | ||
*/ | ||
default Collection<NucleicAcid> fetchByIdentifiers(Collection<String> identifiers, int taxID) | ||
throws BridgeFailedException { | ||
List<NucleicAcid> list = new ArrayList<>(); | ||
for (String identifier : identifiers) { | ||
list.addAll(fetchByIdentifier(identifier, taxID)); | ||
} | ||
return list; | ||
|
||
} | ||
} |
73 changes: 73 additions & 0 deletions
73
...es-core/src/main/java/psidev/psi/mi/jami/bridges/fetcher/mock/MockNucleicAcidFetcher.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
package psidev.psi.mi.jami.bridges.fetcher.mock; | ||
|
||
import psidev.psi.mi.jami.bridges.exception.BridgeFailedException; | ||
import psidev.psi.mi.jami.bridges.fetcher.NucleicAcidFetcher; | ||
import psidev.psi.mi.jami.model.NucleicAcid; | ||
|
||
import java.util.ArrayList; | ||
import java.util.Collection; | ||
|
||
/** | ||
* A mock fetcher for testing. | ||
* It extends all the methods of the true fetcher, but does not access an external service. | ||
* Instead, it holds a map which can be loaded with objects and keys. which are then returned. | ||
* It attempts to replicate the responses of the fetcher in most scenarios. | ||
* | ||
* @author Marine Dumousseau ([email protected]) | ||
* @version $Id$ | ||
* @since <pre>23/05/13</pre> | ||
*/ | ||
public class MockNucleicAcidFetcher | ||
extends AbstractMockFetcher<Collection<NucleicAcid>> | ||
implements NucleicAcidFetcher { | ||
|
||
/** | ||
* {@inheritDoc} | ||
*/ | ||
protected Collection<NucleicAcid> getEntry(String identifier) throws BridgeFailedException { | ||
if (identifier == null) throw new IllegalArgumentException( | ||
"Attempted to query mock NucleicAcid fetcher for null identifier."); | ||
|
||
if (!localMap.containsKey(identifier)) { | ||
return new ArrayList<>(); | ||
} else { | ||
return super.getEntry(identifier); | ||
} | ||
} | ||
|
||
/** | ||
* {@inheritDoc} | ||
*/ | ||
public Collection<NucleicAcid> fetchByIdentifier(String identifier) throws BridgeFailedException { | ||
return getEntry(identifier); | ||
} | ||
|
||
/** | ||
* {@inheritDoc} | ||
*/ | ||
public Collection<NucleicAcid> fetchByIdentifiers(Collection<String> identifiers) throws BridgeFailedException { | ||
Collection<NucleicAcid> resultsList = new ArrayList<>(); | ||
for (String identifier : identifiers) { | ||
resultsList.addAll(getEntry(identifier)); | ||
} | ||
return resultsList; | ||
} | ||
|
||
/** | ||
* {@inheritDoc} | ||
*/ | ||
@Override | ||
public Collection<NucleicAcid> fetchByIdentifier(String identifier, int taxID) throws BridgeFailedException { | ||
return getEntry(identifier); | ||
} | ||
|
||
@Override | ||
public Collection<NucleicAcid> fetchByIdentifiers(Collection<String> identifiers, int taxID) throws BridgeFailedException { | ||
Collection<NucleicAcid> resultsList = new ArrayList<>(); | ||
for (String identifier : identifiers) { | ||
resultsList.addAll(getEntry(identifier)); | ||
} | ||
return resultsList; | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> | ||
<modelVersion>4.0.0</modelVersion> | ||
<parent> | ||
<groupId>psidev.psi.mi.jami.bridges</groupId> | ||
<artifactId>jami-bridges</artifactId> | ||
<version>3.5.0</version> | ||
</parent> | ||
|
||
<artifactId>jami-ensembl</artifactId> | ||
<packaging>jar</packaging> | ||
|
||
<name>PSI :: JAMI - Bridges - Ensembl</name> | ||
<description>JAMI - Ensembl bridge</description> | ||
|
||
<properties> | ||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> | ||
<lombok.version>1.18.28</lombok.version> | ||
</properties> | ||
|
||
<dependencies> | ||
<!-- bridges core --> | ||
<dependency> | ||
<groupId>psidev.psi.mi.jami.bridges</groupId> | ||
<artifactId>bridges-core</artifactId> | ||
<version>${project.version}</version> | ||
</dependency> | ||
|
||
<dependency> | ||
<groupId>psidev.psi.mi.jami.bridges</groupId> | ||
<artifactId>jami-ols</artifactId> | ||
<version>${project.version}</version> | ||
</dependency> | ||
|
||
<dependency> | ||
<groupId>org.projectlombok</groupId> | ||
<artifactId>lombok</artifactId> | ||
<version>${lombok.version}</version> | ||
<scope>provided</scope> | ||
</dependency> | ||
|
||
<dependency> | ||
<groupId>com.fasterxml.jackson.core</groupId> | ||
<artifactId>jackson-databind</artifactId> | ||
</dependency> | ||
|
||
</dependencies> | ||
|
||
<build> | ||
<plugins> | ||
<plugin> | ||
<groupId>org.apache.maven.plugins</groupId> | ||
<artifactId>maven-compiler-plugin</artifactId> | ||
<version>3.11.0</version> | ||
<configuration> | ||
<annotationProcessorPaths> | ||
<path> | ||
<groupId>org.projectlombok</groupId> | ||
<artifactId>lombok</artifactId> | ||
<version>${lombok.version}</version> | ||
</path> | ||
</annotationProcessorPaths> | ||
</configuration> | ||
</plugin> | ||
</plugins> | ||
</build> | ||
</project> |
Oops, something went wrong.