procope.methods.scores.bootstrap
Class PurificationBootstrapSamples

java.lang.Object
  extended by procope.methods.scores.bootstrap.PurificationBootstrapSamples

public class PurificationBootstrapSamples
extends Object

Represents a set of bootstrap samples of a purification data set. To construct such a bootstrap sample, random purification experiments are drawn from the original data set with replacement to generate a new dataset having the same number of experiments.

Author:
Jan Krumsiek

Constructor Summary
PurificationBootstrapSamples(InputStream stream)
          Reads bootstrap samples from an input stream.
PurificationBootstrapSamples(PurificationData data, int numberOfSamples)
          Creates a new set of bootstrap samples.
PurificationBootstrapSamples(String file)
          Reads bootstrap samples from a file.
 
Method Summary
 int getNumberOfSamples()
          Returns the number of bootstrap samples contained in this set.
 PurificationData getSample(int sample)
          Returns a given sample from the set.
 void writeToFile(String outfile)
          Writes the bootstrap samples contained in this set to a file.
 void writeToStream(OutputStream outstream)
          Writes the bootstrap samples contained in this set to a file.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PurificationBootstrapSamples

public PurificationBootstrapSamples(String file)
                             throws IOException
Reads bootstrap samples from a file.

Parameters:
file - file from which the samples will be read
Throws:
IOException - if the file could not be read
ProCopeException - if the file format is invalid

PurificationBootstrapSamples

public PurificationBootstrapSamples(InputStream stream)
Reads bootstrap samples from an input stream.

Parameters:
stream - stream from which the samples will be read
Throws:
ProCopeException - if the file format is invalid

PurificationBootstrapSamples

public PurificationBootstrapSamples(PurificationData data,
                                    int numberOfSamples)
Creates a new set of bootstrap samples.

Parameters:
data - purification data to be sampled
numberOfSamples - number of samples to be created
Method Detail

getNumberOfSamples

public int getNumberOfSamples()
Returns the number of bootstrap samples contained in this set.

Returns:
number of bootstrap samples in this set

getSample

public PurificationData getSample(int sample)
Returns a given sample from the set. Note: The first bootstrap sample has the index 1, not 0.

Parameters:
sample - sample to be returned (1-based)
Returns:
the bootstrap sample

writeToFile

public void writeToFile(String outfile)
                 throws IOException
Writes the bootstrap samples contained in this set to a file.

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

writeToStream

public void writeToStream(OutputStream outstream)
Writes the bootstrap samples contained in this set to a file.

Parameters:
outstream - output stream the samples will be written to