Class BaseFileInfo
java.lang.Object
net.sf.basedb.util.importer.spotdata.BaseFileInfo
Collects information about a BASEfile as it gets parsed
by a
BaseFileImporter
. Information in one section is
often needed when parsing other sections or after the parsing
has been completed.- Version:
- 2.14
- Author:
- Nicklas
- Last modified
- $Date: 2011-08-11 11:09:06 +0200 (to, 11 aug 2011) $
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic class
Keeps information about a new child bioassay from the 'assays' section or 'spot' sections.static class
Keeps information about headers and more in a 'spot' section. -
Field Summary
Modifier and TypeFieldDescriptionprivate boolean
private Map<Integer,
BaseFileInfo.ChildBioAssay> private boolean
private Map<String,
ExtraValueType> private final FileWrapper
private boolean
private boolean
private Map<Integer,
BaseFileInfo.SpotSectionInfo> -
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionboolean
Add information about a child assay.addChildReporter
(Integer position, Integer reporterId) Add a child position/reporter mapping from the parsed BASEfile.addExtraFloat
(DbControl dc, String extraFloatId) Add information about an extra float value that appears in the BASEfile.void
addSpotSectionInfo
(int spotSection, BaseFileInfo.SpotSectionInfo info) Adds information about a 'spot' section.void
checkBioAssay
(DbControl dc, int id, int line) Checks that the bioassay with the given id exists in the database.boolean
A flag that indicates if the BASEfile includes a mapping from child to parent assays.Get the character set used by the file, or null if not known.getChildAssay
(int id) Get the child bioassay with the given id (from the BASEfile).Get information about all child bioassays referenced in the file.getChildColumns
(short parentColumn) Get all child columns that have been mapped to the specified parent column.boolean
A flag that indicates if the child data has a different position/reporter mapping than the parent bioassay set.Get a map with all added child position/reporter mappings.getExtraFloat
(String extraFloatId) Get the extra value type that has the given external id.getName()
Get the name of the file.boolean
A flag that indicates if at least one position in the parent bioassay set has a null reporter or not.boolean
A flag that indicates if at least one position in the parent bioassay set has a reporter with ID=0.long
getSize()
Get the file size.getSpotSectionInfo
(int spotSection) Get information about a spot section.void
loadParentReporterPositions
(DbControl dc, BioAssaySet parent) Load position/reporter mapping from the parent bioassay set.void
mapParentChildColumns
(short parentColumn, short childColumn) Maps a parent data cube column to a child cube column.void
setAssaysHaveParentAssaysMapping
(boolean haveMapping) Set a flag that indicates if the BASEfile includes a mapping from child to parent assays.void
setChildHasDifferentReporterPositionMapping
(boolean flag) Set a flag that indicates if the child data has a different position/reporter mapping than the parent bioassay set.void
setParentHasNullReporter
(boolean parentHasNullReporter) Set a flag indicating that at least one position in the parent bioassay set has a null reporter.void
setParentHasZeroReporter
(boolean parentHasZeroReporter) Set a flag indicating that at least one position in the parent bioassay set has a reporter with ID=0.
-
Field Details
-
file
-
assaysHaveParentAssaysMapping
private boolean assaysHaveParentAssaysMapping -
childAssays
-
parentHasNullReporter
private boolean parentHasNullReporter -
parentHasZeroReporter
private boolean parentHasZeroReporter -
parentReporterPositions
-
parentChildColumnMapping
-
spotSectionInfo
-
extraFloats
-
childHasDifferentReporterPositionMapping
private boolean childHasDifferentReporterPositionMapping -
childReporterPositions
-
-
Constructor Details
-
BaseFileInfo
The source file which should be a BASEfile.- Since:
- 2.16
-
-
Method Details
-
getName
Get the name of the file. -
getCharacterSet
Get the character set used by the file, or null if not known. -
getSize
public long getSize()Get the file size. -
setAssaysHaveParentAssaysMapping
public void setAssaysHaveParentAssaysMapping(boolean haveMapping) Set a flag that indicates if the BASEfile includes a mapping from child to parent assays. -
getAssaysHaveParentAssaysMapping
public boolean getAssaysHaveParentAssaysMapping()A flag that indicates if the BASEfile includes a mapping from child to parent assays. -
addChildAssay
Add information about a child assay.- Parameters:
child
- Information about the child assay- Returns:
- TRUE if the child was added, FALSE if a child with the same ID already exists
-
getChildAssays
Get information about all child bioassays referenced in the file. -
getChildAssay
Get the child bioassay with the given id (from the BASEfile).- Parameters:
id
- The ID in the BASEfile- Returns:
- A ChildBioAssay or null
-
checkBioAssay
Checks that the bioassay with the given id exists in the database. If not, an exception is thrown.- Parameters:
dc
- The DbControl to useid
- The id of the bioassayline
- The current line- Throws:
ItemNotFoundException
- If the bioassay doesn't exists in the database
-
setParentHasNullReporter
public void setParentHasNullReporter(boolean parentHasNullReporter) Set a flag indicating that at least one position in the parent bioassay set has a null reporter.- Parameters:
parentHasNullReporter
- TRUE if there is a position with a null reporter, FALSE otherwise- See Also:
-
getParentHasNullReporter
public boolean getParentHasNullReporter()A flag that indicates if at least one position in the parent bioassay set has a null reporter or not. We need to know this because some BASE 1 plug-ins convert a null reporter to 0 and in most cases it is safe to convert it back, but only if the parent had a null reporter but not a '0' reporter to begin with.- See Also:
-
setParentHasZeroReporter
public void setParentHasZeroReporter(boolean parentHasZeroReporter) Set a flag indicating that at least one position in the parent bioassay set has a reporter with ID=0. -
getParentHasZeroReporter
public boolean getParentHasZeroReporter()A flag that indicates if at least one position in the parent bioassay set has a reporter with ID=0.- See Also:
-
loadParentReporterPositions
Load position/reporter mapping from the parent bioassay set. This will also set thegetParentHasNullReporter()
/getParentHasZeroReporter()
flags.- Parameters:
dc
- A DbControl to useparent
- The parent bioassay set
-
setChildHasDifferentReporterPositionMapping
public void setChildHasDifferentReporterPositionMapping(boolean flag) Set a flag that indicates if the child data has a different position/reporter mapping than the parent bioassay set.- See Also:
-
getChildHasDifferentReporterPositionMapping
public boolean getChildHasDifferentReporterPositionMapping()A flag that indicates if the child data has a different position/reporter mapping than the parent bioassay set. -
addChildReporter
Add a child position/reporter mapping from the parsed BASEfile. The added mapping will be checked against the parent position/reporter mapping and thegetChildHasDifferentReporterPositionMapping()
flag is set if the mapping has changed.If a mapping for the given position already exists, a check is made if the mapping is identical or different. If the mapping is different the reporter id of the already existing mapping is returned. It is up to the called to take any appropriate action in this case (usually; throw an exception). If the mapping doesn't exist or if the mapping is identical the 'reporterId' value is returned. Thus, it is easy to check for success by simply comparing:
if (reporterId != addChildReporter(position, reporterId)) { // ... throw exception }
- Parameters:
position
- The position valuereporterId
- The ID of the reporter- Returns:
- The reporterId (same instance) if the mapping is new or if an identical mapping already exists. The reporer ID of an existing mapping if it is different.
-
getChildReporterPositions
Get a map with all added child position/reporter mappings. The key is the position value and the value is the reporter id. -
mapParentChildColumns
public void mapParentChildColumns(short parentColumn, short childColumn) Maps a parent data cube column to a child cube column. Note! A parent may map to multiple childs, and a child may have multiple parents.- Parameters:
parentColumn
- The parent data cube columnchildColumn
- The child data cube column
-
getChildColumns
Get all child columns that have been mapped to the specified parent column.- Returns:
- A list or null if no mapping exists
-
addSpotSectionInfo
Adds information about a 'spot' section.- Parameters:
spotSection
- The ordinal number of the spot section as it appears in the BASEfile, starting with 1info
- The information
-
getSpotSectionInfo
Get information about a spot section.- Parameters:
spotSection
- The ordinal number of the spot section as it appears in the BASEfile, starting with 1
-
addExtraFloat
Add information about an extra float value that appears in the BASEfile. This method will check if the anExtraValueType
with the given external id exists. If not, a new float-type extra value type is created.- Parameters:
dc
- A DbControl object to use for database accessextraFloatId
- The external id of an extra value type
-
getExtraFloat
Get the extra value type that has the given external id. The extra float must have been added withaddExtraFloat(DbControl, String)
before.- Parameters:
extraFloatId
- The external id of an extra value type- Returns:
- The extra value type, or null
-