Class UnisaveClient
- java.lang.Object
-
- psidev.psi.mi.jami.bridges.unisave.UnisaveClient
-
- All Implemented Interfaces:
SequenceVersionFetcher
public class UnisaveClient extends Object implements SequenceVersionFetcher
Client to query unisave and collect sequence versions or sequence from a particular version- Since:
30/09/13
- Version:
- $Id$
- Author:
- Marine Dumousseau (marine@ebi.ac.uk)
-
-
Constructor Summary
Constructors Constructor Description UnisaveClient()
Constructor for UnisaveClient.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description String
fetchSequenceFromVersion(String id, int version)
fetchSequenceFromVersion.int
fetchVersionFromSequence(String id, String sequence)
fetchVersionFromSequence.Map<Integer,String>
getAllSequencesBeforeDate(String identifier, Date date)
Get the map of sequences (and their sequence version in uniprot) existing in unisave before this dateList<SequenceVersion>
getAvailableSequenceUpdate(String identifier, String sequence)
Collects all available sequence update fro mUniSave.int
getConnectionTimeOut()
Getter for the fieldconnectionTimeOut
.FastaSequence
getFastaSequence(String identifier, int version)
Retrieve a fasta sequence corresponding to a given EntryVersion.String
getLastSequenceAtTheDate(String identifier, Date date)
getLastSequenceAtTheDate.String
getSequenceFor(String identifier, int sequence_version)
getSequenceFor.int
getSequenceVersion(String identifier, String sequence)
Returns the sequence version of a sequence for a certain uniprot ac.int
getSocketTimeout()
Getter for the fieldsocketTimeout
.List<Integer>
getVersions(String identifier)
Searches for all entry version given its identifier.void
setConnectionTimeOut(int connectionTimeOut)
Setter for the fieldconnectionTimeOut
.void
setSocketTimeout(int socketTimeout)
Setter for the fieldsocketTimeout
.
-
-
-
Method Detail
-
getSequenceFor
public String getSequenceFor(String identifier, int sequence_version) throws BridgeFailedException
getSequenceFor.
- Parameters:
identifier
- aString
object.sequence_version
- a int.- Returns:
- a
String
object. - Throws:
BridgeFailedException
- if any.
-
getVersions
public List<Integer> getVersions(String identifier) throws BridgeFailedException
Searches for all entry version given its identifier.- Parameters:
identifier
- the identifier of the entry we are interested in.- Returns:
- list of all versions of the given entry from the most recent to the oldest.
- Throws:
BridgeFailedException
- if the identifier cannot be found in UniSave.
-
getLastSequenceAtTheDate
public String getLastSequenceAtTheDate(String identifier, Date date) throws BridgeFailedException
getLastSequenceAtTheDate.
- Parameters:
identifier
- aString
object.date
- aDate
object.- Returns:
- a
String
object. - Throws:
BridgeFailedException
- if any.
-
getAllSequencesBeforeDate
public Map<Integer,String> getAllSequencesBeforeDate(String identifier, Date date) throws BridgeFailedException
Get the map of sequences (and their sequence version in uniprot) existing in unisave before this date- Parameters:
identifier
- aString
object.date
- aDate
object.- Returns:
- a
Map
object. - Throws:
BridgeFailedException
- if any.
-
getFastaSequence
public FastaSequence getFastaSequence(String identifier, int version) throws BridgeFailedException
Retrieve a fasta sequence corresponding to a given EntryVersion.- Parameters:
version
- the version for which we want the sequenceidentifier
- aString
object.- Returns:
- a fasta sequence.
- Throws:
BridgeFailedException
- if the version given doesn't have an entryId that can be found in UniSave.
-
getSequenceVersion
public int getSequenceVersion(String identifier, String sequence) throws BridgeFailedException
Returns the sequence version of a sequence for a certain uniprot ac. Returns -1 if the sequence cannot be found for this uniprot ac- Parameters:
identifier
- aString
object.sequence
- aString
object.- Returns:
- a int.
- Throws:
BridgeFailedException
- if any.
-
getAvailableSequenceUpdate
public List<SequenceVersion> getAvailableSequenceUpdate(String identifier, String sequence) throws BridgeFailedException
Collects all available sequence update fro mUniSave.- Parameters:
identifier
- identifier of the uniprot entrysequence
- sequence for which we want the subsequent updates- Returns:
- a non null ordered list. If the given sequence is found in the entry history, this sequence at least is returned. If there were say, 2 updates since that protein sequence, the list would contain 3 versions. If we fail to find a match for the given sequence in UniSave, the list would contain all existing sequence update available. The list of ordered from the oldest to the most recent sequence.
- Throws:
BridgeFailedException
- if the identifier cannot be found in UniSave.
-
fetchSequenceFromVersion
public String fetchSequenceFromVersion(String id, int version) throws BridgeFailedException
fetchSequenceFromVersion.
- Specified by:
fetchSequenceFromVersion
in interfaceSequenceVersionFetcher
- Parameters:
id
- aString
object.version
- a int.- Returns:
- a
String
object. - Throws:
BridgeFailedException
- if any.
-
fetchVersionFromSequence
public int fetchVersionFromSequence(String id, String sequence) throws BridgeFailedException
fetchVersionFromSequence.
- Specified by:
fetchVersionFromSequence
in interfaceSequenceVersionFetcher
- Parameters:
id
- aString
object.sequence
- aString
object.- Returns:
- a int.
- Throws:
BridgeFailedException
- if any.
-
getSocketTimeout
public int getSocketTimeout()
Getter for the field
socketTimeout
.- Returns:
- a int.
-
setSocketTimeout
public void setSocketTimeout(int socketTimeout)
Setter for the field
socketTimeout
.- Parameters:
socketTimeout
- a int.
-
getConnectionTimeOut
public int getConnectionTimeOut()
Getter for the field
connectionTimeOut
.- Returns:
- a int.
-
setConnectionTimeOut
public void setConnectionTimeOut(int connectionTimeOut)
Setter for the field
connectionTimeOut
.- Parameters:
connectionTimeOut
- a int.
-
-