org.genepattern.io
Class IOUtil

java.lang.Object
  extended byorg.genepattern.io.IOUtil

public class IOUtil
extends java.lang.Object

A class containing static convenience methods for reading and writing data


Method Summary
static IExpressionDataReader getExpressionReader(java.lang.String pathname)
          Gets an expression data reader that can read the document at the given pathname or null if no reader is found.
static IExpressionDataWriter getExpressionWriterByFormatName(java.lang.String formatName)
          Returns a IExpressionDataWriter that can encode the named format
static ClassVector readCls(java.lang.String pathname)
          Reads the cls document at the given pathname
static ExpressionData readExpressionData(java.lang.String pathname)
          Reads the expression data at the given pathname and returns a new ExpressionData instance.
static java.lang.Object readExpressionData(java.lang.String pathname, IExpressionDataCreator expressionDataCreator)
          Reads the expression data at the given pathname.
static java.util.List readFeatureList(java.lang.String pathname)
          Gets a list of features at the given file pathname string
static void readOdf(java.lang.String pathname, IOdfHandler handler)
          Parses the odf document at the given pathname using the specified handler
static java.lang.String write(IExpressionData data, java.lang.String formatName, java.lang.String pathname, boolean checkFileExtension)
          Writes expression data to a file in the given format.
static java.lang.String writeCls(ClassVector cv, java.lang.String pathname, boolean checkFileExtension)
          Writes the given class vector to a file
static void writeFeatureList(java.lang.String[] features, java.lang.String pathname)
          Writes the given feature list to a file
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

readCls

public static ClassVector readCls(java.lang.String pathname)
                           throws java.io.IOException,
                                  ParseException
Reads the cls document at the given pathname

Parameters:
pathname - The pathname string
Returns:
The class vector
Throws:
java.io.IOException - If an error occurs while reading from the file
ParseException - If there is a problem with the data

readFeatureList

public static java.util.List readFeatureList(java.lang.String pathname)
                                      throws java.io.IOException
Gets a list of features at the given file pathname string

Parameters:
pathname - The pathname string
Returns:
the feature list
Throws:
java.io.IOException - If an error occurs while reading from the file

writeFeatureList

public static void writeFeatureList(java.lang.String[] features,
                                    java.lang.String pathname)
                             throws java.io.IOException
Writes the given feature list to a file

Parameters:
features - The features
pathname - A pathname string
Throws:
java.io.IOException - If an error occurs while saving the data

readExpressionData

public static java.lang.Object readExpressionData(java.lang.String pathname,
                                                  IExpressionDataCreator expressionDataCreator)
                                           throws java.io.IOException,
                                                  ParseException
Reads the expression data at the given pathname. The type of the returned object is determined by the expressionDataCreator argument.

Parameters:
pathname - The file pathname
expressionDataCreator - The expression data creator
Returns:
An object containing the expression data
Throws:
java.io.IOException - If an error occurs while reading from the file
ParseException - If there is a problem with the data

readExpressionData

public static ExpressionData readExpressionData(java.lang.String pathname)
                                         throws java.io.IOException,
                                                ParseException
Reads the expression data at the given pathname and returns a new ExpressionData instance.

Parameters:
pathname - The file pathname
Returns:
An ExpressionData instance
Throws:
java.io.IOException - If an error occurs while reading from the file
ParseException - If there is a problem with the data

writeCls

public static java.lang.String writeCls(ClassVector cv,
                                        java.lang.String pathname,
                                        boolean checkFileExtension)
                                 throws java.io.IOException
Writes the given class vector to a file

Parameters:
cv - The class vector
pathname - A pathname string
checkFileExtension - Whether the correct file extension will be added to the pathname if it is not present.
Returns:
The pathname that the data was saved to
Throws:
java.io.IOException - If an error occurs while saving the data

write

public static java.lang.String write(IExpressionData data,
                                     java.lang.String formatName,
                                     java.lang.String pathname,
                                     boolean checkFileExtension)
                              throws java.io.IOException
Writes expression data to a file in the given format. The correct file extension will be added to the pathname if it is not present. If there is already a file present at the given pathname, its contents are discarded.

Parameters:
data - the expression data.
formatName - a String containing the informal name of a format (e.g., "res" or "gct".)
pathname - a pathname string
checkFileExtension - Whether the correct file extension will be added to the pathname if it is not present.
Returns:
The pathname that the data was saved to
Throws:
java.io.IOException - If an error occurs while saving the data

readOdf

public static void readOdf(java.lang.String pathname,
                           IOdfHandler handler)
                    throws ParseException,
                           java.io.IOException
Parses the odf document at the given pathname using the specified handler

Parameters:
pathname - A pathname string
handler - The odf handler
Returns:
true if the odf document was read successfully
Throws:
java.io.IOException - If an error occurs while reading from the file
ParseException - If there is a problem with the data

getExpressionReader

public static IExpressionDataReader getExpressionReader(java.lang.String pathname)
Gets an expression data reader that can read the document at the given pathname or null if no reader is found.

Parameters:
pathname - A pathname string
Returns:
The expression reader

getExpressionWriterByFormatName

public static IExpressionDataWriter getExpressionWriterByFormatName(java.lang.String formatName)
Returns a IExpressionDataWriter that can encode the named format

Parameters:
formatName - a String containing the informal name of a format (e.g., "res" or "gct".
Returns:
a IExpressionDataWriter that can encode in the specified format or null if no such IExpressionDataWriter exists.


Hosted by docs.bugaco.com