2.17.2: 2011-06-17

net.sf.basedb.util.importer.spotdata
Class BfsImporter

java.lang.Object
  extended by net.sf.basedb.util.importer.spotdata.BfsImporter

public class BfsImporter
extends Object

Imports spot data from a serial or matrix BFS. Before it can be used various configuration properties must be set.

The import is started with doImport(). This will start by parsing the metadata file. Additional files that are referenced in the [files] section are opened via the InputStreamLocator. File entries that start with 'x-' are considered to be extra files that should be attached to the child bioassay set. But this is only done if an ExtraFileImporter has been specified.

The section [settings] is used to control some aspects of the parsing. If the data is going into the same datacube the section is not needed. If a new datacube is needed the importer needs to know how to map the spot data to positions/reporters and to assays. We support three cases:

  1. The data uses the same datacube as the parent
  2. The data needs a new datacube but there is a one-to-one relation with the parent assays
  3. The data needs a new datacube and there may be more than one parent assay for each child assay

A new datacube is created by including a new-data-cube entry in the settings section. Multiple parents per assay is enabled by including a multi-assay-parents entry.

The child bioassay set is by default assumed to use the same IntensityTransform as the parent bioassay set. If the imported data uses a different transform this should be specified by the transform setting. Allowed values are those defined by the IntensityTransform enumeration (NONE, LOG2 or LOG10).

The importer needs 'rdata' and 'pdata' files in all cases. The ID column in the rdata file should be the position number. If the data is using the same datacube (case 1) no more columns are needed. The order of the positions doesn't matter as long as it matches the spot data files. All positions must be unique. If the data needs a new datacube (case 2 and 3) the rdata file also needs one of 'External ID' or 'Internal ID' columns which are used to map positions to reporters.

The meaning of the ID column in the pdata file depends on the case. In case 1 and 2 the ID is the internal ID of the parent assay. No more columns are needed. In case 3, the ID column is just a unique positive integer. In this case, the pdata file also needs a second column 'Parent ID', which should be a comma-separated list of the internal assay ID values of the parent assays.

The [sdata] section lists all spot data columns. The importer is looking for entries of the form 'Ch N' where N is 1, 2, ... etc. Exactly one entry for each channel is required.

Version:
2.15
Author:
Nicklas
Last modified
$Date: 2010-09-10 13:09:05 +0200 (Fri, 10 Sep 2010) $

Nested Class Summary
(package private) static class BfsImporter.ProgressEventHandler
           
 
Field Summary
private  boolean autoCloseParsers
           
private  DbControl dc
           
private  ExtraFileImporter extraFileImporter
           
private  InputStreamLocator locator
           
private  MetadataParser metadataParser
           
private  ProgressReporter progress
           
private  Transformation transformation
           
 
Constructor Summary
BfsImporter()
          Create a new importer object.
 
Method Summary
protected  void checkInterrupted()
          Deprecated. In 2.16, use ThreadSignalHandler.checkInterrupted() instead
 BioAssaySet doImport()
          Start the import.
 DbControl getDbControl()
          Get the current DbControl.
 MetadataParser getMetadataParser()
           
 ProgressReporter getProgressReporter()
          Get the progress reporter.
 Transformation getTransformation()
          Get the destination transformation.
 void setAutoCloseParsers(boolean autoClose)
          If this option is set then all parsers are automatically closed when all data has been read to them.
 void setDbControl(DbControl dc)
          Set's the DbControl that should be used to get data from the database.
 void setExtraFileImporter(ExtraFileImporter extraFileImporter)
           
 void setInputStreamLocator(InputStreamLocator locator)
          Set the input stream locator that is responsible for opening files that are referenced from the metadata file.
 void setMetadataParser(MetadataParser parser)
          Set the metadata file parser.
protected  void setProgress(int percent, String message)
          Update the progress of the export.
 void setProgressReporter(ProgressReporter progress)
          Set the progress reporter that is used to report progress.
 void setTransformation(Transformation transformation)
          Set the destination transformation.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

autoCloseParsers

private boolean autoCloseParsers

dc

private DbControl dc

progress

private ProgressReporter progress

metadataParser

private MetadataParser metadataParser

transformation

private Transformation transformation

locator

private InputStreamLocator locator

extraFileImporter

private ExtraFileImporter extraFileImporter
Constructor Detail

BfsImporter

public BfsImporter()
Create a new importer object.

Method Detail

setAutoCloseParsers

public void setAutoCloseParsers(boolean autoClose)
If this option is set then all parsers are automatically closed when all data has been read to them. This setting is enabled by default.


setDbControl

public void setDbControl(DbControl dc)
Set's the DbControl that should be used to get data from the database.


getDbControl

public DbControl getDbControl()
Get the current DbControl.


setProgressReporter

public void setProgressReporter(ProgressReporter progress)
Set the progress reporter that is used to report progress. Call setProgress(int, String) to update the current status.


getProgressReporter

public ProgressReporter getProgressReporter()
Get the progress reporter.


setTransformation

public void setTransformation(Transformation transformation)
Set the destination transformation. A child bioassay set is created.

Parameters:
transformation - The transformation

getTransformation

public Transformation getTransformation()
Get the destination transformation.


setMetadataParser

public void setMetadataParser(MetadataParser parser)
Set the metadata file parser. The metadata file should contains information about other files and their contents.


getMetadataParser

public MetadataParser getMetadataParser()

setInputStreamLocator

public void setInputStreamLocator(InputStreamLocator locator)
Set the input stream locator that is responsible for opening files that are referenced from the metadata file.


setExtraFileImporter

public void setExtraFileImporter(ExtraFileImporter extraFileImporter)

checkInterrupted

@Deprecated
protected void checkInterrupted()
Deprecated. In 2.16, use ThreadSignalHandler.checkInterrupted() instead

Checks if the currently executing thread has been interrupted and throws a SignalException if it has.


setProgress

protected void setProgress(int percent,
                           String message)
Update the progress of the export.

See Also:
ProgressReporter

doImport

public BioAssaySet doImport()
                     throws IOException
Start the import.

Returns:
The created bioassay set or null if the BASEfile didn't contain spot data
Throws:
IOException

2.17.2: 2011-06-17