Package org.forester.util
Class ForesterUtil
java.lang.Object
org.forester.util.ForesterUtil
- 
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final Stringstatic final NumberFormatstatic final NumberFormatstatic final NumberFormatstatic final NumberFormatstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final BigDecimalstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final double - 
Method Summary
Modifier and TypeMethodDescriptionstatic final voidappendSeparatorIfNotEmpty(StringBuffer sb, char separator) static final ColorcalcColor(double value, double min, double max, double mean, Color minColor, Color maxColor, Color meanColor) This calculates a color.static final ColorThis calculates a color.static intcalculateOverlap(Domain domain, List<Boolean> covered_positions) static final Stringstatic final voidcollection2file(File file, Collection<?> data, String separator) static final voidcollection2writer(Writer writer, Collection<?> data, String separator) static final StringcolorToHex(Color color) static voidstatic final intcountChars(String str, char c) static final BufferedWritercreateBufferedWriter(File file) static final BufferedWritercreateBufferedWriter(String name) static final EasyWritercreateEasyWriter(File file) static final BufferedWritercreateEasyWriter(String name) static final FilecreateFileForWriting(String name) static final voidstatic final voidstatic voidstatic voidstatic voidfatalError(String message) static voidfatalError(String prg_name, String message) static voidstatic voidfatalErrorIfFileNotReadable(String prg_name, File file) static String[][]file22dArray(File file) static String[]file2array(File file) static final Stringstatic final Stringstatic final StringgetFirstLine(Object source) static final Stringstatic final Stringstatic final MolecularSequence.TYPEguessMolecularSequenceType(String mol_seq) static final voidincreaseCountingMap(Map<String, Integer> counting_map, String item_name) static final booleanstatic final booleanstatic final booleanstatic booleanisEngulfed(Domain domain, List<Boolean> covered_positions) Returns true is Domain domain falls in an uninterrupted stretch of covered positions.static final booleanisEqual(double a, double b) static final booleanisEven(int n) static final booleanisIntersecting(String[] a, String[] b) This determines whether String[] a and String[] b have at least one String in common (intersect).static final doubleisLargerOrEqualToZero(double d) static final booleanisMac()static final booleanisNull(BigDecimal s) static final Stringstatic final Stringstatic final booleanstatic final Stringstatic final intlimitRangeForColor(int i) Helper for method "stringToColor".listToSortedCountsMap(List<?> list) static final voidstatic final voidmap2writer(Writer writer, Map<?, ?> data, String entry_separator, String data_separator) static final StringBuffermapToStringBuffer(Map<Object, Object> map, String key_value_separator) static final StringnormalizeString(String s, int length, boolean left_pad, char pad_char) static final ColorobtainColorDependingOnTaxonomyGroup(String tax_group) static final Stringstatic final BufferedReaderobtainReader(Object source) static final voidstatic final StringBufferpad(double number, int size, char pad, boolean left_pad) static final StringBufferpad(StringBuffer string, int size, char pad, boolean left_pad) static final StringBufferstatic final doubleparseDouble(String str) static final intstatic final voidprintArray(Object[] a) static final voidprintCountingMap(Map<String, Integer> counting_map) static final voidprintErrorMessage(String prg_name, String message) static final voidprintProgramInformation(String prg_name, String prg_version, String date) static final voidstatic final voidprintProgramInformation(String prg_name, String desc, String prg_version, String date, String email, String www, String based_on) static final voidprintWarningMessage(String prg_name, String message) static final voidprogramMessage(String prg_name, String message) static ProteinremoveOverlappingDomains(int max_allowed_overlap, boolean remove_engulfed_domains, Protein protein) Example regarding engulfment: ------------0.1 ----------0.2 --0.3 => domain with 0.3 is ignored -----------0.1 ----------0.2 --0.3 => domain with 0.3 is ignored ------------0.1 ----------0.3 --0.2 => domains with 0.3 and 0.2 are _not_ ignoredstatic final StringremoveSuffix(String file_name) static final StringRemoves all white space from String s.static final Stringstatic final doubleround(double value, int decimal_place) static final introundToInt(double d) Rounds d to an int.static final introundToInt(float f) static final shortroundToShort(double d) static final Stringstatic final StringBuildersantitizeStringForNH(String data) static booleanstatic final Stringstatic final StringstringArrayToString(String[] a, String separator) static final String[]stringListToArray(List<String> list) static final StringstringListToString(List<String> l, String separator) static final String[]stringSetToArray(Set<String> strings) static final voidstatic final voidstatic final voidunexpectedFatalError(String message) static final voidunexpectedFatalError(String prg_name, Exception e) static final voidunexpectedFatalError(String prg_name, String message) static final voidunexpectedFatalError(String prg_name, String message, Exception e) static final voidupdateProgress(double progress_percentage) static final voidupdateProgress(int i, DecimalFormat f) static final String 
- 
Field Details
- 
FILE_SEPARATOR
 - 
FORMATTER_06
 - 
FORMATTER_3
 - 
FORMATTER_6
 - 
FORMATTER_9
 - 
JAVA_VENDOR
 - 
JAVA_VERSION
 - 
LINE_SEPARATOR
 - 
NCBI_GI
- See Also:
 
 - 
NCBI_NUCCORE
- See Also:
 
 - 
NCBI_PROTEIN
- See Also:
 
 - 
NULL_BD
 - 
OS_ARCH
 - 
OS_NAME
 - 
OS_VERSION
 - 
PDB
- See Also:
 
 - 
UNIPROT_KB
- See Also:
 
 - 
ZERO_DIFF
public static final double ZERO_DIFF- See Also:
 
 
 - 
 - 
Method Details
- 
appendSeparatorIfNotEmpty
 - 
calcColor
public static final Color calcColor(double value, double min, double max, Color minColor, Color maxColor) This calculates a color. If value is equal to min the returned color is minColor, if value is equal to max the returned color is maxColor, otherwise a color 'proportional' to value is returned.- Parameters:
 value- the valuemin- the smallest valuemax- the largest valueminColor- the color for minmaxColor- the color for max- Returns:
 - a Color
 
 - 
calcColor
public static final Color calcColor(double value, double min, double max, double mean, Color minColor, Color maxColor, Color meanColor) This calculates a color. If value is equal to min the returned color is minColor, if value is equal to max the returned color is maxColor, if value is equal to mean the returned color is meanColor, otherwise a color 'proportional' to value is returned -- either between min-mean or mean-max- Parameters:
 value- the valuemin- the smallest valuemax- the largest valuemean- the mean/median valueminColor- the color for minmaxColor- the color for maxmeanColor- the color for mean- Returns:
 - a Color
 
 - 
calculateOverlap
 - 
collapseWhiteSpace
 - 
collection2file
public static final void collection2file(File file, Collection<?> data, String separator) throws IOException - Throws:
 IOException
 - 
collection2writer
public static final void collection2writer(Writer writer, Collection<?> data, String separator) throws IOException - Throws:
 IOException
 - 
colorToHex
 - 
copyFile
- Throws:
 IOException
 - 
countChars
 - 
createBufferedWriter
- Throws:
 IOException
 - 
createBufferedWriter
- Throws:
 IOException
 - 
createEasyWriter
- Throws:
 IOException
 - 
createEasyWriter
- Throws:
 IOException
 - 
createFileForWriting
- Throws:
 IOException
 - 
ensurePresenceOfDate
 - 
ensurePresenceOfDistribution
 - 
ensurePresenceOfSequence
 - 
ensurePresenceOfTaxonomy
 - 
fatalError
 - 
fatalError
 - 
fatalErrorIfFileNotReadable
 - 
fatalErrorIfFileNotReadable
 - 
file22dArray
- Throws:
 IOException
 - 
file2array
- Throws:
 IOException
 - 
file2list
- Throws:
 IOException
 - 
file2set
- Throws:
 IOException
 - 
getCurrentDateTime
 - 
getFileSeparator
 - 
getFirstLine
- Throws:
 FileNotFoundExceptionIOException
 - 
getForesterLibraryInformation
 - 
getLineSeparator
 - 
guessMolecularSequenceType
 - 
increaseCountingMap
 - 
isEmpty
 - 
isEmpty
 - 
isEmpty
 - 
isEngulfed
Returns true is Domain domain falls in an uninterrupted stretch of covered positions.- Parameters:
 domain-covered_positions-- Returns:
 
 - 
isEqual
public static final boolean isEqual(double a, double b)  - 
isEven
public static final boolean isEven(int n)  - 
isIntersecting
This determines whether String[] a and String[] b have at least one String in common (intersect). Returns false if at least one String[] is null or empty.- Parameters:
 a- a String[] b a String[]- Returns:
 - true if both a and b or not empty or null and contain at least one element in common false otherwise
 
 - 
isLargerOrEqualToZero
public static final double isLargerOrEqualToZero(double d)  - 
isMac
public static final boolean isMac() - 
isNull
 - 
isReadableFile
 - 
isReadableFile
 - 
isWindows
public static final boolean isWindows() - 
isWritableFile
 - 
limitRangeForColor
public static final int limitRangeForColor(int i) Helper for method "stringToColor".(Last modified: 12/20/03)
 - 
listToSortedCountsMap
 - 
map2file
public static final void map2file(File file, Map<?, ?> data, String entry_separator, String data_separator) throws IOException- Throws:
 IOException
 - 
map2writer
public static final void map2writer(Writer writer, Map<?, ?> data, String entry_separator, String data_separator) throws IOException- Throws:
 IOException
 - 
mapToStringBuffer
public static final StringBuffer mapToStringBuffer(Map<Object, Object> map, String key_value_separator)  - 
normalizeString
 - 
obtainColorDependingOnTaxonomyGroup
 - 
obtainNormalizedTaxonomyGroup
 - 
obtainReader
public static final BufferedReader obtainReader(Object source) throws IOException, FileNotFoundException - Throws:
 IOExceptionFileNotFoundException
 - 
outOfMemoryError
 - 
pad
 - 
pad
 - 
pad
 - 
parseDouble
- Throws:
 ParseException
 - 
parseInt
- Throws:
 ParseException
 - 
printArray
 - 
printCountingMap
 - 
printErrorMessage
 - 
printProgramInformation
 - 
printProgramInformation
 - 
printProgramInformation
 - 
printWarningMessage
 - 
programMessage
 - 
readUrl
- Throws:
 IOException
 - 
removeOverlappingDomains
public static Protein removeOverlappingDomains(int max_allowed_overlap, boolean remove_engulfed_domains, Protein protein) Example regarding engulfment: ------------0.1 ----------0.2 --0.3 => domain with 0.3 is ignored -----------0.1 ----------0.2 --0.3 => domain with 0.3 is ignored ------------0.1 ----------0.3 --0.2 => domains with 0.3 and 0.2 are _not_ ignored- Parameters:
 max_allowed_overlap- maximal allowed overlap (inclusive) to be still considered not overlapping (zero or negative value to allow any overlap)remove_engulfed_domains- to remove domains which are completely engulfed by coverage of domains with better supportprotein-- Returns:
 
 - 
removeSuffix
 - 
removeWhiteSpace
Removes all white space from String s.- Returns:
 - String s with white space removed
 
 - 
replaceIllegalNhxCharacters
 - 
round
public static final double round(double value, int decimal_place)  - 
roundToInt
public static final int roundToInt(double d) Rounds d to an int. - 
roundToInt
public static final int roundToInt(float f)  - 
roundToShort
public static final short roundToShort(double d)  - 
sanitizeString
 - 
santitizeStringForNH
 - 
seqIsLikelyToBeAa
 - 
stringArrayToString
 - 
stringArrayToString
 - 
stringListToArray
 - 
stringListToString
 - 
stringSetToArray
 - 
unexpectedFatalError
 - 
unexpectedFatalError
 - 
unexpectedFatalError
 - 
unexpectedFatalError
 - 
unexpectedFatalError
 - 
unexpectedFatalError
 - 
updateProgress
public static final void updateProgress(double progress_percentage)  - 
updateProgress
 - 
wordWrap
 
 -