|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.compomics.util.experiment.biology.PTMFactory
public class PTMFactory
This factory will load PTM from an XML file and provide them on demand as standard class.
Field Summary | |
---|---|
static 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. |
Method Summary | |
---|---|
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(String name)
Returns a boolean indicating whether the PTM is loaded in the factory. |
String |
convertPridePtm(String pridePtmName,
ModificationProfile modProfile,
ArrayList<String> unknownPtms,
boolean isFixed)
Tries to convert a PRIDE PTM to utilities PTM name, and add it to the modification profile. |
Color |
getColor(String modification)
Returns the color used to code the given modification. |
static Color |
getDefaultColor(String modification)
Returns a default color based on the modification name. |
ArrayList<String> |
getDefaultModifications()
Returns the names of the default modifications. |
Integer |
getDefaultOMSSAIndex(String modificationName)
Returns the default OMSSA index of the modification. |
static String |
getDefaultShortName(String modificationName)
Returns a default short name for a given modification. |
HashMap<Integer,ArrayList<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. |
HashMap<Integer,ArrayList<String>> |
getExpectedPTMs(ModificationProfile modificationProfile,
Peptide peptide,
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 HashMap<String,Integer> |
getOMSSAIndexes(File modificationsFile)
Imports the OMSSA indexes from an XML file. |
String |
getOmssaUserModBloc(String ptmName,
int cpt)
Returns an MSModSpec bloc as present in the OMSSA user modification files for a given PTM. |
PTM |
getPTM(double mass,
String location,
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(String name)
Returns the PTM indexed by its name. |
ArrayList<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(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. |
String |
getShortName(String modification)
Returns the user favorite short name, a default short name otherwise. |
ArrayList<String> |
getUserModifications()
Returns the names of the user defined modifications. |
void |
importModifications(File modificationsFile,
boolean userMod)
Import modifications from a modification file. |
void |
importModifications(File modificationsFile,
boolean userMod,
boolean overwrite)
Import modifications from a modification file. |
boolean |
isUserDefined(String ptmName)
Convenience method returning a boolean indicating whether a PTM is user defined or default. |
ArrayList<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(String ptmName)
Removes a user PTM. |
void |
saveFactory()
Saves the factory in the user folder. |
void |
setColor(String expectedModification,
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(String modification,
String shortName)
Sets the short name for a modification. |
void |
writeOmssaModificationsFiles(File aFolder,
File utilitiesModFile,
File utilitiesUserModFile)
Write the OMSSA modification files to the given folder. |
void |
writeOmssaUserModificationFile(File file)
Writes the OMSSA modification file corresponding to the PTMs loaded in the factory in the given file. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final PTM unknownPTM
public static final String SEARCH_SUFFIX
Method Detail |
---|
public static PTMFactory getInstance()
public void clearFactory()
public void reloadFactory()
public void saveFactory() throws IOException
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 search
public PTM getSearchedPTM(PTM modification)
modification
- the modification of interest
public PTM getSearchedPTM(String modificationName)
modificationName
- the name of the modification of interest
public void addUserPTM(PTM ptm)
ptm
- the new modification to addpublic void removeUserPtm(String ptmName)
ptmName
- the name of the PTM to removepublic PTM getPTM(String name)
name
- the name of the desired PTM
public boolean containsPTM(String name)
name
- the name of the PTM
public PTM getPTM(double mass, String location, String sequence)
mass
- the measured mass induced by the modificationlocation
- the modification locationsequence
- the peptide sequence
public void importModifications(File modificationsFile, boolean userMod) throws org.xmlpull.v1.XmlPullParserException, IOException
modificationsFile
- A file containing modificationsuserMod
- A boolean indicating whether the file comprises user
designed modification
org.xmlpull.v1.XmlPullParserException
- exception thrown whenever an error is
encountered while parsing
IOException
- exception thrown whenever an error is encountered
reading the filepublic void importModifications(File modificationsFile, boolean userMod, boolean overwrite) throws org.xmlpull.v1.XmlPullParserException, 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 overwritten
org.xmlpull.v1.XmlPullParserException
- exception thrown whenever an error is
encountered while parsing
IOException
- exception thrown whenever an error is encountered
reading the filepublic Integer getDefaultOMSSAIndex(String modificationName)
modificationName
- the name of the modification
public static HashMap<String,Integer> getOMSSAIndexes(File modificationsFile) throws org.xmlpull.v1.XmlPullParserException, FileNotFoundException, IOException
modificationsFile
- the modification file
org.xmlpull.v1.XmlPullParserException
FileNotFoundException
IOException
public void writeOmssaModificationsFiles(File aFolder, File utilitiesModFile, File utilitiesUserModFile) throws IOException
aFolder
- the folder to write the modification files toutilitiesModFile
- the utilities corresponding mod fileutilitiesUserModFile
- the utilities corresponding usermod file
IOException
- an IOException is thrown in case an issue is
encountered while reading or writing a file.public void writeOmssaUserModificationFile(File file) throws IOException
file
- the file
IOException
- exception thrown whenever an error occurred while
writing the filepublic String getOmssaUserModBloc(String ptmName, int cpt)
ptmName
- the name of the PTMcpt
- the index of this PTM
public ArrayList<String> getDefaultModifications()
public ArrayList<String> getUserModifications()
public ArrayList<String> getPTMs()
public boolean isUserDefined(String ptmName)
ptmName
-
public ArrayList<String> loadBackedUpModifications(SearchParameters searchParameters, boolean overwrite)
searchParameters
- the search parameters to loadoverwrite
- if true, overwrite the modification
public HashMap<Integer,ArrayList<String>> getExpectedPTMs(ModificationProfile modificationProfile, Peptide peptide, double modificationMass, double massTolerance) throws IOException, IllegalArgumentException, InterruptedException, FileNotFoundException, ClassNotFoundException, FileNotFoundException
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
mass
IOException
- exception thrown whenever an error occurred while
reading a protein sequence
IllegalArgumentException
- exception thrown whenever an error
occurred while reading a protein sequence
InterruptedException
- exception thrown whenever an error occurred
while reading a protein sequence
FileNotFoundException
ClassNotFoundException
public HashMap<Integer,ArrayList<String>> getExpectedPTMs(ModificationProfile modificationProfile, Peptide peptide, String ptmName) throws IOException, IllegalArgumentException, InterruptedException, FileNotFoundException, ClassNotFoundException
modificationProfile
- the modification profile used for the search
(available in the search parameters)peptide
- the peptideptmName
- the name of the searched PTM
IOException
- exception thrown whenever an error occurred while
reading a protein sequence
IllegalArgumentException
- exception thrown whenever an error
occurred while reading a protein sequence
InterruptedException
- exception thrown whenever an error occurred
while reading a protein sequence
FileNotFoundException
ClassNotFoundException
public void checkFixedModifications(ModificationProfile modificationProfile, Peptide peptide) throws IOException, IllegalArgumentException, InterruptedException, FileNotFoundException, ClassNotFoundException
modificationProfile
- peptide
-
IOException
- exception thrown whenever an error occurred while
reading a protein sequence
IllegalArgumentException
- exception thrown whenever an error
occurred while reading a protein sequence
InterruptedException
- exception thrown whenever an error occurred
while reading a protein sequence
FileNotFoundException
ClassNotFoundException
public void setSearchedOMSSAIndexes(ModificationProfile modificationProfile)
modificationProfile
- the modification profile of this searchpublic void setDefaultNeutralLosses()
public void setDefaultReporterIons()
public void setShortName(String modification, String shortName)
modification
- the modification nameshortName
- the short namepublic String getShortName(String modification)
modification
- the name of the modification
public static String getDefaultShortName(String modificationName)
modificationName
- the full name of the modification
public Color getColor(String modification)
modification
- the name of the given expected modification
public void setColor(String expectedModification, Color color)
expectedModification
- the name of the expected modificationcolor
- the new colorpublic static Color getDefaultColor(String modification)
modification
- the name of the modification
public String convertPridePtm(String pridePtmName, ModificationProfile modProfile, ArrayList<String> unknownPtms, boolean isFixed)
pridePtmName
- the PRIDE PTM namemodProfile
- the modification profile to add the PTMs tounknownPtms
- the list of unknown PTMS, updated during this methodisFixed
- if true, the PTM will be added as a fixed modification
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |