2.17.2: 2011-06-17

net.sf.basedb.util.export.spotdata
Class AbstractFieldConverter

java.lang.Object
  extended by net.sf.basedb.util.export.spotdata.AbstractFieldConverter
All Implemented Interfaces:
ExportableFieldConverter
Direct Known Subclasses:
StandardFieldConverter

public abstract class AbstractFieldConverter
extends Object
implements ExportableFieldConverter

Abstract helper class for implementing ExportableFieldConverter. It contains a lot of helper method for locating formulas, extra values, experimental factors, etc.

Since:
2.15
Author:
nicklas

Field Summary
private  ItemQuery<AnnotationType> assayAnnotationQuery
           
private  DbControl dc
           
private  ItemQuery<ExtraValue> extraQuery
           
private  ItemQuery<AnnotationType> factorQuery
           
private  ItemQuery<Formula> formulaQuery
           
private  SnapshotManager snapshotManager
           
private  BioAssaySet source
           
 
Constructor Summary
protected AbstractFieldConverter(DbControl dc, BioAssaySet source)
          Creates a new field converter to be used with a specific bioassay set source.
 
Method Summary
protected  AnnotationAssayField getAssayAnnotationField(String name, String exportTitle)
          Get an assay annotation field.
protected  AssayPropertyField getAssayPropertyField(String name, String exportTitle)
          Get a static assay property field, such as name, description or id.
protected  DbControl getDbControl()
          Get the DbControl to use for database access.
protected  AnnotationAssayField getExperimentalFactorField(String name, String exportTitle)
          Get an experimental factor assay field.
protected  DynamicField getExtraValueField(String name, ExtraValue.CoordinateType type, String exportTitle)
          Get an extra value dynamic field.
protected  DynamicField getFormulaField(String name, String exportTitle)
          Get a formula dynamic field.
protected  DynamicField getIntensityField(String fieldName, String exportTitle)
          Create a dynamic field for spot intensity if the field name has the pattern 'Ch X' where 'X' is a channel number between 1 and the number of channels in the raw data type used by the source bioassay set.
protected  DynamicField getRawDataProperty(String name, String exportTitle)
          Find an extended raw data property with the given name and create a dynamic field from it using exportTitle as the title.
protected  DynamicField getReporterProperty(String name, String exportTitle)
          Get a static or extended reporter property field, such as name, description or id.
 SnapshotManager getSnapshotManager()
          Get the snapshot manager to use with annotation-based fields.
protected  BioAssaySet getSource()
          Get the source bioassay set.
 void setSnapshotManager(SnapshotManager snapshotManager)
          Set a snapshot manager that should be used with annotation-based fields.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface net.sf.basedb.util.export.spotdata.ExportableFieldConverter
getAssayField, getReporterField, getSpotField
 

Field Detail

dc

private final DbControl dc

source

private final BioAssaySet source

snapshotManager

private SnapshotManager snapshotManager

factorQuery

private ItemQuery<AnnotationType> factorQuery

assayAnnotationQuery

private ItemQuery<AnnotationType> assayAnnotationQuery

extraQuery

private ItemQuery<ExtraValue> extraQuery

formulaQuery

private ItemQuery<Formula> formulaQuery
Constructor Detail

AbstractFieldConverter

protected AbstractFieldConverter(DbControl dc,
                                 BioAssaySet source)
Creates a new field converter to be used with a specific bioassay set source.

Parameters:
dc - A DbControl to use for database access
source - The source bioassay set
Method Detail

getDbControl

protected DbControl getDbControl()
Get the DbControl to use for database access.


getSource

protected BioAssaySet getSource()
Get the source bioassay set.


setSnapshotManager

public void setSnapshotManager(SnapshotManager snapshotManager)
Set a snapshot manager that should be used with annotation-based fields. If no snapshot manager is provided, a new manager will automatically be created if needed.

Parameters:
snapshotManager - The snapshot manager to use

getSnapshotManager

public SnapshotManager getSnapshotManager()
Get the snapshot manager to use with annotation-based fields. If no snapshot manager has been configured a new one is automatically created.

Returns:
A snapshot manager object

getAssayPropertyField

protected AssayPropertyField getAssayPropertyField(String name,
                                                   String exportTitle)
Get a static assay property field, such as name, description or id. Property lookup is not case-sensitive. Eg. both 'name' and 'Name' will match.

Parameters:
name - The property name
exportTitle - The title as it should be in the exported file
Returns:
An AssayPropertyField or null if not found

getExperimentalFactorField

protected AnnotationAssayField getExperimentalFactorField(String name,
                                                          String exportTitle)
Get an experimental factor assay field. A database query is used to locate an experimental factor for the experiment that has the given name or external id. Depending on the underlying database, the lookup may be case-sensitive or case-insensitive. If more than one experimental factor is found an exception is thrown.

Parameters:
name - The name or external id of the experimental factor to find
exportTitle - The title as it should be in the exported file or null to use the name of the experimental factor
Returns:
An AnnotationAssayField or null if no experimental factor is found

getAssayAnnotationField

protected AnnotationAssayField getAssayAnnotationField(String name,
                                                       String exportTitle)
Get an assay annotation field. A database query is used to locate an annotation type that has been used on at least one assay in the bioassay set. Depending on the underlying database, the lookup may be case-sensitive or case-insensitive. If more than one annotation type is found an exception is thrown.

Parameters:
name - The name or external id of the annotation type to find
exportTitle - The title as it should be in the exported file or null to use the name of the annotation type
Returns:
An AnnotationAssayField or null if no annotation type is found

getReporterProperty

protected DynamicField getReporterProperty(String name,
                                           String exportTitle)
Get a static or extended reporter property field, such as name, description or id. Property lookup is not case-sensitive. Eg. both 'name' and 'Name' will match.

Parameters:
name - The name of the reporter property
exportTitle - The exported title or null to use the title of the extended property (which can be different from the name)
Returns:
A dynamic field, or null if no reporter property is found

getRawDataProperty

protected DynamicField getRawDataProperty(String name,
                                          String exportTitle)
Find an extended raw data property with the given name and create a dynamic field from it using exportTitle as the title.

Parameters:
name - The name of the extended raw data property
exportTitle - The exported title or null to use the title of the extended property (which can be different from the name)
Returns:
A dynamic field, or null if no raw data property is found

getExtraValueField

protected DynamicField getExtraValueField(String name,
                                          ExtraValue.CoordinateType type,
                                          String exportTitle)
Get an extra value dynamic field. A database query is used to locate an extra value for the bioassay set that has the given name or external id. Depending on the underlying database, the lookup may be case-sensitive or case-insensitive. If more than one extra value is found an exception is thrown.

Parameters:
name - The name or external id of the experimental factor to find
type - The coordinate type of the extra value (eg. POSITION for reporter extra values, and SPOT for spot extra values)
exportTitle - The title as it should be in the exported file or null to use the name of the extra value
Returns:
A DynamicField or null if no extra value is found

getFormulaField

protected DynamicField getFormulaField(String name,
                                       String exportTitle)
Get a formula dynamic field. A database query is used to locate the formula which must be a Formula.Type.COLUMN_EXPRESSION and be suitable for the RawDataType and IntensityTransform used by the source bioassay set. Depending on the underlying database, the lookup may be case-sensitive or case-insensitive. If more than one formula is found an exception is thrown.

Parameters:
name - The name of the formula to find
exportTitle - The title as it should be in the exported file or null to use the name of the formula
Returns:
A DynamicField or null if no extra value is found

getIntensityField

protected DynamicField getIntensityField(String fieldName,
                                         String exportTitle)
Create a dynamic field for spot intensity if the field name has the pattern 'Ch X' where 'X' is a channel number between 1 and the number of channels in the raw data type used by the source bioassay set.

Parameters:
fieldName - The field name
Returns:
A dynamic field, or null if the name doesn't match the pattern

2.17.2: 2011-06-17