public class SequenceFactory
extends java.lang.Object
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.
|
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.ArrayList<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 |
getDecoyFlag(java.lang.String proteinAccession)
Returns the default tag matched in the sequence if any.
|
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.
|
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.
|
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 |
getNTargetSequences()
Returns the number of target sequences in the database.
|
Protein |
getProtein(java.lang.String accession)
Returns the desired protein.
|
static java.lang.String |
getTargetDecoyFileNameTag()
Returns the target-decoy file name tag.
|
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 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.
|
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.io.IOException
public void emptyCache()
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.InterruptedException
java.io.FileNotFoundException
java.lang.ClassNotFoundException
public 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.InterruptedException
java.io.FileNotFoundException
java.lang.ClassNotFoundException
public 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 void saveIndex() throws java.io.IOException
java.io.IOException
public void closeFile() throws java.io.IOException
java.io.IOException
- exception thrown whenever an error occurred while
closing the filepublic static boolean isDecoy(java.lang.String proteinAccession, java.lang.String decoyFlag)
proteinAccession
- The accession of the proteindecoyFlag
- the decoy flagpublic static java.lang.String getDecoyFlag(java.lang.String proteinAccession)
proteinAccession
- the protein accessionpublic 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 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.IllegalArgumentException
java.lang.InterruptedException
java.io.FileNotFoundException
java.lang.ClassNotFoundException
public 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.InterruptedException
java.io.FileNotFoundException
java.lang.ClassNotFoundException
public static java.lang.String reverseSequence(java.lang.String sequence)
sequence
- the protein sequencepublic java.util.ArrayList<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.IllegalArgumentException
java.lang.InterruptedException
java.io.FileNotFoundException
java.lang.ClassNotFoundException
public 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.IOException
java.lang.IllegalArgumentException
java.lang.InterruptedException
java.io.FileNotFoundException
java.lang.ClassNotFoundException
public 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()
Copyright © 2013. All Rights Reserved.