Class BfsImporter
- java.lang.Object
-
- 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.- An open DbControl:
setDbControl(DbControl)
- The parent transaction:
setTransformation(Transformation)
- A parser for the metadata file:
setMetadataParser(MetadataParser)
- A locator implementation for locating files that are referenced in the
metadata file:
setInputStreamLocator(InputStreamLocator)
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 theInputStreamLocator
. 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 anExtraFileImporter
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:
- The data uses the same datacube as the parent
- The data needs a new datacube but there is a one-to-one relation with the parent assays
- 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 amulti-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 thetransform
setting. Allowed values are those defined by the IntensityTransform enumeration (NONE
,LOG2
orLOG10
).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: 2015-04-20 11:08:18 +0200 (må, 20 apr 2015) $
- An open DbControl:
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description (package private) static class
BfsImporter.ProgressEventHandler
-
Field Summary
Fields Modifier and Type Field Description private boolean
autoCloseParsers
private DbControl
dc
private ExtraFileImporter
extraFileImporter
private InputStreamLocator
locator
private MetadataParser
metadataParser
private ProgressReporter
progress
private Transformation
transformation
-
Constructor Summary
Constructors Constructor Description BfsImporter()
Create a new importer object.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description 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.
-
-
-
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
-
-
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. CallsetProgress(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)
-
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
-
-