public class BaseFileInfo
extends java.lang.Object
BaseFileImporter
. Information in one section is
often needed when parsing other sections or after the parsing
has been completed.Modifier and Type | Class and Description |
---|---|
static class |
BaseFileInfo.ChildBioAssay
Keeps information about a new child bioassay from
the 'assays' section or 'spot' sections.
|
static class |
BaseFileInfo.SpotSectionInfo
Keeps information about headers and more in a 'spot' section.
|
Modifier and Type | Field and Description |
---|---|
private boolean |
assaysHaveParentAssaysMapping |
private java.util.Map<java.lang.Integer,BaseFileInfo.ChildBioAssay> |
childAssays |
private boolean |
childHasDifferentReporterPositionMapping |
private java.util.Map<java.lang.Integer,java.lang.Integer> |
childReporterPositions |
private java.util.Map<java.lang.String,ExtraValueType> |
extraFloats |
private FileWrapper |
file |
private java.util.Map<java.lang.Short,java.util.List<java.lang.Short>> |
parentChildColumnMapping |
private boolean |
parentHasNullReporter |
private boolean |
parentHasZeroReporter |
private java.util.Map<java.lang.Integer,java.lang.Integer> |
parentReporterPositions |
private java.util.Map<java.lang.Integer,BaseFileInfo.SpotSectionInfo> |
spotSectionInfo |
Constructor and Description |
---|
BaseFileInfo(FileWrapper file)
The source file which should be a BASEfile.
|
Modifier and Type | Method and Description |
---|---|
boolean |
addChildAssay(BaseFileInfo.ChildBioAssay child)
Add information about a child assay.
|
java.lang.Integer |
addChildReporter(java.lang.Integer position,
java.lang.Integer reporterId)
Add a child position/reporter mapping from the parsed BASEfile.
|
ExtraValueType |
addExtraFloat(DbControl dc,
java.lang.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 |
getAssaysHaveParentAssaysMapping()
A flag that indicates if the BASEfile includes a mapping
from child to parent assays.
|
java.lang.String |
getCharacterSet()
Get the character set used by the file, or null if not known.
|
BaseFileInfo.ChildBioAssay |
getChildAssay(int id)
Get the child bioassay with the given id (from the BASEfile).
|
java.util.Collection<BaseFileInfo.ChildBioAssay> |
getChildAssays()
Get information about all child bioassays referenced in the file.
|
java.util.List<java.lang.Short> |
getChildColumns(short parentColumn)
Get all child columns that have been mapped to the specified parent
column.
|
boolean |
getChildHasDifferentReporterPositionMapping()
A flag that indicates if the child data has a different position/reporter
mapping than the parent bioassay set.
|
java.util.Map<java.lang.Integer,java.lang.Integer> |
getChildReporterPositions()
Get a map with all added child position/reporter mappings.
|
ExtraValueType |
getExtraFloat(java.lang.String extraFloatId)
Get the extra value type that has the given external id.
|
java.lang.String |
getName()
Get the name of the file.
|
boolean |
getParentHasNullReporter()
A flag that indicates if at least one position in the parent bioassay
set has a null reporter or not.
|
boolean |
getParentHasZeroReporter()
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.
|
BaseFileInfo.SpotSectionInfo |
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.
|
private final FileWrapper file
private boolean assaysHaveParentAssaysMapping
private java.util.Map<java.lang.Integer,BaseFileInfo.ChildBioAssay> childAssays
private boolean parentHasNullReporter
private boolean parentHasZeroReporter
private java.util.Map<java.lang.Integer,java.lang.Integer> parentReporterPositions
private java.util.Map<java.lang.Short,java.util.List<java.lang.Short>> parentChildColumnMapping
private java.util.Map<java.lang.Integer,BaseFileInfo.SpotSectionInfo> spotSectionInfo
private java.util.Map<java.lang.String,ExtraValueType> extraFloats
private boolean childHasDifferentReporterPositionMapping
private java.util.Map<java.lang.Integer,java.lang.Integer> childReporterPositions
public BaseFileInfo(FileWrapper file)
public java.lang.String getName()
public java.lang.String getCharacterSet()
public long getSize()
public void setAssaysHaveParentAssaysMapping(boolean haveMapping)
public boolean getAssaysHaveParentAssaysMapping()
public boolean addChildAssay(BaseFileInfo.ChildBioAssay child)
child
- Information about the child assaypublic java.util.Collection<BaseFileInfo.ChildBioAssay> getChildAssays()
public BaseFileInfo.ChildBioAssay getChildAssay(int id)
id
- The ID in the BASEfilepublic void checkBioAssay(DbControl dc, int id, int line)
dc
- The DbControl to useid
- The id of the bioassayline
- The current lineItemNotFoundException
- If the bioassay doesn't exists in the
databasepublic void setParentHasNullReporter(boolean parentHasNullReporter)
parentHasNullReporter
- TRUE if there is a position with a null reporter,
FALSE otherwiseloadParentReporterPositions(DbControl, BioAssaySet)
public boolean getParentHasNullReporter()
getParentHasZeroReporter()
public void setParentHasZeroReporter(boolean parentHasZeroReporter)
public boolean getParentHasZeroReporter()
getParentHasNullReporter()
public void loadParentReporterPositions(DbControl dc, BioAssaySet parent)
getParentHasNullReporter()
/getParentHasZeroReporter()
flags.dc
- A DbControl to useparent
- The parent bioassay setpublic void setChildHasDifferentReporterPositionMapping(boolean flag)
addChildReporter(Integer, Integer)
public boolean getChildHasDifferentReporterPositionMapping()
public java.lang.Integer addChildReporter(java.lang.Integer position, java.lang.Integer reporterId)
getChildHasDifferentReporterPositionMapping()
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 }
position
- The position valuereporterId
- The ID of the reporterpublic java.util.Map<java.lang.Integer,java.lang.Integer> getChildReporterPositions()
public void mapParentChildColumns(short parentColumn, short childColumn)
parentColumn
- The parent data cube columnchildColumn
- The child data cube columnpublic java.util.List<java.lang.Short> getChildColumns(short parentColumn)
public void addSpotSectionInfo(int spotSection, BaseFileInfo.SpotSectionInfo info)
spotSection
- The ordinal number of the spot section as it
appears in the BASEfile, starting with 1info
- The informationpublic BaseFileInfo.SpotSectionInfo getSpotSectionInfo(int spotSection)
spotSection
- The ordinal number of the spot section as it
appears in the BASEfile, starting with 1public ExtraValueType addExtraFloat(DbControl dc, java.lang.String extraFloatId)
ExtraValueType
with the given external id exists. If not, a new float-type extra
value type is created.dc
- A DbControl object to use for database accessextraFloatId
- The external id of an extra value typepublic ExtraValueType getExtraFloat(java.lang.String extraFloatId)
addExtraFloat(DbControl, String)
before.extraFloatId
- The external id of an extra value type