|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.compomics.util.experiment.identification.SequenceFactory
public class SequenceFactory
Factory retrieving the information of the loaded FASTA file.
Method Summary | |
---|---|
void |
appendDecoySequences(File destinationFile)
Appends decoy sequences to the desired file. |
void |
appendDecoySequences(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(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. |
HashMap<String,Integer> |
getAAOccurrences(JProgressBar progressBar)
Returns the occurrence of every amino acid in the database. |
ArrayList<String> |
getAccessions()
Returns the sequences present in the database. |
static String |
getDefaultDecoyAccession(String targetAccession)
Returns the default decoy accession for a target accession. |
static String |
getDefaultDecoyAccessionSuffix()
Returns the default suffix for a decoy accession. |
static String |
getDefaultDecoyDescription(String targetDescription)
Returns the default description for a decoy protein. |
static String |
getDefaultTargetAccession(String decoyAccession)
Returns the default target accession of a given decoy protein. |
String |
getFileName()
Returns the name of the loaded FASTA file. |
Header |
getHeader(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(String accession)
Returns the desired protein. |
static String |
getTargetDecoyFileNameTag()
Returns the target-decoy file name tag. |
static boolean |
isDecoy(String proteinAccession)
Returns a boolean indicating whether a protein is decoy or not based on the protein accession. |
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(File fastaFile)
Loads a new FASTA file in the factory. |
void |
loadFastaFile(File fastaFile,
WaitingHandler waitingHandler)
Loads a new FASTA file in the factory. |
static String |
reverseSequence(String sequence)
Reverses a protein sequence. |
void |
setnCache(int nCache)
Sets the size of the cache. |
static void |
setTargetDecoyFileNameTag(String targetDecoyFileNameTag)
Set the target-decoy file name tag. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Method Detail |
---|
public static SequenceFactory getInstance()
public static SequenceFactory getInstance(int nCache)
nCache
- the new cache size
public void clearFactory() throws IOException
IOException
public void emptyCache()
public Protein getProtein(String accession) throws IOException, IllegalArgumentException, InterruptedException, FileNotFoundException, ClassNotFoundException
accession
- accession of the desired protein
IOException
- thrown whenever an error is encountered while reading
the FASTA file
IllegalArgumentException
- thrown whenever an error is encountered
while reading the FASTA file
InterruptedException
FileNotFoundException
ClassNotFoundException
public Header getHeader(String accession) throws IOException, IllegalArgumentException, InterruptedException, FileNotFoundException, ClassNotFoundException
accession
- accession of the desired protein
IOException
- exception thrown whenever an error occurred while
reading the FASTA file
IllegalArgumentException
- exception thrown whenever a protein is
not found
InterruptedException
FileNotFoundException
ClassNotFoundException
public void loadFastaFile(File fastaFile) throws FileNotFoundException, IOException, ClassNotFoundException, StringIndexOutOfBoundsException, IllegalArgumentException
fastaFile
- the FASTA file to load
FileNotFoundException
- exception thrown if the file was not found
IOException
- exception thrown if an error occurred while reading
the FASTA file
ClassNotFoundException
- exception thrown whenever an error
occurred while deserializing the file index
StringIndexOutOfBoundsException
- thrown if issues occur during the
parsing of the protein headers
IllegalArgumentException
- if non unique accession numbers are
foundpublic void loadFastaFile(File fastaFile, WaitingHandler waitingHandler) throws FileNotFoundException, IOException, ClassNotFoundException, StringIndexOutOfBoundsException, IllegalArgumentException
fastaFile
- the FASTA file to loadwaitingHandler
- a waitingHandler showing the progress
FileNotFoundException
- exception thrown if the file was not found
IOException
- exception thrown if an error occurred while reading
the FASTA file
ClassNotFoundException
- exception thrown whenever an error
occurred while deserializing the file index
StringIndexOutOfBoundsException
- thrown if issues occur during the
parsing of the protein headers
IllegalArgumentException
- if non unique accession numbers are
foundpublic void closeFile() throws IOException
IOException
- exception thrown whenever an error occurred while
closing the filepublic static boolean isDecoy(String proteinAccession)
proteinAccession
- The accession of the protein
public boolean concatenatedTargetDecoy()
public boolean isDefaultReversed()
public int getNTargetSequences()
public void appendDecoySequences(File destinationFile) throws IOException, IllegalArgumentException, InterruptedException, FileNotFoundException, ClassNotFoundException
destinationFile
- the destination file
IOException
- exception thrown whenever an error occurred while
reading or writing a file
IllegalArgumentException
InterruptedException
FileNotFoundException
ClassNotFoundException
public void appendDecoySequences(File destinationFile, WaitingHandler waitingHandler) throws IOException, IllegalArgumentException, InterruptedException, FileNotFoundException, ClassNotFoundException
destinationFile
- the destination filewaitingHandler
- the waiting handler
IOException
- exception thrown whenever an error occurred while
reading or writing a file
IllegalArgumentException
- exception thrown whenever a protein is
not found
InterruptedException
FileNotFoundException
ClassNotFoundException
public static String reverseSequence(String sequence)
sequence
- the protein sequence
public ArrayList<String> getAccessions()
public int getnCache()
public void setnCache(int nCache)
nCache
- the new size of the cachepublic HashMap<String,Integer> getAAOccurrences(JProgressBar progressBar) throws IOException, IllegalArgumentException, InterruptedException, FileNotFoundException, ClassNotFoundException
progressBar
- a progress bar, can be null
IOException
- exception thrown whenever an error occurred while
reading the database
IllegalArgumentException
InterruptedException
FileNotFoundException
ClassNotFoundException
public double computeMolecularWeight(String accession) throws IOException, IllegalArgumentException, InterruptedException, FileNotFoundException, ClassNotFoundException
accession
- the protein's accession number
IOException
IllegalArgumentException
InterruptedException
FileNotFoundException
ClassNotFoundException
public static String getTargetDecoyFileNameTag()
public static void setTargetDecoyFileNameTag(String targetDecoyFileNameTag)
targetDecoyFileNameTag
- the targetDecoyFileNameTag to setpublic String getFileName()
public static String getDefaultDecoyAccessionSuffix()
public static String getDefaultDecoyAccession(String targetAccession)
targetAccession
- the target accession
public static String getDefaultDecoyDescription(String targetDescription)
targetDescription
- the description of a target protein
public static String getDefaultTargetAccession(String decoyAccession)
decoyAccession
- the decoy accession
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |