procope.data.networks
Class NetworkReader

java.lang.Object
  extended by procope.data.networks.NetworkReader

public class NetworkReader
extends Object

Contains various static methods to read networks from files and streams.

Check out NetworkWriter to get further information about the format in which network edges will be stored.

This class is not instantiatable.

Author:
Jan Krumsiek

Method Summary
static ProteinNetwork readNetwork(File file)
          Reads an undirected network from a given file.
static ProteinNetwork readNetwork(File file, boolean directed)
          Reads a network from a given file.
static ProteinNetwork readNetwork(InputStream input)
          Reads an undirected network from a given InputStream.
static ProteinNetwork readNetwork(InputStream input, boolean directed)
          Reads a network from a given InputStream.
static ProteinNetwork readNetwork(String file)
          Reads an undirected network from a given file.
static ProteinNetwork readNetwork(String file, boolean directed)
          Reads a network from a given file.
static void setSeparator(String newSeparator)
          Set the separator used to divide protein identifiers, scores and eventual annotations in each line of the network data.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

setSeparator

public static void setSeparator(String newSeparator)
Set the separator used to divide protein identifiers, scores and eventual annotations in each line of the network data.

Be careful to use any separators besides the whitespace and TAB character as parsing problems might occur.

Parameters:
newSeparator - new separator

readNetwork

public static ProteinNetwork readNetwork(String file)
                                  throws IOException
Reads an undirected network from a given file.

Parameters:
file - file to read network from
Returns:
undirected network read from the file
Throws:
IOException - if the file can not be written

readNetwork

public static ProteinNetwork readNetwork(String file,
                                         boolean directed)
                                  throws IOException
Reads a network from a given file.

Parameters:
file - file to read network from
directed - flag which sets if the network should be directed, if true the first protein in each entry will be the edge's source and the second protein will be the target
Returns:
network read from file
Throws:
IOException - if the file can not be written

readNetwork

public static ProteinNetwork readNetwork(File file)
                                  throws IOException
Reads an undirected network from a given file.

Parameters:
file - file to read network from
Returns:
undirected network read from the file
Throws:
IOException - if the file can not be written

readNetwork

public static ProteinNetwork readNetwork(File file,
                                         boolean directed)
                                  throws IOException
Reads a network from a given file.

Parameters:
file - file to read network from
directed - flag which sets if the network should be directed, if true the first protein in each entry will be the edge's source and the second protein will be the target
Returns:
network read from file
Throws:
IOException - if the file can not be written

readNetwork

public static ProteinNetwork readNetwork(InputStream input)
Reads an undirected network from a given InputStream.

Parameters:
input - input stream from which the network will be read
Returns:
network read from the stream

readNetwork

public static ProteinNetwork readNetwork(InputStream input,
                                         boolean directed)
Reads a network from a given InputStream.

Parameters:
input - input stream from which the network will be read
directed - flag which sets if the network should be directed, if true the first protein in each entry will be the edge's source and the second protein will be the target
Returns:
network read from the stream