procope.data.networks
Class NetworkWriter

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

public class NetworkWriter
extends Object

Contains different methods to write ProteinNetwork objects to files or streams. Each line of the output contains one edge, a line looks as follows:

protein1[s]protein2[s]score[s]annotations
where [s] is the separator (TAB by default). If and edge has no score or no annotations that field is simply left empty. Annotations are stored as key/ value pairs in the form key1=value1;key2=value2;....

XGMML

This class also contains an XGMML export function for protein networks. These files are compatible with Cytoscape for instance.

Author:
Jan Krumsiek

Field Summary
static String DEFAULT_SEPARATOR
          Default separator for the fields of each edge: TAB
 
Method Summary
static void writeNetwork(ProteinNetwork network, File outfile)
          Writes a network to a specified file.
static void writeNetwork(ProteinNetwork network, File outfile, String separator)
          Writes a network to a specified file.
static void writeNetwork(ProteinNetwork network, OutputStream outstream)
          Writes a network to a specified outputstream.
static void writeNetwork(ProteinNetwork network, OutputStream outstream, String separator)
          Writes a network to a specified outputstream.
static void writeNetwork(ProteinNetwork network, String outfile)
          Writes a network to a specified file.
static void writeNetwork(ProteinNetwork network, String outfile, String separator)
          Writes a network to a specified file.
static void writeXGMML(ProteinNetwork network, File outfile)
          Creates a Cytoscape-compatible XGMML file.
static void writeXGMML(ProteinNetwork network, OutputStream outstream)
          Creates a Cytoscape-compatible XGMML file, but writes to an output stream.
static void writeXGMML(ProteinNetwork network, String outfile)
          Creates a Cytoscape-compatible XGMML file.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEFAULT_SEPARATOR

public static final String DEFAULT_SEPARATOR
Default separator for the fields of each edge: TAB

See Also:
Constant Field Values
Method Detail

writeNetwork

public static void writeNetwork(ProteinNetwork network,
                                String outfile)
                         throws IOException
Writes a network to a specified file. TAB will be used as a separator between the fields of each edge.

Parameters:
network - the network to be written
outfile - path to the output file
Throws:
IOException - if the file could not be written

writeNetwork

public static void writeNetwork(ProteinNetwork network,
                                String outfile,
                                String separator)
                         throws IOException
Writes a network to a specified file.

Parameters:
network - the network to be written
outfile - path to the output file
separator - separator between the fields of each edge
Throws:
IOException - if the file could not be written

writeNetwork

public static void writeNetwork(ProteinNetwork network,
                                File outfile)
                         throws IOException
Writes a network to a specified file. TAB will be used as a separator between the fields of each edge.

Parameters:
network - the network to be written
outfile - path to the output file
Throws:
IOException - if the file could not be written

writeNetwork

public static void writeNetwork(ProteinNetwork network,
                                File outfile,
                                String separator)
                         throws IOException
Writes a network to a specified file.

Parameters:
network - the network to be written
outfile - path to the output file
separator - separator between the fields of each edge
Throws:
IOException - if the file could not be written

writeNetwork

public static void writeNetwork(ProteinNetwork network,
                                OutputStream outstream)
Writes a network to a specified outputstream. TAB will be used as a separator between the fields of each edge.

Parameters:
network - the network to be written
outstream - the stream to which the network will be written
Throws:
FileNotFoundException - if the file could not be opened

writeNetwork

public static void writeNetwork(ProteinNetwork network,
                                OutputStream outstream,
                                String separator)
Writes a network to a specified outputstream.

Parameters:
network - the network to be written
outstream - the stream to which the network will be written
separator - separator between the fields of each edge
Throws:
FileNotFoundException - if the file could not be opened

writeXGMML

public static void writeXGMML(ProteinNetwork network,
                              String outfile)
                       throws IOException
Creates a Cytoscape-compatible XGMML file. The edge weights will be annotated to the graph as an attribute called weight. All other annotations are written out using their respective key.

Parameters:
network - network to be stored as XGMML
outfile - path to output file
Throws:
IOException - if the file could not be written

writeXGMML

public static void writeXGMML(ProteinNetwork network,
                              File outfile)
                       throws IOException
Creates a Cytoscape-compatible XGMML file. The edge weights will be annotated to the graph as an attribute called weight. All other annotations are written out using their respective key.

Parameters:
network - network to be stored as XGMML
outfile - path to output file
Throws:
IOException - if the file could not be written

writeXGMML

public static void writeXGMML(ProteinNetwork network,
                              OutputStream outstream)
Creates a Cytoscape-compatible XGMML file, but writes to an output stream. The edge weights will be annotated to the graph as an attribute called confidence. All other annotations are written out using their respective key.

Parameters:
network - network to be stored as XGMML
outstream - to which the XGMML will be written to
Throws:
FileNotFoundException - if the output file could not be opened