|
||||||||||
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
Field Summary | |
---|---|
static String[] |
decoyFlags
Recognized flags for a decoy protein |
Method Summary | |
---|---|
void |
appendDecoySequences(File destinationFile)
Appends decoy sequences to the desired file. |
void |
appendDecoySequences(File destinationFile,
JProgressBar progressBar)
Appends decoy sequences to the desired file while displaying progress. |
void |
closeFile()
Closes the opened file. |
boolean |
concatenatedTargetDecoy()
Indicates whether the database loaded contains decoy sequences. |
static FastaIndex |
createFastaIndex(File fastaFile)
Static method to create a FASTA index for a FASTA file. |
static FastaIndex |
createFastaIndex(File fastaFile,
JProgressBar progressBar)
Static method to create a FASTA index for a FASTA file. |
ArrayList<String> |
getAccessions()
Returns the sequences present in the database. |
FastaIndex |
getFastaIndex(File fastaFile)
Returns the file index of a FASTA file. |
FastaIndex |
getFastaIndex(File fastaFile,
JProgressBar progressBar)
Returns the file index of a FASTA file. |
Header |
getHeader(String accession)
Returns the desired header for the protein in the FASTA file. |
FastaIndex |
getIndex(File fastaIndex)
Deserializes the index of 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. |
HashMap<String,Integer> |
getAAOccurrences(JProgressBar progressBar)
Returns the occurrence of every amino acid in the database |
static boolean |
isDecoy(String proteinAccession)
Returns a boolean indicating whether a protein is decoy or not based on the protein accession. |
void |
loadFastaFile(File fastaFile)
Loads a new FASTA file in the factory. |
void |
loadFastaFile(File fastaFile,
JProgressBar progressBar)
Loads a new FASTA file in the factory. |
void |
setnCache(int nCache)
Sets the size of the cache. |
void |
writeIndex(FastaIndex fastaIndex,
File directory)
Serializes the FASTA file index in a given directory. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final String[] decoyFlags
Method Detail |
---|
public static SequenceFactory getInstance()
public static SequenceFactory getInstance(int nCache)
nCache
- the new cache size
public Protein getProtein(String accession) throws IOException, IllegalArgumentException
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 filepublic Header getHeader(String accession) throws IOException, IllegalArgumentException
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 foundpublic void loadFastaFile(File fastaFile) throws FileNotFoundException, IOException, ClassNotFoundException
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 indexpublic void loadFastaFile(File fastaFile, JProgressBar progressBar) throws FileNotFoundException, IOException, ClassNotFoundException
fastaFile
- the FASTA file to loadprogressBar
- a progress bar 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 indexpublic FastaIndex getFastaIndex(File fastaFile) throws FileNotFoundException, IOException, ClassNotFoundException
fastaFile
- the FASTA file
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 indexpublic FastaIndex getFastaIndex(File fastaFile, JProgressBar progressBar) throws FileNotFoundException, IOException, ClassNotFoundException
fastaFile
- the FASTA fileprogressBar
- a progress bar 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 indexpublic void writeIndex(FastaIndex fastaIndex, File directory) throws IOException
fastaIndex
- the index of the FASTA filedirectory
- the directory where to write the file
IOException
- exception thrown whenever an error occurred while
writing the filepublic FastaIndex getIndex(File fastaIndex) throws FileNotFoundException, IOException, ClassNotFoundException
fastaIndex
- the FASTA cui index file
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 indexpublic void closeFile() throws IOException
IOException
- exception thrown whenever an error occurred while
closing the filepublic static FastaIndex createFastaIndex(File fastaFile) throws FileNotFoundException, IOException
fastaFile
- the FASTA file
FileNotFoundException
- exception thrown if the FASTA file was not
found
IOException
- exception thrown whenever an error occurred while
reading the filepublic static FastaIndex createFastaIndex(File fastaFile, JProgressBar progressBar) throws FileNotFoundException, IOException
fastaFile
- the FASTA fileprogressBar
- a progress bar showing the progress
FileNotFoundException
- exception thrown if the FASTA file was not
found
IOException
- exception thrown whenever an error occurred while
reading the filepublic static boolean isDecoy(String proteinAccession)
proteinAccession
- The accession of the protein
public boolean concatenatedTargetDecoy()
public int getNTargetSequences()
public void appendDecoySequences(File destinationFile) throws IOException
destinationFile
- the destination file
IOException
- exception thrown whenever an error occurred while
reading or writing a filepublic void appendDecoySequences(File destinationFile, JProgressBar progressBar) throws IOException, IllegalArgumentException
destinationFile
- the destination fileprogressBar
- the progress bar
IOException
- exception thrown whenever an error occurred while
reading or writing a file
IllegalArgumentException
- exdeption thrown whenever a protein is
not foundpublic 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
progressBar
- a progress bar, can be null
IOException
- exception thrown whenever an error occurred while
reading the database
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |