public class SequenceFactory
extends java.lang.Object
| Modifier and Type | Class and Description |
|---|---|
class |
SequenceFactory.HeaderIterator
Convenience iterator iterating the headers of a FASTA file without using
the cache.
|
class |
SequenceFactory.ProteinIterator
Convenience iterator iterating all proteins in a FASTA file without using
index or cache.
|
| Modifier and Type | Method and Description |
|---|---|
void |
appendDecoySequences(java.io.File destinationFile)
Appends decoy sequences to the desired file.
|
void |
appendDecoySequences(java.io.File destinationFile,
WaitingHandler waitingHandler)
Appends decoy sequences to the desired file while displaying progress.
|
void |
clearFactory()
Clears the factory getInstance() needs to be called afterwards.
|
void |
closeFile()
Closes the opened file.
|
double |
computeMolecularWeight(java.lang.String accession)
Returns the protein's molecular weight.
|
boolean |
concatenatedTargetDecoy()
Indicates whether the database loaded contains decoy sequences.
|
boolean |
deleteProteinTree()
Try to delete the default protein tree.
|
void |
emptyCache()
Empties the cache of the factory.
|
java.util.HashMap<java.lang.String,java.lang.Integer> |
getAAOccurrences(javax.swing.JProgressBar progressBar)
Returns the occurrence of every amino acid in the database.
|
java.util.Set<java.lang.String> |
getAccessions()
Returns the sequences present in the database.
|
java.io.File |
getCurrentFastaFile()
Returns the currently loaded fasta file.
|
FastaIndex |
getCurrentFastaIndex()
Returns the FASTA index of the currently loaded file.
|
static java.lang.String |
getDefaultDecoyAccession(java.lang.String targetAccession)
Returns the default decoy accession for a target accession.
|
static java.lang.String |
getDefaultDecoyAccessionSuffix()
Returns the default suffix for a decoy accession.
|
static java.lang.String |
getDefaultDecoyDescription(java.lang.String targetDescription)
Returns the default description for a decoy protein.
|
ProteinTree |
getDefaultProteinTree()
Returns the default protein tree corresponding to the database loaded in
factory.
|
ProteinTree |
getDefaultProteinTree(WaitingHandler waitingHandler)
Returns the default protein tree corresponding to the database loaded in
factory.
|
ProteinTree |
getDefaultProteinTree(WaitingHandler waitingHandler,
boolean displayProgress)
Returns the default protein tree corresponding to the database loaded in
factory
|
static java.lang.String |
getDefaultTargetAccession(java.lang.String decoyAccession)
Returns the default target accession of a given decoy protein.
|
java.lang.String |
getFileName()
Returns the name of the loaded FASTA file.
|
Header |
getHeader(java.lang.String accession)
Returns the desired header for the protein in the FASTA file.
|
SequenceFactory.HeaderIterator |
getHeaderIterator(boolean targetOnly)
Returns an iterator of all the headers in the FASTA file.
|
static SequenceFactory |
getInstance()
Static method returning the instance of the factory.
|
static SequenceFactory |
getInstance(int nCache)
Returns the instance of the factory with the specified cache size.
|
int |
getnCache()
Returns the size of the cache.
|
int |
getNodesInCache()
Returns the number of nodes currently loaded in cache.
|
int |
getNSequences()
Returns the number of sequences in the fasta file.
|
int |
getNTargetSequences()
Returns the number of target sequences in the database.
|
Protein |
getProtein(java.lang.String accession)
Returns the desired protein.
|
SequenceFactory.ProteinIterator |
getProteinIterator(boolean targetOnly)
Returns an iterator of all the proteins in the FASTA file.
|
static java.lang.String |
getTargetDecoyFileNameTag()
Returns the target-decoy file name tag.
|
boolean |
isClosed()
Indicates whether the connection to the random access file has been
closed.
|
static boolean |
isDecoy(java.lang.String proteinAccession)
Deprecated.
deprecated, use the isDecoy(proteinAccession, flag) with file
dependent flag or isDecoyAccession(String proteinAccession) instead.
|
static boolean |
isDecoy(java.lang.String proteinAccession,
java.lang.String decoyFlag)
Returns a boolean indicating whether a protein is decoy or not based on
the protein accession and a given decoy flag.
|
boolean |
isDecoyAccession(java.lang.String proteinAccession)
Indicates whether a protein is a decoy in the selected loaded FASTA file.
|
boolean |
isDefaultReversed()
Indicates whether the decoy sequences are reversed versions of the target
and the decoy accessions built based on the sequence factory methods.
|
void |
loadFastaFile(java.io.File fastaFile)
Loads a new FASTA file in the factory.
|
void |
loadFastaFile(java.io.File fastaFile,
WaitingHandler waitingHandler)
Loads a new FASTA file in the factory.
|
void |
reduceNodeCacheSize(double share)
Reduces the node cache size of the protein tree by the given share.
|
void |
resetConnection()
Resets the connection to the random access file.
|
static java.lang.String |
reverseSequence(java.lang.String sequence)
Reverses a protein sequence.
|
void |
saveIndex()
Saves the index.
|
void |
setnCache(int nCache)
Sets the size of the cache.
|
static void |
setTargetDecoyFileNameTag(java.lang.String targetDecoyFileNameTag)
Set the target-decoy file name tag.
|
public static SequenceFactory getInstance()
public static SequenceFactory getInstance(int nCache)
nCache - the new cache sizepublic void clearFactory()
throws java.io.IOException,
java.sql.SQLException
java.io.IOExceptionjava.sql.SQLExceptionpublic void emptyCache()
public void reduceNodeCacheSize(double share)
share - the share of the cache to remove. 0.5 means 50%public int getNodesInCache()
public Protein getProtein(java.lang.String accession) throws java.io.IOException, java.lang.IllegalArgumentException, java.lang.InterruptedException, java.io.FileNotFoundException, java.lang.ClassNotFoundException
accession - accession of the desired proteinjava.io.IOException - thrown whenever an error is encountered while reading
the FASTA filejava.lang.IllegalArgumentException - thrown whenever an error is encountered
while reading the FASTA filejava.lang.InterruptedExceptionjava.io.FileNotFoundExceptionjava.lang.ClassNotFoundExceptionpublic Header getHeader(java.lang.String accession) throws java.io.IOException, java.lang.IllegalArgumentException, java.lang.InterruptedException, java.io.FileNotFoundException, java.lang.ClassNotFoundException
accession - accession of the desired proteinjava.io.IOException - exception thrown whenever an error occurred while
reading the FASTA filejava.lang.IllegalArgumentException - exception thrown whenever a protein is
not foundjava.lang.InterruptedExceptionjava.io.FileNotFoundExceptionjava.lang.ClassNotFoundExceptionpublic void loadFastaFile(java.io.File fastaFile)
throws java.io.FileNotFoundException,
java.io.IOException,
java.lang.ClassNotFoundException,
java.lang.StringIndexOutOfBoundsException,
java.lang.IllegalArgumentException
fastaFile - the FASTA file to loadjava.io.FileNotFoundException - exception thrown if the file was not foundjava.io.IOException - exception thrown if an error occurred while reading
the FASTA filejava.lang.ClassNotFoundException - exception thrown whenever an error
occurred while deserializing the file indexjava.lang.StringIndexOutOfBoundsException - thrown if issues occur during the
parsing of the protein headersjava.lang.IllegalArgumentException - if non unique accession numbers are
foundpublic void loadFastaFile(java.io.File fastaFile,
WaitingHandler waitingHandler)
throws java.io.FileNotFoundException,
java.io.IOException,
java.lang.ClassNotFoundException,
java.lang.StringIndexOutOfBoundsException,
java.lang.IllegalArgumentException
fastaFile - the FASTA file to loadwaitingHandler - a waitingHandler showing the progressjava.io.FileNotFoundException - exception thrown if the file was not foundjava.io.IOException - exception thrown if an error occurred while reading
the FASTA filejava.lang.ClassNotFoundException - exception thrown whenever an error
occurred while deserializing the file indexjava.lang.StringIndexOutOfBoundsException - thrown if issues occur during the
parsing of the protein headersjava.lang.IllegalArgumentException - if non unique accession numbers are
foundpublic boolean isClosed()
public void resetConnection()
throws java.io.IOException
java.io.IOExceptionpublic void saveIndex()
throws java.io.IOException
java.io.IOExceptionpublic void closeFile()
throws java.io.IOException,
java.sql.SQLException
java.io.IOException - exception thrown whenever an error occurred while
closing the filejava.sql.SQLExceptionpublic static boolean isDecoy(java.lang.String proteinAccession,
java.lang.String decoyFlag)
proteinAccession - The accession of the proteindecoyFlag - the decoy flagpublic boolean isDecoyAccession(java.lang.String proteinAccession)
proteinAccession - the protein accession of interest.public static boolean isDecoy(java.lang.String proteinAccession)
proteinAccession - the accession of interestpublic boolean concatenatedTargetDecoy()
public boolean isDefaultReversed()
public int getNTargetSequences()
public int getNSequences()
public void appendDecoySequences(java.io.File destinationFile)
throws java.io.IOException,
java.lang.IllegalArgumentException,
java.lang.InterruptedException,
java.io.FileNotFoundException,
java.lang.ClassNotFoundException
destinationFile - the destination filejava.io.IOException - exception thrown whenever an error occurred while
reading or writing a filejava.lang.IllegalArgumentExceptionjava.lang.InterruptedExceptionjava.io.FileNotFoundExceptionjava.lang.ClassNotFoundExceptionpublic void appendDecoySequences(java.io.File destinationFile,
WaitingHandler waitingHandler)
throws java.io.IOException,
java.lang.IllegalArgumentException,
java.lang.InterruptedException,
java.io.FileNotFoundException,
java.lang.ClassNotFoundException
destinationFile - the destination filewaitingHandler - the waiting handlerjava.io.IOException - exception thrown whenever an error occurred while
reading or writing a filejava.lang.IllegalArgumentException - exception thrown whenever a protein is
not foundjava.lang.InterruptedExceptionjava.io.FileNotFoundExceptionjava.lang.ClassNotFoundExceptionpublic static java.lang.String reverseSequence(java.lang.String sequence)
sequence - the protein sequencepublic java.util.Set<java.lang.String> getAccessions()
public int getnCache()
public void setnCache(int nCache)
nCache - the new size of the cachepublic java.util.HashMap<java.lang.String,java.lang.Integer> getAAOccurrences(javax.swing.JProgressBar progressBar)
throws java.io.IOException,
java.lang.IllegalArgumentException,
java.lang.InterruptedException,
java.io.FileNotFoundException,
java.lang.ClassNotFoundException
progressBar - a progress bar, can be nulljava.io.IOException - exception thrown whenever an error occurred while
reading the databasejava.lang.IllegalArgumentExceptionjava.lang.InterruptedExceptionjava.io.FileNotFoundExceptionjava.lang.ClassNotFoundExceptionpublic double computeMolecularWeight(java.lang.String accession)
throws java.io.IOException,
java.lang.IllegalArgumentException,
java.lang.InterruptedException,
java.io.FileNotFoundException,
java.lang.ClassNotFoundException
accession - the protein's accession numberjava.io.IOExceptionjava.lang.IllegalArgumentExceptionjava.lang.InterruptedExceptionjava.io.FileNotFoundExceptionjava.lang.ClassNotFoundExceptionpublic static java.lang.String getTargetDecoyFileNameTag()
public static void setTargetDecoyFileNameTag(java.lang.String targetDecoyFileNameTag)
targetDecoyFileNameTag - the targetDecoyFileNameTag to setpublic java.lang.String getFileName()
public java.io.File getCurrentFastaFile()
public static java.lang.String getDefaultDecoyAccessionSuffix()
public static java.lang.String getDefaultDecoyAccession(java.lang.String targetAccession)
targetAccession - the target accessionpublic static java.lang.String getDefaultDecoyDescription(java.lang.String targetDescription)
targetDescription - the description of a target proteinpublic static java.lang.String getDefaultTargetAccession(java.lang.String decoyAccession)
decoyAccession - the decoy accessionpublic FastaIndex getCurrentFastaIndex()
public ProteinTree getDefaultProteinTree() throws java.io.IOException, java.lang.InterruptedException, java.lang.ClassNotFoundException, java.lang.IllegalArgumentException, java.sql.SQLException
java.io.IOExceptionjava.lang.InterruptedExceptionjava.lang.ClassNotFoundExceptionjava.lang.IllegalArgumentExceptionjava.sql.SQLExceptionpublic ProteinTree getDefaultProteinTree(WaitingHandler waitingHandler) throws java.io.IOException, java.lang.InterruptedException, java.lang.ClassNotFoundException, java.lang.IllegalArgumentException, java.sql.SQLException
waitingHandler - waiting handler displaying progress to the user
during the initiation of the treejava.io.IOExceptionjava.lang.InterruptedExceptionjava.lang.ClassNotFoundExceptionjava.lang.IllegalArgumentExceptionjava.sql.SQLExceptionpublic ProteinTree getDefaultProteinTree(WaitingHandler waitingHandler, boolean displayProgress) throws java.io.IOException, java.lang.InterruptedException, java.lang.ClassNotFoundException, java.lang.IllegalArgumentException, java.sql.SQLException
waitingHandler - waiting handler displaying progress to the user
during the initiation of the treedisplayProgress - display progressjava.io.IOExceptionjava.lang.InterruptedExceptionjava.lang.ClassNotFoundExceptionjava.lang.IllegalArgumentExceptionjava.sql.SQLExceptionpublic boolean deleteProteinTree()
public SequenceFactory.HeaderIterator getHeaderIterator(boolean targetOnly) throws java.io.FileNotFoundException
targetOnly - boolean indicating whether only target accessions shall
be iteratedjava.io.FileNotFoundExceptionpublic SequenceFactory.ProteinIterator getProteinIterator(boolean targetOnly) throws java.io.FileNotFoundException
targetOnly - boolean indicating whether only target accessions shall
be iteratedjava.io.FileNotFoundExceptionCopyright © 2014. All Rights Reserved.