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 StringfetchSequenceFromVersion(String id, int version)fetchSequenceFromVersion.intfetchVersionFromSequence(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.intgetConnectionTimeOut()Getter for the fieldconnectionTimeOut.FastaSequencegetFastaSequence(String identifier, int version)Retrieve a fasta sequence corresponding to a given EntryVersion.StringgetLastSequenceAtTheDate(String identifier, Date date)getLastSequenceAtTheDate.StringgetSequenceFor(String identifier, int sequence_version)getSequenceFor.intgetSequenceVersion(String identifier, String sequence)Returns the sequence version of a sequence for a certain uniprot ac.intgetSocketTimeout()Getter for the fieldsocketTimeout.List<Integer>getVersions(String identifier)Searches for all entry version given its identifier.voidsetConnectionTimeOut(int connectionTimeOut)Setter for the fieldconnectionTimeOut.voidsetSocketTimeout(int socketTimeout)Setter for the fieldsocketTimeout.
-
-
-
Method Detail
-
getSequenceFor
public String getSequenceFor(String identifier, int sequence_version) throws BridgeFailedException
getSequenceFor.
- Parameters:
identifier- aStringobject.sequence_version- a int.- Returns:
- a
Stringobject. - 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- aStringobject.date- aDateobject.- Returns:
- a
Stringobject. - 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- aStringobject.date- aDateobject.- Returns:
- a
Mapobject. - 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- aStringobject.- 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- aStringobject.sequence- aStringobject.- 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:
fetchSequenceFromVersionin interfaceSequenceVersionFetcher- Parameters:
id- aStringobject.version- a int.- Returns:
- a
Stringobject. - Throws:
BridgeFailedException- if any.
-
fetchVersionFromSequence
public int fetchVersionFromSequence(String id, String sequence) throws BridgeFailedException
fetchVersionFromSequence.
- Specified by:
fetchVersionFromSequencein interfaceSequenceVersionFetcher- Parameters:
id- aStringobject.sequence- aStringobject.- 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.
-
-