Skip to content

Commit

Permalink
Merge pull request #87 from MICommunity/develop
Browse files Browse the repository at this point in the history
Develop > Master
  • Loading branch information
jmedinaebi authored Nov 27, 2023
2 parents 2649888 + 6eeec95 commit 6ed22ec
Show file tree
Hide file tree
Showing 70 changed files with 2,575 additions and 305 deletions.
2 changes: 1 addition & 1 deletion jami-batch/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<parent>
<groupId>psidev.psi.mi.jami</groupId>
<artifactId>psi-jami</artifactId>
<version>3.4.1</version>
<version>3.5.0</version>
</parent>

<artifactId>jami-batch</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion jami-bridges/bridges-core/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<parent>
<groupId>psidev.psi.mi.jami.bridges</groupId>
<artifactId>jami-bridges</artifactId>
<version>3.4.1</version>
<version>3.5.0</version>
</parent>

<artifactId>bridges-core</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
}
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;

}
}
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;
}

}
2 changes: 1 addition & 1 deletion jami-bridges/jami-chebi/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<parent>
<groupId>psidev.psi.mi.jami.bridges</groupId>
<artifactId>jami-bridges</artifactId>
<version>3.4.1</version>
<version>3.5.0</version>
</parent>

<artifactId>jami-chebi</artifactId>
Expand Down
67 changes: 67 additions & 0 deletions jami-bridges/jami-ensembl/pom.xml
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>
Loading

0 comments on commit 6ed22ec

Please sign in to comment.