public class PTMFactory
extends java.lang.Object
implements java.io.Serializable
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
SEARCH_SUFFIX
Suffix for the modifications searched but not in the factory.
|
static PTM |
unknownPTM
Unknown modification to be returned when the modification is not found.
|
Modifier and Type | Method and Description |
---|---|
void |
addUserPTM(PTM ptm)
Adds a new user modification.
|
void |
checkFixedModifications(ModificationProfile modificationProfile,
Peptide peptide)
Removes the fixed modifications of the peptide and remaps the one
searched for according to the ModificationProfile.
|
void |
clearFactory()
Clears the factory getInstance() needs to be called afterwards.
|
boolean |
containsPTM(java.lang.String name)
Returns a boolean indicating whether the PTM is loaded in the factory.
|
java.awt.Color |
getColor(java.lang.String modification)
Returns the color used to code the given modification.
|
static java.awt.Color |
getDefaultColor(java.lang.String modification)
Returns a default color based on the modification name.
|
java.util.ArrayList<java.lang.String> |
getDefaultModifications()
Returns the names of the default modifications.
|
java.lang.Integer |
getDefaultOMSSAIndex(java.lang.String modificationName)
Returns the default OMSSA index of the modification.
|
static java.lang.String |
getDefaultShortName(java.lang.String modificationName)
Returns a default short name for a given modification.
|
java.util.HashMap<java.lang.Integer,java.util.ArrayList<java.lang.String>> |
getExpectedPTMs(ModificationProfile modificationProfile,
Peptide peptide,
double modificationMass,
double massTolerance)
Returns the expected modifications based on the modification profile, the
peptide found and the modification details.
|
java.util.HashMap<java.lang.Integer,java.util.ArrayList<java.lang.String>> |
getExpectedPTMs(ModificationProfile modificationProfile,
Peptide peptide,
java.lang.String ptmName)
Returns the names of the possibly expected modification based on the name
of the expected modification in a map where the PTM names are indexed by
their potential site on the sequence.
|
static PTMFactory |
getInstance()
Static method to get the instance of the factory.
|
static java.util.HashMap<java.lang.String,java.lang.Integer> |
getOMSSAIndexes(java.io.File modificationsFile)
Imports the OMSSA indexes from an XML file.
|
java.lang.String |
getOmssaUserModBloc(java.lang.String ptmName,
int cpt)
Returns an MSModSpec bloc as present in the OMSSA user modification files
for a given PTM.
|
PTM |
getPTM(double mass,
java.lang.String location,
java.lang.String sequence)
Deprecated.
This method can generate inconsistent results in case a
measurement matches to various PTMs.
|
PTM |
getPTM(ModificationProfile modificationProfile,
int index)
Get a PTM according to its OMSSA index.
|
PTM |
getPTM(java.lang.String name)
Returns the PTM indexed by its name.
|
java.util.ArrayList<java.lang.String> |
getPTMs()
Returns the names of all imported PTMs.
|
PTM |
getSearchedPTM(PTM modification)
Returns the standard search compatible PTM corresponding to this pattern.
|
PTM |
getSearchedPTM(java.lang.String modificationName)
Returns the standard search compatible PTM corresponding to this pattern,
i.e., a pattern targeting a single amino-acid and not a complex pattern.
|
java.lang.String |
getShortName(java.lang.String modification)
Returns the user favorite short name, a default short name otherwise.
|
java.util.ArrayList<java.lang.String> |
getUserModifications()
Returns the names of the user defined modifications.
|
void |
importModifications(java.io.File modificationsFile,
boolean userMod)
Import modifications from a modification file.
|
void |
importModifications(java.io.File modificationsFile,
boolean userMod,
boolean overwrite)
Import modifications from a modification file.
|
boolean |
isUserDefined(java.lang.String ptmName)
Convenience method returning a boolean indicating whether a PTM is user
defined or default.
|
java.util.ArrayList<java.lang.String> |
loadBackedUpModifications(SearchParameters searchParameters,
boolean overwrite)
Verifies that the modifications backed-up in the search parameters are
loaded and alerts the user in case conflicts are found.
|
void |
reloadFactory()
Reloads the factory getInstance() needs to be called afterwards.
|
void |
removeUserPtm(java.lang.String ptmName)
Removes a user PTM.
|
void |
saveFactory()
Saves the factory in the user folder.
|
void |
setColor(java.lang.String expectedModification,
java.awt.Color color)
Sets a new color for the given expected modification.
|
void |
setDefaultNeutralLosses()
Sets the default neutral losses of PTMs when not implemented.
|
void |
setDefaultReporterIons()
Sets the default reporter ions of PTMs when not implemented.
|
void |
setSearchedOMSSAIndexes(ModificationProfile modificationProfile)
Set the OMSSA indexes used for this search.
|
void |
setShortName(java.lang.String modification,
java.lang.String shortName)
Sets the short name for a modification.
|
void |
writeOmssaModificationsFiles(java.io.File aFolder,
java.io.File utilitiesModFile,
java.io.File utilitiesUserModFile)
Write the OMSSA modification files to the given folder.
|
void |
writeOmssaUserModificationFile(java.io.File file)
Writes the OMSSA modification file corresponding to the PTMs loaded in
the factory in the given file.
|
public static final PTM unknownPTM
public static final java.lang.String SEARCH_SUFFIX
public static PTMFactory getInstance()
public void clearFactory()
public void reloadFactory()
public void saveFactory() throws java.io.IOException
java.io.IOException
- exception thrown whenever an error occurred while
saving the ptmFactorypublic PTM getPTM(ModificationProfile modificationProfile, int index)
index
- the PTM indexmodificationProfile
- the modification profile used for the searchpublic PTM getSearchedPTM(PTM modification)
modification
- the modification of interestpublic PTM getSearchedPTM(java.lang.String modificationName)
modificationName
- the name of the modification of interestpublic void addUserPTM(PTM ptm)
ptm
- the new modification to addpublic void removeUserPtm(java.lang.String ptmName)
ptmName
- the name of the PTM to removepublic PTM getPTM(java.lang.String name)
name
- the name of the desired PTMpublic boolean containsPTM(java.lang.String name)
name
- the name of the PTMpublic PTM getPTM(double mass, java.lang.String location, java.lang.String sequence)
mass
- the measured mass induced by the modificationlocation
- the modification locationsequence
- the peptide sequencepublic void importModifications(java.io.File modificationsFile, boolean userMod) throws org.xmlpull.v1.XmlPullParserException, java.io.IOException
modificationsFile
- A file containing modificationsuserMod
- A boolean indicating whether the file comprises user
designed modificationorg.xmlpull.v1.XmlPullParserException
- exception thrown whenever an error is
encountered while parsingjava.io.IOException
- exception thrown whenever an error is encountered
reading the filepublic void importModifications(java.io.File modificationsFile, boolean userMod, boolean overwrite) throws org.xmlpull.v1.XmlPullParserException, java.io.IOException
modificationsFile
- A file containing modificationsuserMod
- A boolean indicating whether the file comprises user
designed modificationoverwrite
- a boolean indicating whether modifications from the xml
file should be overwrittenorg.xmlpull.v1.XmlPullParserException
- exception thrown whenever an error is
encountered while parsingjava.io.IOException
- exception thrown whenever an error is encountered
reading the filepublic java.lang.Integer getDefaultOMSSAIndex(java.lang.String modificationName)
modificationName
- the name of the modificationpublic static java.util.HashMap<java.lang.String,java.lang.Integer> getOMSSAIndexes(java.io.File modificationsFile) throws org.xmlpull.v1.XmlPullParserException, java.io.FileNotFoundException, java.io.IOException
modificationsFile
- the modification fileorg.xmlpull.v1.XmlPullParserException
java.io.FileNotFoundException
java.io.IOException
public void writeOmssaModificationsFiles(java.io.File aFolder, java.io.File utilitiesModFile, java.io.File utilitiesUserModFile) throws java.io.IOException
aFolder
- the folder to write the modification files toutilitiesModFile
- the utilities corresponding mod fileutilitiesUserModFile
- the utilities corresponding usermod filejava.io.IOException
- an IOException is thrown in case an issue is
encountered while reading or writing a file.public void writeOmssaUserModificationFile(java.io.File file) throws java.io.IOException
file
- the filejava.io.IOException
- exception thrown whenever an error occurred while
writing the filepublic java.lang.String getOmssaUserModBloc(java.lang.String ptmName, int cpt)
ptmName
- the name of the PTMcpt
- the index of this PTMpublic java.util.ArrayList<java.lang.String> getDefaultModifications()
public java.util.ArrayList<java.lang.String> getUserModifications()
public java.util.ArrayList<java.lang.String> getPTMs()
public boolean isUserDefined(java.lang.String ptmName)
ptmName
- public java.util.ArrayList<java.lang.String> loadBackedUpModifications(SearchParameters searchParameters, boolean overwrite)
searchParameters
- the search parameters to loadoverwrite
- if true, overwrite the modificationpublic java.util.HashMap<java.lang.Integer,java.util.ArrayList<java.lang.String>> getExpectedPTMs(ModificationProfile modificationProfile, Peptide peptide, double modificationMass, double massTolerance) throws java.io.IOException, java.lang.IllegalArgumentException, java.lang.InterruptedException
modificationProfile
- the modification profile used for the search
(available in the search parameters)peptide
- the peptide identified with the parent proteins (necessary
for protein termini modifications)modificationMass
- the modification mass as found in the search
resultsmassTolerance
- the mass tolerance to use to match the modification
massjava.io.IOException
- exception thrown whenever an error occurred while
reading a protein sequencejava.lang.IllegalArgumentException
- exception thrown whenever an error
occurred while reading a protein sequencejava.lang.InterruptedException
- exception thrown whenever an error occurred
while reading a protein sequencepublic java.util.HashMap<java.lang.Integer,java.util.ArrayList<java.lang.String>> getExpectedPTMs(ModificationProfile modificationProfile, Peptide peptide, java.lang.String ptmName) throws java.io.IOException, java.lang.IllegalArgumentException, java.lang.InterruptedException
modificationProfile
- the modification profile used for the search
(available in the search parameters)peptide
- the peptideptmName
- the name of the searched PTMjava.io.IOException
- exception thrown whenever an error occurred while
reading a protein sequencejava.lang.IllegalArgumentException
- exception thrown whenever an error
occurred while reading a protein sequencejava.lang.InterruptedException
- exception thrown whenever an error occurred
while reading a protein sequencepublic void checkFixedModifications(ModificationProfile modificationProfile, Peptide peptide) throws java.io.IOException, java.lang.IllegalArgumentException, java.lang.InterruptedException
modificationProfile
- peptide
- java.io.IOException
- exception thrown whenever an error occurred while
reading a protein sequencejava.lang.IllegalArgumentException
- exception thrown whenever an error
occurred while reading a protein sequencejava.lang.InterruptedException
- exception thrown whenever an error occurred
while reading a protein sequencepublic void setSearchedOMSSAIndexes(ModificationProfile modificationProfile)
modificationProfile
- the modification profile of this searchpublic void setDefaultNeutralLosses()
public void setDefaultReporterIons()
public void setShortName(java.lang.String modification, java.lang.String shortName)
modification
- the modification nameshortName
- the short namepublic java.lang.String getShortName(java.lang.String modification)
modification
- the name of the modificationpublic static java.lang.String getDefaultShortName(java.lang.String modificationName)
modificationName
- the full name of the modificationpublic java.awt.Color getColor(java.lang.String modification)
modification
- the name of the given expected modificationpublic void setColor(java.lang.String expectedModification, java.awt.Color color)
expectedModification
- the name of the expected modificationcolor
- the new colorpublic static java.awt.Color getDefaultColor(java.lang.String modification)
modification
- the name of the modificationCopyright © 2013. All Rights Reserved.