Class SugarRemovalUtilityCmdApplication
- Version:
- 1.3.2.1
- Author:
- Jonas Schaub
-
Field Summary
-
Constructor Summary
ConstructorDescriptionConstructor that parses the command-line arguments and instantiates this class and the SugarRemovalUtility with the given settings. -
Method Summary
Modifier and TypeMethodDescriptionvoid
execute()
Executes the application.static boolean
isLegalTypeOfMoietiesToRemove
(int aTypeOfMoietiesToRemove) Checks whether the given integer number is mapped to a type of moieties to remove, i.e.boolean
Returns true if the -h --help or -v --version options were used at the command-line.
-
Field Details
-
VERSION
Version string of this class to print out if -v --version is queried from the command-line.- See Also:
-
-
Constructor Details
-
SugarRemovalUtilityCmdApplication
Constructor that parses the command-line arguments and instantiates this class and the SugarRemovalUtility with the given settings. If the -h --help or -v --version options are given, the remaining arguments are not parsed and the application should be exited.
The command line arguments 'args' must be constructed as follows:* option -h --help: Print usage and help information regarding the required command-line arguments and options. If this option is used, the constructor is exited afterwards.
* option -v --version: Print version string of the Sugar Removal Utility Command-Line Application. If this option is used, the constructor is exited afterwards.* option -i --inputFilePath <filePath>: Path to the input file, either absolute or relative to the current directory. Example: "D:\Project_Sugar_Removal\SugarRemovalUtility CMD App\smiles_test_file.txt" or "smiles_test_file.txt" if the console is already in the "SugarRemovalUtility CMD App" directory. The backslashes '\' are used in a Microsoft Windows operating system; it should be slash '/' in a Unix shell. Double quotes " are not mandatory but recommended to allow for spaces in the path. The path must not be empty and the given file must exist and be accessible and readable. The file type extension is not important for the determination of the file type, but it must be specified in the path. Accepted input formats: MDL Molfile, MDL Structure data file (SDF) and SMILES files (of format: [SMILES string][space][name] in each line, see example file). The final test for whether the file is suitable is done in execute(). This option and its argument are always required.
* option -t --typeOfMoietiesToRemove <integer>: A number of ["1","2","3"] indicating which type of sugar moieties should be removed, "1" for circular sugar moieties, "2" for linear sugar moieties, or "3" for circular AND linear sugar moieties. Check isLegalTypeOfMoietiesToRemove(int) for the correct mapping of value to option. This option and its argument are always required.* option -glyBond --detectCircSugOnlyWithGlyBond <boolean>: Either "true" or "false", indicating whether circular sugars should be detected (and removed) only if they have an O-glycosidic bond to another moiety or the core of the molecule. Any other value of this argument will be interpreted as "false". Default: "false". This option is optional.
* option -remTerm,--removeOnlyTerminalSugars <boolean>: Either "true" or "false", indicating whether only terminal sugar moieties should be removed. Any other value of this argument will be interpreted as "false". Default: "true". Important note: If this setting is set to "true", the input molecules must all consist of one connected structure, respectively. If they already contain multiple, disconnected structures (e.g. counter-ions), the respective molecules are ignored. This option is optional.
* option -presMode --preservationModeOption <integer>: A number of ["0","1","2"] indicating which preservation mode to use. This specifies under what circumstances to discard structures that get disconnected from the central core in the sugar removal process, "0" to preserve all disconnected structures (note: this might lead to no circular sugar moieties being detected, depending on the other settings), "1" to remove disconnected structures that do not have enough heavy atoms, or "2" to remove disconnected structures that do not have a sufficient molecular weight. Default: "1" (judge disconnected structures by their heavy atom count). check SugarRemovalUtility.PreservationModeOption enum for the correct mapping of value to option, it corresponds to the ordinal values of the enum constants. This option is optional.
* option -presThres --preservationModeThreshold <integer>: An integer number giving the threshold of the preservation mode, i.e. how many heavy atoms a disconnected structure needs to have at least to be not removed or how heavy (in terms of its molecular weight) it needs to be. Default: "5" (heavy atoms). The integer number must be positive. If the option -presMode --preservationModeOption was passed the value "0" (preserve all structures), this option must also be passed a zero value. In the opposite case, this option must be passed a non-zero value if the option -presMode --preservationModeOption was given the value 1 or 2. This option is optional.
* option -oxyAtoms --detectCircSugOnlyWithEnoughExocycOxyAtoms <boolean>: Either "true" or "false", indicating whether circular sugars should be detected (and removed) only if they have a sufficient number of attached exocyclic oxygen atoms. Any other value of this argument will be interpreted as "false". Default: "true". This option is optional.
* option -oxyAtomsThres --exocycOxyAtomsToAtomsInRingRatioThreshold <number>: A number giving the minimum attached exocyclic oxygen atoms to atom number in the ring ratio a circular sugar needs to have to be detected as such. Default: "0.5" (a 6-membered ring needs at least 3 attached exocyclic oxygen atoms). If the option -oxyAtoms --detectCircSugOnlyWithEnoughExocycOxyAtoms was passed the value "false" (detect circular sugars neglecting their number of attached exocyclic oxygen atoms), this option must be passed a zero value. In the opposite case, this option must be passed a non-zero value if the option -oxyAtoms --detectCircSugOnlyWithEnoughExocycOxyAtoms was given the value "true". The number must be positive. This option is optional.
* option -linSugInRings --detectLinSugInRings <boolean>: Either "true" or "false", indicating whether linear sugars in rings should be detected (and removed). Any other value of this argument will be interpreted as "false". Default: "false". This option is optional.
* option -linSugMinSize --linSugCandidateMinimumSize <integer>: An integer number indicating the minimum number of carbon atoms a linear sugar needs to have to be detected as such. Default: "4". The integer number must be positive and higher than or equal to 1 and also smaller than the linear sugar candidate maximum size (option -linSugMaxSize --linSugCandidateMaximumSize). This option is optional.
* option -linSugMaxSize --linSugCandidateMaximumSize <integer>: An integer number indicating the maximum number of carbon atoms a linear sugar needs to have to be detected as such. Default: "7". The integer number must be positive and higher than or equal to 1 and also higher than the linear sugar candidate minimum size (option -linSugMinSize --linSugCandidateMinimumSize). This option is optional.
* option -linAcSug --detectLinAcidicSug <boolean>: Either "true" or "false", indicating whether linear acidic sugars should be included in the set of linear sugar patterns for the initial detection. Any other value of this argument will be interpreted as "false". Default: "false". This option is optional.
* option -circSugSpiro --detectSpiroRingsAsCircSug <boolean>: Either "true" or "false", indicating whether spiro rings (rings that share one atom with another cycle) should be included in the circular sugar detection. Any other value of this argument will be interpreted as "false". Default: "false". This option is optional.
* option -circSugKetoGroups --detectCircularSugarsWithKetoGroups <boolean>: Either "true" or "false", indicating whether circular sugar-like moieties with keto groups should be detected. Any other value of this argument will be interpreted as "false". Default: "false". This option is optional.Example (all settings in default): String[] args = new String[] {"-i", "smiles_test_file.txt", "-t", "3", "-glyBond", "false", "-remTerm", "true", "-presMode", "1", "-presThres", "5", "-oxyAtoms", "true", "-oxyAtomsThres", "0.5", "-linSugInRings", "false", "-linSugMinSize", "4", "-linSugMaxSize", "7", "-linAcSug", "false", "-circSugSpiro", "false", "-circSugKetoGroups", "false"};
- Throws:
IllegalArgumentException
- if any parameter does not meet the specified requirements
-
-
Method Details
-
wasHelpOrVersionQueried
public boolean wasHelpOrVersionQueried()Returns true if the -h --help or -v --version options were used at the command-line. In this case, the object is not properly instantiated and the application should be exited.- Returns:
- true if the application should be exited
-
execute
Executes the application. First, opens the given input file and determines its type. Then creates an output file and a log file in the same directory as the input file. All settings are printed to console. The molecule set is then iterated and all detected sugar moieties removed according to the given settings. All results are printed in the output file and a small summary is printed to console at the end.- Throws:
IOException
- if there are problems with reading and writing filesSecurityException
- if the application is forbidden to access required filesIllegalArgumentException
- if the given input file cannot be used or another setting in this class is erroneous
-
isLegalTypeOfMoietiesToRemove
public static boolean isLegalTypeOfMoietiesToRemove(int aTypeOfMoietiesToRemove) Checks whether the given integer number is mapped to a type of moieties to remove, i.e. whether it is an accepted input value for this option.- Parameters:
aTypeOfMoietiesToRemove
- an integer that is supposed to be mapped to a type of moiety to remove- Returns:
- true if the given value is valid for the respective option
-