Class BaseFileImporter
- java.lang.Object
-
- net.sf.basedb.util.importer.spotdata.BaseFileImporter
-
public class BaseFileImporter extends Object
Imports spot data from a serial or matrix BASEfile. Before it can be used various configuration properties must be set.- An open DbControl:
setDbControl(DbControl)
- The source file:
setSourceFileWrapper(FileWrapper)
- The destination transaction:
setTransformation(Transformation)
- A progress reporter:
setProgressReporter(ProgressReporter)
- The intensity transform used by the data set:
setIntensityTransform(IntensityTransform)
. If not set, the same intensity transform as for the parent bioassay set is used - Redefine column names. By default, column names used by BASE 1
are assumed. Call
useBase2ColumnNames(int)
to configure the parser to use BASE 2 column names.
The importer will create a new child bioassay set. Child bioassays are created according to the data found in the BASEfile. The importer will create a new datacube if the reporter/position mapping has changed or if the child/parent bioassay relationship is not 1:1. The importer supports extra values (float) and will create missing extra value types if needed.
- Version:
- 2.14
- Author:
- Nicklas
- Last modified
- $Date: 2012-08-03 12:53:22 +0200 (fr, 03 aug 2012) $
- An open DbControl:
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description (package private) static class
BaseFileImporter.RawDataProxy
(package private) static class
BaseFileImporter.ReporterProxy
-
Field Summary
Fields Modifier and Type Field Description private DbControl
dc
private BaseFileParser
parser
private ProgressReporter
progress
private FileWrapper
sourceFile
private IntensityTransform
transform
private Transformation
transformation
-
Constructor Summary
Constructors Constructor Description BaseFileImporter()
Create a new importer object.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
createChildBioAssays(DbControl dc, BioAssaySet childSet, BaseFileInfo info, boolean useNewDataCube)
Helper method for creating new child bioassays using the information found in the BaseFileInfo object.BioAssaySet
createChildBioAssaySet(DbControl dc, BaseFileInfo info, Transformation t, boolean useNewDataCube)
Helper method for creating a child bioassay set using the information in the BaseFileInfo object.void
createChildPositionReporterMapping(BioAssaySet child, BaseFileInfo info, ProgressReporter progress)
Helper method for creating position/reporter mappings for the child bioassay set (which must be in a new datacube).void
createChildRawDataMapping(BioAssaySet child, BioAssaySet parent, BaseFileInfo info, ProgressReporter progress)
Helper method for creating a rawdata mapping for the child bioassay set.BioAssaySet
doImport()
Start the import.BaseFileParser
getBaseFileParser()
Get the underlying parser for the BASEfile.DbControl
getDbControl()
Get the current DbControl.IntensityTransform
getIntensityTransform()
Get the intensity transformProgressReporter
getProgressReporter()
Get the progress reporter.FileWrapper
getSourceFileWrapper()
Get the source file.Transformation
getTransformation()
Get the destination transformation.void
setDbControl(DbControl dc)
Set's the DbControl that should be used to get data from the database.void
setIntensityTransform(IntensityTransform transform)
Set the intensity transform that have been applied to the spot data in the file.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
setSourceFileWrapper(FileWrapper source)
Set the source BASEfile to import data from.void
setTransformation(Transformation transformation)
Set the destination transformation.void
useBase2ColumnNames(int channels)
Reconfigure the parser to use BASE 2 column names instead of BASE 1 column names.
-
-
-
Field Detail
-
parser
private final BaseFileParser parser
-
dc
private DbControl dc
-
progress
private ProgressReporter progress
-
sourceFile
private FileWrapper sourceFile
-
transformation
private Transformation transformation
-
transform
private IntensityTransform transform
-
-
Method Detail
-
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.
-
setSourceFileWrapper
public void setSourceFileWrapper(FileWrapper source)
Set the source BASEfile to import data from.- Parameters:
source
- The file- Since:
- 2.16
-
getSourceFileWrapper
public FileWrapper getSourceFileWrapper()
Get the source file.
-
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.
-
setIntensityTransform
public void setIntensityTransform(IntensityTransform transform)
Set the intensity transform that have been applied to the spot data in the file. If not specified, the same transform as for the parent bioassay set is used.- Parameters:
transform
- The intensity transform
-
getIntensityTransform
public IntensityTransform getIntensityTransform()
Get the intensity transform
-
getBaseFileParser
public BaseFileParser getBaseFileParser()
Get the underlying parser for the BASEfile. It is useful when there is need to change for example, name of columns, add different spot intensity parsers, etc.- Returns:
- The BASEfile parser
-
useBase2ColumnNames
public void useBase2ColumnNames(int channels)
Reconfigure the parser to use BASE 2 column names instead of BASE 1 column names.- Parameters:
channels
- The expected number of data channels in the file- Since:
- 2.16
-
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
-
createChildBioAssaySet
public BioAssaySet createChildBioAssaySet(DbControl dc, BaseFileInfo info, Transformation t, boolean useNewDataCube)
Helper method for creating a child bioassay set using the information in the BaseFileInfo object. The created bioassay set is scheduled for saving to the database.- Parameters:
dc
- A DbControl to use for database accessinfo
- Information from the parsed BASEfilet
- The parent transformationuseNewDataCube
- TRUE to create the child bioassay set in a new datacube, FALSE to use the same as the parent bioassay set- Returns:
- The new child bioassay set
-
createChildBioAssays
public void createChildBioAssays(DbControl dc, BioAssaySet childSet, BaseFileInfo info, boolean useNewDataCube)
Helper method for creating new child bioassays using the information found in the BaseFileInfo object.- See Also:
BaseFileInfo.getChildAssays()
-
createChildPositionReporterMapping
public void createChildPositionReporterMapping(BioAssaySet child, BaseFileInfo info, ProgressReporter progress)
Helper method for creating position/reporter mappings for the child bioassay set (which must be in a new datacube).- Parameters:
child
- The new child bioassay setinfo
- Information about the position/reporter mapping is found inBaseFileInfo.getChildReporterPositions()
progress
- Optional progress reporter
-
createChildRawDataMapping
public void createChildRawDataMapping(BioAssaySet child, BioAssaySet parent, BaseFileInfo info, ProgressReporter progress)
Helper method for creating a rawdata mapping for the child bioassay set. This can only be done if the child is in a new data cube and if the position/reporter mapping hasn't change. Since we know the child/parent bioassay set mapping, the raw data mapping for a spot in the child is the same as the raw data mapping for the spots at the same position among the parents.Child/parent mapping is taken from the BaseFileInfo object. See
BaseFileInfo.getChildColumns(short)
. This mapping automatically created bycreateChildBioAssays(DbControl, BioAssaySet, BaseFileInfo, boolean)
.- Parameters:
child
- The new child bioassay setparent
- The parent bioassay setinfo
- Information about the child/parent mapping is found inBaseFileInfo.getChildColumns(short)
progress
- Optional progress reporter
-
-