public class ModificationFactory extends Object implements Serializable
Modifier and Type | Field and Description |
---|---|
boolean |
defaultModsSorted
Set to true if the default mods are sorted alphabetically.
|
static String |
SINGLE_AA_SUFFIX
Suffix for the modification clone targeting a single amino acid instead
of a pattern.
|
boolean |
usersModsSorted
Set to true if the users mods are sorted alphabetically.
|
Modifier and Type | Method and Description |
---|---|
void |
addUserModification(Modification modification)
Adds a new user modification.
|
void |
clearFactory()
Clears the factory getInstance() needs to be called afterwards.
|
boolean |
containsModification(String name)
Returns a boolean indicating whether the Modification is loaded in the factory.
|
String |
convertPridePtm(String pridePtmName,
ModificationParameters modProfile,
ArrayList<String> unknownPtms,
boolean isFixed)
Tries to convert a PRIDE Modification to utilities Modification 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.
|
static ModificationFactory |
getInstance()
Static method to get the instance of the factory.
|
Modification |
getModification(String name)
Returns the Modification indexed by its name.
|
ArrayList<String> |
getModifications()
Returns the names of all imported Modifications.
|
static String |
getSerializationFolder()
Returns the folder where the factory is saved.
|
static Modification |
getSingleAAModification(Modification modification)
Returns a clone of the given Modification targeting a single amino acid instead of
a pattern.
|
Modification |
getSingleAAModification(String modificationName)
Returns a clone of the given Modification targeting a single amino acid instead of
a pattern.
|
ArrayList<String> |
getUserModifications()
Returns the names of the user defined modifications.
|
ArrayList<String> |
getUserModificationsOrdered()
Returns the alphabetically ordered names of the user defined
modifications.
|
boolean |
isUserDefined(String modificationName)
Convenience method returning a boolean indicating whether a Modification 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.
|
static ModificationFactory |
loadFromFile(File file)
Loads an enzyme factory from a file.
|
void |
reloadFactory()
Reloads the factory getInstance() needs to be called afterwards.
|
void |
removeUserPtm(String modificationName)
Removes a user Modification.
|
void |
saveFactory()
Saves the factory in the user folder.
|
static void |
saveToFile(ModificationFactory modificationFactory,
File file)
Saves a Modification factory to a file.
|
void |
setColor(String expectedModification,
Color color)
Sets a new color for the given expected modification.
|
static void |
setSerializationFolder(String serializationFolder)
Sets the folder where the factory is saved.
|
public static final String SINGLE_AA_SUFFIX
public boolean defaultModsSorted
public boolean usersModsSorted
public static ModificationFactory getInstance()
public static ModificationFactory loadFromFile(File file) throws IOException
file
- the file to loadIOException
- exception thrown whenever an error occurred while
loading the filepublic static void saveToFile(ModificationFactory modificationFactory, File file) throws IOException
modificationFactory
- the Modification factory to savefile
- the file where to saveIOException
- exception thrown whenever an error occurred while
saving the filepublic void clearFactory()
public void reloadFactory()
public void saveFactory() throws IOException
IOException
- exception thrown whenever an error occurred while
saving the modificationFactorypublic static Modification getSingleAAModification(Modification modification)
modification
- the modification of interestpublic Modification getSingleAAModification(String modificationName)
modificationName
- the name of the modification of interestpublic void addUserModification(Modification modification)
modification
- the new modification to addpublic void removeUserPtm(String modificationName)
modificationName
- the name of the Modification to removepublic Modification getModification(String name)
name
- the name of the modification of interestpublic boolean containsModification(String name)
name
- the name of the Modificationpublic ArrayList<String> getDefaultModifications()
public ArrayList<String> getDefaultModificationsOrdered()
public ArrayList<String> getUserModifications()
public ArrayList<String> getUserModificationsOrdered()
public ArrayList<String> getModifications()
public boolean isUserDefined(String modificationName)
modificationName
- the name of the Modificationpublic ArrayList<String> loadBackedUpModifications(SearchParameters searchParameters, boolean overwrite)
searchParameters
- the search parameters to loadoverwrite
- if true, overwrite 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, ModificationParameters modProfile, ArrayList<String> unknownPtms, boolean isFixed)
pridePtmName
- the PRIDE Modification namemodProfile
- the modification profile to add the Modifications tounknownPtms
- the list of unknown ModificationS, updated during this methodisFixed
- if true, the Modification will be added as a fixed modificationpublic static String getSerializationFolder()
public static void setSerializationFolder(String serializationFolder)
serializationFolder
- the folder where the factory is savedCopyright © 2018. All rights reserved.