procope.tools
Class Tools

java.lang.Object
  extended by procope.tools.Tools

public class Tools
extends Object

Contains helper methods used throughout the whole library.

This class is not instantiatable.

Author:
Jan Krumsiek

Field Summary
static String CALCULATORSFILE
           
static String CLUSTERERSFILE
           
static String CONFIGFILE
           
static String CONFIGPATH
           
static Map<String,Object> EMPTY_ANNOTATION_MAP
          An empty, immutable map of annotations, i.e.
static Map<String,String> EMPTY_STRING_MAP
          An empty, immutable String => String map
static String FULL_LIB_NAME
          Full program string assembled from libary name and version
static int GZIP_MAGIC
           
static String HOMEPAGE
          Homepage of the library
static String HOMEPAGE_DOCS
           
static String LIBRARY_NAME
          Name of this library
static int MINOVERLAP
          Default minimum overlap required for two complexes to be mapped to each other
static Random random
          Globally used random number generator, uses a Mersenne twister
static String VERSION
          Current version of this library
 
Method Summary
static double[] arrCopyOf(double[] original, int newLength)
          Exact copy of the Arrays#copyOf method from the Sun JRE 6.0 Copied into this project to assure Java 5.0 compatibility
static float[] arrCopyOf(float[] original, int newLength)
          Exact copy of the Arrays#copyOf method from the Sun JRE 6.0 Copied into this project to assure Java 5.0 compatibility
static int[] arrCopyOf(int[] original, int newLength)
          Exact copy of the Arrays#copyOf method from the Sun JRE 6.0 Copied into this project to assure Java 5.0 compatibility
static
<T> T[]
arrCopyOf(T[] original, int newLength)
          Exact copy of the Arrays#copyOf method from the Sun JRE 6.0 Copied into this project to assure Java 5.0 compatibility
static
<T,U> T[]
arrCopyOf(U[] original, int newLength, Class<? extends T[]> newType)
          Exact copy of the Arrays#copyOf method from the Sun JRE 6.0 Copied into this project to assure Java 5.0 compatibility
static String extractBaseFilename(String fullPath)
          Extract the base file name (without extension) from a full path
static String extractFilename(String fullPath)
          Extracts the file name from a full path
static int findMax(Collection<Integer> col)
          Returns the maximum of a given integer collection.
static String getTempFilename()
          Returns an unused temporary file name.
static boolean isGZIPed(String file)
          Determines whether a file contains a GZIP header
static Comparable max(Comparable first, Comparable second)
          Returns the maximum of two Comparable objects
static Comparable min(Comparable first, Comparable second)
          Returns the minimum of two Comparable objects
static Map<String,Object> parseAnnotations(String parse)
          Parse annotations from a string coming from a network or annotations file.
static void verifyAnnotationType(Object value)
          Checks whether a given object is an Integer, a Float or a List.
static void writeAnnotations(Map<String,Object> annotations, PrintWriter writer)
          Writes a given annotations set to a writer.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

MINOVERLAP

public static final int MINOVERLAP
Default minimum overlap required for two complexes to be mapped to each other

See Also:
Constant Field Values

random

public static Random random
Globally used random number generator, uses a Mersenne twister


EMPTY_ANNOTATION_MAP

public static final Map<String,Object> EMPTY_ANNOTATION_MAP
An empty, immutable map of annotations, i.e. a String => Object map


EMPTY_STRING_MAP

public static final Map<String,String> EMPTY_STRING_MAP
An empty, immutable String => String map


LIBRARY_NAME

public static final String LIBRARY_NAME
Name of this library

See Also:
Constant Field Values

VERSION

public static final String VERSION
Current version of this library

See Also:
Constant Field Values

FULL_LIB_NAME

public static final String FULL_LIB_NAME
Full program string assembled from libary name and version

See Also:
Constant Field Values

HOMEPAGE

public static final String HOMEPAGE
Homepage of the library

See Also:
Constant Field Values

HOMEPAGE_DOCS

public static final String HOMEPAGE_DOCS
See Also:
Constant Field Values

CONFIGPATH

public static final String CONFIGPATH

CONFIGFILE

public static final String CONFIGFILE

CLUSTERERSFILE

public static final String CLUSTERERSFILE

CALCULATORSFILE

public static final String CALCULATORSFILE

GZIP_MAGIC

public static final int GZIP_MAGIC
See Also:
Constant Field Values
Method Detail

extractFilename

public static String extractFilename(String fullPath)
Extracts the file name from a full path

Parameters:
fullPath - full path
Returns:
file name

extractBaseFilename

public static String extractBaseFilename(String fullPath)
Extract the base file name (without extension) from a full path

Parameters:
fullPath - full path
Returns:
base file name

min

public static Comparable min(Comparable first,
                             Comparable second)
Returns the minimum of two Comparable objects

Parameters:
first - first object
second - second object
Returns:
smaller object according to their natural ordering

max

public static Comparable max(Comparable first,
                             Comparable second)
Returns the maximum of two Comparable objects

Parameters:
first - first object
second - second object
Returns:
larger object according to their natural ordering

findMax

public static int findMax(Collection<Integer> col)
Returns the maximum of a given integer collection.

Parameters:
col - integer collection
Returns:
maximum value of the given collection

getTempFilename

public static String getTempFilename()
Returns an unused temporary file name. Uses the system's temp directory.

Returns:
path to temporary file

isGZIPed

public static boolean isGZIPed(String file)
Determines whether a file contains a GZIP header

Parameters:
file - path to file
Returns:
if the file is GZIPed

verifyAnnotationType

public static void verifyAnnotationType(Object value)
                                 throws ProCopeException
Checks whether a given object is an Integer, a Float or a List. Throws an exception if not.

Parameters:
value - object whose type will be checked
Throws:
ProCopeException - if the object is not an Integer, Float or List

writeAnnotations

public static void writeAnnotations(Map<String,Object> annotations,
                                    PrintWriter writer)
Writes a given annotations set to a writer.

Parameters:
annotations - annotations to be written
writer - the writer

parseAnnotations

public static Map<String,Object> parseAnnotations(String parse)
Parse annotations from a string coming from a network or annotations file.

Parameters:
parse - string to be parsed
Returns:
annotations parsed from that string

arrCopyOf

public static <T> T[] arrCopyOf(T[] original,
                                int newLength)
Exact copy of the Arrays#copyOf method from the Sun JRE 6.0 Copied into this project to assure Java 5.0 compatibility


arrCopyOf

public static <T,U> T[] arrCopyOf(U[] original,
                                  int newLength,
                                  Class<? extends T[]> newType)
Exact copy of the Arrays#copyOf method from the Sun JRE 6.0 Copied into this project to assure Java 5.0 compatibility


arrCopyOf

public static int[] arrCopyOf(int[] original,
                              int newLength)
Exact copy of the Arrays#copyOf method from the Sun JRE 6.0 Copied into this project to assure Java 5.0 compatibility


arrCopyOf

public static float[] arrCopyOf(float[] original,
                                int newLength)
Exact copy of the Arrays#copyOf method from the Sun JRE 6.0 Copied into this project to assure Java 5.0 compatibility


arrCopyOf

public static double[] arrCopyOf(double[] original,
                                 int newLength)
Exact copy of the Arrays#copyOf method from the Sun JRE 6.0 Copied into this project to assure Java 5.0 compatibility