Package org.forester.util
Class ForesterUtil
java.lang.Object
org.forester.util.ForesterUtil
-
Field Summary
Modifier and TypeFieldDescriptionstatic final String
static final NumberFormat
static final NumberFormat
static final NumberFormat
static final NumberFormat
static final String
static final String
static final String
static final String
static final String
static final String
static final BigDecimal
static final String
static final String
static final String
static final String
static final String
static final double
-
Method Summary
Modifier and TypeMethodDescriptionstatic final void
appendSeparatorIfNotEmpty
(StringBuffer sb, char separator) static final Color
calcColor
(double value, double min, double max, double mean, Color minColor, Color maxColor, Color meanColor) This calculates a color.static final Color
This calculates a color.static int
calculateOverlap
(Domain domain, List<Boolean> covered_positions) static final String
static final void
collection2file
(File file, Collection<?> data, String separator) static final void
collection2writer
(Writer writer, Collection<?> data, String separator) static final String
colorToHex
(Color color) static void
static final int
countChars
(String str, char c) static final BufferedWriter
createBufferedWriter
(File file) static final BufferedWriter
createBufferedWriter
(String name) static final EasyWriter
createEasyWriter
(File file) static final BufferedWriter
createEasyWriter
(String name) static final File
createFileForWriting
(String name) static final void
static final void
static void
static void
static void
fatalError
(String message) static void
fatalError
(String prg_name, String message) static void
static void
fatalErrorIfFileNotReadable
(String prg_name, File file) static String[][]
file22dArray
(File file) static String[]
file2array
(File file) static final String
static final String
static final String
getFirstLine
(Object source) static final String
static final String
static final MolecularSequence.TYPE
guessMolecularSequenceType
(String mol_seq) static final void
increaseCountingMap
(Map<String, Integer> counting_map, String item_name) static final boolean
static final boolean
static final boolean
static boolean
isEngulfed
(Domain domain, List<Boolean> covered_positions) Returns true is Domain domain falls in an uninterrupted stretch of covered positions.static final boolean
isEqual
(double a, double b) static final boolean
isEven
(int n) static final boolean
isIntersecting
(String[] a, String[] b) This determines whether String[] a and String[] b have at least one String in common (intersect).static final double
isLargerOrEqualToZero
(double d) static final boolean
isMac()
static final boolean
isNull
(BigDecimal s) static final String
static final String
static final boolean
static final String
static final int
limitRangeForColor
(int i) Helper for method "stringToColor".listToSortedCountsMap
(List<?> list) static final void
static final void
map2writer
(Writer writer, Map<?, ?> data, String entry_separator, String data_separator) static final StringBuffer
mapToStringBuffer
(Map<Object, Object> map, String key_value_separator) static final String
normalizeString
(String s, int length, boolean left_pad, char pad_char) static final Color
obtainColorDependingOnTaxonomyGroup
(String tax_group) static final String
static final BufferedReader
obtainReader
(Object source) static final void
static final StringBuffer
pad
(double number, int size, char pad, boolean left_pad) static final StringBuffer
pad
(StringBuffer string, int size, char pad, boolean left_pad) static final StringBuffer
static final double
parseDouble
(String str) static final int
static final void
printArray
(Object[] a) static final void
printCountingMap
(Map<String, Integer> counting_map) static final void
printErrorMessage
(String prg_name, String message) static final void
printProgramInformation
(String prg_name, String prg_version, String date) static final void
static final void
printProgramInformation
(String prg_name, String desc, String prg_version, String date, String email, String www, String based_on) static final void
printWarningMessage
(String prg_name, String message) static final void
programMessage
(String prg_name, String message) 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_ ignoredstatic final String
removeSuffix
(String file_name) static final String
Removes all white space from String s.static final String
static final double
round
(double value, int decimal_place) static final int
roundToInt
(double d) Rounds d to an int.static final int
roundToInt
(float f) static final short
roundToShort
(double d) static final String
static final StringBuilder
santitizeStringForNH
(String data) static boolean
static final String
static final String
stringArrayToString
(String[] a, String separator) static final String[]
stringListToArray
(List<String> list) static final String
stringListToString
(List<String> l, String separator) static final String[]
stringSetToArray
(Set<String> strings) static final void
static final void
static final void
unexpectedFatalError
(String message) static final void
unexpectedFatalError
(String prg_name, Exception e) static final void
unexpectedFatalError
(String prg_name, String message) static final void
unexpectedFatalError
(String prg_name, String message, Exception e) static final void
updateProgress
(double progress_percentage) static final void
updateProgress
(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:
FileNotFoundException
IOException
-
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:
IOException
FileNotFoundException
-
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
-