public class PTMFactory extends Object implements Serializable
Modifier and Type | Field and Description |
---|---|
boolean |
defaultModsSorted
Set to true if the default mods are sorted alphabetically.
|
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.
|
boolean |
usersModsSorted
Set to true if the users mods are sorted alphabetically.
|
Modifier and Type | Method and Description |
---|---|
void |
addUserPTM(PTM ptm)
Adds a new user modification.
|
void |
checkFixedModifications(ModificationProfile modificationProfile,
Peptide peptide,
AminoAcidPattern aminoAcidPattern,
int patternLength,
ProteinMatch.MatchingType matchingType,
Double massTolerance)
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.
|
ArrayList<String> |
getDefaultModificationsOrdered()
Returns the alphabetically ordered 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,
ProteinMatch.MatchingType matchingType)
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,
ProteinMatch.MatchingType matchingType,
Double massTolerance)
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.
|
ArrayList<String> |
getUserModificationsOrdered()
Returns the alphabetically ordered 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.
|
public static final PTM unknownPTM
public static final String SEARCH_SUFFIX
public boolean defaultModsSorted
public boolean usersModsSorted
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 searchpublic PTM getSearchedPTM(PTM modification)
modification
- the modification of interestpublic PTM getSearchedPTM(String modificationName)
modificationName
- the name of the modification of interestpublic 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 PTMpublic boolean containsPTM(String name)
name
- the name of the PTMpublic PTM getPTM(double mass, String location, String sequence)
mass
- the measured mass induced by the modificationlocation
- the modification locationsequence
- the peptide sequencepublic 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 modificationorg.xmlpull.v1.XmlPullParserException
- exception thrown whenever an error is
encountered while parsingIOException
- 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 overwrittenorg.xmlpull.v1.XmlPullParserException
- exception thrown whenever an error is
encountered while parsingIOException
- exception thrown whenever an error is encountered
reading the filepublic Integer getDefaultOMSSAIndex(String modificationName)
modificationName
- the name of the modificationpublic static HashMap<String,Integer> getOMSSAIndexes(File modificationsFile) throws org.xmlpull.v1.XmlPullParserException, FileNotFoundException, IOException
modificationsFile
- the modification fileorg.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 fileIOException
- 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 fileIOException
- 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 PTMpublic ArrayList<String> getDefaultModifications()
public ArrayList<String> getDefaultModificationsOrdered()
public ArrayList<String> getUserModifications()
public ArrayList<String> getUserModificationsOrdered()
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 modificationpublic HashMap<Integer,ArrayList<String>> getExpectedPTMs(ModificationProfile modificationProfile, Peptide peptide, double modificationMass, double massTolerance, ProteinMatch.MatchingType matchingType) 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
massmatchingType
- the type of sequence matchingIOException
- exception thrown whenever an error occurred while
reading a protein sequenceIllegalArgumentException
- exception thrown whenever an error
occurred while reading a protein sequenceInterruptedException
- exception thrown whenever an error occurred
while reading a protein sequenceFileNotFoundException
ClassNotFoundException
public HashMap<Integer,ArrayList<String>> getExpectedPTMs(ModificationProfile modificationProfile, Peptide peptide, String ptmName, ProteinMatch.MatchingType matchingType, Double massTolerance) 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 PTMmatchingType
- the matching typemassTolerance
- the mass tolerance for matching type
'indistiguishibleAminoAcids'. Can be null otherwiseIOException
- exception thrown whenever an error occurred while
reading a protein sequenceIllegalArgumentException
- exception thrown whenever an error
occurred while reading a protein sequenceInterruptedException
- exception thrown whenever an error occurred
while reading a protein sequenceFileNotFoundException
ClassNotFoundException
public void checkFixedModifications(ModificationProfile modificationProfile, Peptide peptide, AminoAcidPattern aminoAcidPattern, int patternLength, ProteinMatch.MatchingType matchingType, Double massTolerance) throws IOException, IllegalArgumentException, InterruptedException, FileNotFoundException, ClassNotFoundException
modificationProfile
- peptide
- the peptideaminoAcidPattern
- the amino acid patternpatternLength
- the peptide lengthmatchingType
- the matching type to map the peptide sequence onto
the protein sequence for modificationsmassTolerance
- the mass tolerance for matching type
'indistiguishibleAminoAcids'. Can be null otherwise. (Only useful when
considering modifications targeting a motif comprising interchangeable
amino acids, e.g., glyco)IOException
- exception thrown whenever an error occurred while
reading a protein sequenceIllegalArgumentException
- exception thrown whenever an error
occurred while reading a protein sequenceInterruptedException
- exception thrown whenever an error occurred
while reading a protein sequenceFileNotFoundException
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 modificationpublic static String getDefaultShortName(String modificationName)
modificationName
- the full name of the modificationpublic Color getColor(String modification)
modification
- the name of the given expected modificationpublic 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 modificationpublic 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 modificationCopyright © 2013. All Rights Reserved.