public class ProteinTree extends Object
Modifier and Type | Class and Description |
---|---|
class |
ProteinTree.PeptideIterator
Alphabetical iterator for the tree.
|
Modifier and Type | Field and Description |
---|---|
static int |
proteinBatchSize
The number of proteins which should be imported at a time.
|
static String |
version
The version of the protein tree.
|
Constructor and Description |
---|
ProteinTree(int memoryAllocation,
int cacheSize)
Creates a tree based on the proteins present in the sequence factory.
|
Modifier and Type | Method and Description |
---|---|
void |
close()
Closes all connections to files, tries to delete corrupted and deprecated
trees.
|
boolean |
deleteDb()
Try to delete the current database.
|
void |
emptyCache()
Empties the cache.
|
int |
getCacheSize()
Returns the size of the cache used for peptide mappings (note that there
are two of them).
|
Integer |
getInitialTagSize()
Returns the initial tag size of the tree.
|
HashMap<String,ArrayList<Integer>> |
getMatchedPeptideSequences(String peptideSequence,
String proteinAccession,
SequenceMatchingPreferences sequenceMatchingPreferences)
Returns a list of peptides matched using the given peptide sequence in
the given protein according the provided matching settings.
|
int |
getMemoryAllocation()
Returns the memory allocation.
|
int |
getNodesInCache()
Returns the number of nodes currently loaded in cache.
|
ProteinTree.PeptideIterator |
getPeptideIterator()
Returns a PeptideIterator which iterates alphabetically all peptides
corresponding to the end of a branch in the tree.
|
Integer |
getProteinLength(String accession)
Retrieves the length of a protein.
|
HashMap<String,HashMap<String,ArrayList<Integer>>> |
getProteinMapping(String peptideSequence,
SequenceMatchingPreferences proteinInferencePreferences)
Returns the protein mapping in the sequence factory for the given peptide
sequence.
|
HashMap<Peptide,HashMap<String,ArrayList<Integer>>> |
getProteinMapping(Tag tag,
TagMatcher tagMatcher,
SequenceMatchingPreferences sequenceMatchingPreferences,
Double massTolerance)
Returns the protein mappings for the given peptide sequence.
|
void |
initiateTree(int initialTagSize,
int maxNodeSize,
int maxPeptideSize,
Enzyme enzyme,
WaitingHandler waitingHandler,
ExceptionHandler exceptionHandler,
boolean printExpectedImportTime,
boolean displayProgress,
int nThreads)
Initiates the tree.
|
void |
initiateTree(int initialTagSize,
int maxNodeSize,
int maxPeptideSize,
WaitingHandler waitingHandler,
ExceptionHandler exceptionHandler,
boolean printExpectedImportTime,
boolean displayProgress,
int nThreads)
Initiates the tree.
|
void |
reduceNodeCacheSize(double share)
Reduces the node cache size by the given share.
|
void |
setCacheSize(int cacheSize)
Sets the size of the cache used for peptide mappings (note that there are
two of them).
|
void |
setMemoryAllocation(int memoryAllocation)
Sets the memory allocation.
|
public static final String version
public static final int proteinBatchSize
public ProteinTree(int memoryAllocation, int cacheSize) throws IOException
memoryAllocation
- the number of MB available for the tree in
memory.cacheSize
- the peptide queries caches size (note, there are two of
them)IOException
- if an IOException occurspublic int getMemoryAllocation()
public void setMemoryAllocation(int memoryAllocation)
memoryAllocation
- the memory allocationpublic void initiateTree(int initialTagSize, int maxNodeSize, int maxPeptideSize, WaitingHandler waitingHandler, ExceptionHandler exceptionHandler, boolean printExpectedImportTime, boolean displayProgress, int nThreads) throws IOException, IllegalArgumentException, InterruptedException, ClassNotFoundException, SQLException
nThreads
- the number of threads to useinitialTagSize
- the initial tag sizemaxNodeSize
- the maximal size of a node. large nodes will be fast
to initiate but slow to query. I typically use 500 giving an approximate
query time <20ms.maxPeptideSize
- the maximum peptide sizewaitingHandler
- the waiting handler used to display progress to the
user and cancel the process. Can be null but strongly recommended.exceptionHandler
- handler for the exceptions encountered while
creating the treeprintExpectedImportTime
- if true the expected import time will be
printed to the waiting handlerdisplayProgress
- display progressIOException
- if an IOException occursClassNotFoundException
- if a ClassNotFoundException occursInterruptedException
- if an InterruptedException occursIllegalArgumentException
- if an IllegalArgumentException occursSQLException
- if an SQLException occurspublic void initiateTree(int initialTagSize, int maxNodeSize, int maxPeptideSize, Enzyme enzyme, WaitingHandler waitingHandler, ExceptionHandler exceptionHandler, boolean printExpectedImportTime, boolean displayProgress, int nThreads) throws IOException, InterruptedException, IOException, InterruptedException, ClassNotFoundException, SQLException
nThreads
- the number of threads to useinitialTagSize
- the initial size of peptide tag. Large initial size
are fast to query, low initial size are fast to initiate. I typically use
3 for databases containing less than 100 000 proteins giving an
approximate initiation time of 60ms per accession.maxNodeSize
- the maximal size of a node. large nodes will be fast
to initiate but slow to query. I typically use 500 giving an approximate
query time <20ms.maxPeptideSize
- the maximum peptide sizeenzyme
- the enzyme used to select peptides. If null all possible
peptides will be indexedwaitingHandler
- the waiting handler used to display progress to the
user and cancel the process. Can be null but strongly recommended.exceptionHandler
- handler for the exceptions encountered while
creating the treeprintExpectedImportTime
- if true the expected import time will be
printed to the waiting handlerdisplayProgress
- display progressIOException
- exception thrown whenever an error occurs while
reading or writing a file.ClassNotFoundException
- exception thrown whenever an error occurs
while deserializing an object.InterruptedException
- exception thrown whenever a threading issue
occurred while creating the tree.SQLException
- if an SQLException exception thrown whenever a
problem occurred while interacting with the tree database.public boolean deleteDb()
public HashMap<String,HashMap<String,ArrayList<Integer>>> getProteinMapping(String peptideSequence, SequenceMatchingPreferences proteinInferencePreferences) throws IOException, InterruptedException, ClassNotFoundException, SQLException
peptideSequence
- the peptide sequenceproteinInferencePreferences
- the sequence matching preferencesIOException
- exception thrown whenever an error occurs while
reading or writing a file.ClassNotFoundException
- exception thrown whenever an error occurs
while deserializing an object.InterruptedException
- exception thrown whenever a threading issue
occurred while interacting with the tree.SQLException
- if an SQLException exception thrown whenever a
problem occurred while interacting with the tree database.public HashMap<Peptide,HashMap<String,ArrayList<Integer>>> getProteinMapping(Tag tag, TagMatcher tagMatcher, SequenceMatchingPreferences sequenceMatchingPreferences, Double massTolerance) throws IOException, InterruptedException, ClassNotFoundException, SQLException
tag
- the tag to look for in the tree. Must contain a consecutive
amino acid sequence of longer or equal size than the initialTagSize of
the tree.tagMatcher
- the tag matcher to usesequenceMatchingPreferences
- the sequence matching preferencesmassTolerance
- the MS2 m/z toleranceIOException
- exception thrown whenever an error occurs while
reading or writing a file.ClassNotFoundException
- exception thrown whenever an error occurs
while deserializing an object.InterruptedException
- exception thrown whenever a threading issue
occurred while interacting with the tree.SQLException
- if an SQLException exception thrown whenever a
problem occurred while interacting with the tree database.public void close() throws IOException, SQLException
IOException
- exception thrown whenever an error occurs while
reading or writing a file.SQLException
- if an SQLException exception thrown whenever a
problem occurred while interacting with the tree database.public int getCacheSize()
public void setCacheSize(int cacheSize)
cacheSize
- the size of the cache used for peptide mappingspublic void emptyCache()
public void reduceNodeCacheSize(double share)
share
- the share of the cache to remove. 0.5 means 50%public int getNodesInCache()
public HashMap<String,ArrayList<Integer>> getMatchedPeptideSequences(String peptideSequence, String proteinAccession, SequenceMatchingPreferences sequenceMatchingPreferences) throws IOException, InterruptedException, ClassNotFoundException, SQLException
peptideSequence
- the original peptide sequenceproteinAccession
- the accession of the protein of interestsequenceMatchingPreferences
- the sequence matching preferencesIOException
- exception thrown whenever an error occurs while
reading or writing a file.ClassNotFoundException
- exception thrown whenever an error occurs
while deserializing an object.InterruptedException
- exception thrown whenever a threading issue
occurred while interacting with the tree.SQLException
- if an SQLException exception thrown whenever a
problem occurred while interacting with the tree database.public ProteinTree.PeptideIterator getPeptideIterator() throws SQLException, IOException, ClassNotFoundException, InterruptedException
IOException
- exception thrown whenever an error occurs while
reading or writing a file.ClassNotFoundException
- exception thrown whenever an error occurs
while deserializing an object.InterruptedException
- exception thrown whenever a threading issue
occurred while interacting with the tree.SQLException
- if an SQLException exception thrown whenever a
problem occurred while interacting with the tree database.public Integer getProteinLength(String accession) throws SQLException, ClassNotFoundException, IOException, InterruptedException
accession
- the accession of the protein of interestIOException
- exception thrown whenever an error occurs while
reading or writing a file.ClassNotFoundException
- exception thrown whenever an error occurs
while deserializing an object.InterruptedException
- exception thrown whenever a threading issue
occurred while interacting with the tree.SQLException
- if an SQLException exception thrown whenever a
problem occurred while interacting with the tree database.public Integer getInitialTagSize() throws SQLException, IOException, ClassNotFoundException, InterruptedException
IOException
- exception thrown whenever an error occurs while
reading or writing a file.ClassNotFoundException
- exception thrown whenever an error occurs
while deserializing an object.InterruptedException
- exception thrown whenever a threading issue
occurred while interacting with the tree.SQLException
- if an SQLException exception thrown whenever a
problem occurred while interacting with the tree database.Copyright © 2016. All rights reserved.