2.17.2: 2011-06-17

net.sf.basedb.util.importer.spotdata
Class FirstPassSectionSpotsParser

java.lang.Object
  extended by net.sf.basedb.util.importer.spotdata.FirstPassSectionSpotsParser
All Implemented Interfaces:
BaseFileSectionParser

public class FirstPassSectionSpotsParser
extends Object
implements BaseFileSectionParser

Parses a 'spots' section of a BASEfile with bioassay set spot data. This section is optional but can also appear more than once (eg. serial BASEfile). The section must have an 'assays' header that contains the id:s of the bioassays that have spot data in this section. The id values should either reference an id from the 'assays' section or the id of an existing bioassay in the database.

The section must also contain a 'columns' header that includes at least 'position', 'reporter' and 'assayData' columns. The 'assayData' is a meta column that expands to the columns defined by the required 'assayFields' header. This header must define as many 'intensityN' columns as there are channels in the experiment. For two-channel data, it may instead optionally use M (l2ratio1_2) and A (l10intgmean1_2). Columns with extra values can be defined by including a 'setExtraFloats' header. This header just enumerates the extra columns. A macthing column must also be presen in the 'assayFields' header.

NOTE! Column names can be redefined by calling BaseFileParser.setRedefinedColumnName(String, String, String).

Here is an example of the headers and the first data line of a matrix BASEfile which has two two-channel assays and one extra value column.

section spots
assays  101     102
columns position        reporter        assayData
assayFields intensity1 intensity2 extra1
setExtraFloats extra1
%
1       1       1.0     2.0     0.5     2.0     3.0     0.2
The first pass will check the headers and extract position/reporter mappings. This is important because we need to know if the child bioassay set has the same or a different position/reporter mapping than the parent bioassay set.

Version:
2.14
Author:
Nicklas
Last modified
$Date: 2010-09-10 13:09:05 +0200 (Fri, 10 Sep 2010) $

Field Summary
private  DbControl dc
           
private  BaseFileInfo info
           
private  boolean mapZeroToNull
           
private  long nextProgressReport
           
private  BioAssaySet parent
           
private  long progressReportInterval
           
static String SECTION
          The section of the BASEfile this parser can parse, eg.
private  int sectionCount
           
private  List<SpotIntensityParser> spotIntensityParsers
           
private  String totalBytes
           
 
Constructor Summary
FirstPassSectionSpotsParser(DbControl dc, BaseFileInfo info, BioAssaySet parent)
          Creates a new 'section spot' parser for the first pass.
 
Method Summary
 void addSpotIntensityParser(SpotIntensityParser parser)
          Adds a spot intensity parser to the list of used parsers.
 void parseSection(BaseFileParser parser, FlatFileParser ffp)
          Parse the current section.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

SECTION

public static final String SECTION
The section of the BASEfile this parser can parse, eg. 'spots'.

See Also:
Constant Field Values

dc

private final DbControl dc

info

private final BaseFileInfo info

parent

private final BioAssaySet parent

totalBytes

private final String totalBytes

progressReportInterval

private final long progressReportInterval

nextProgressReport

private long nextProgressReport

sectionCount

private int sectionCount

mapZeroToNull

private boolean mapZeroToNull

spotIntensityParsers

private List<SpotIntensityParser> spotIntensityParsers
Constructor Detail

FirstPassSectionSpotsParser

public FirstPassSectionSpotsParser(DbControl dc,
                                   BaseFileInfo info,
                                   BioAssaySet parent)
Creates a new 'section spot' parser for the first pass. This parser will extract header information and position/reporter mapping information.

Parameters:
dc - A DbControl to use for database access
info - Information about the file we are parsing
parent - The parent bioassay set
Method Detail

parseSection

public void parseSection(BaseFileParser parser,
                         FlatFileParser ffp)
                  throws IOException
Description copied from interface: BaseFileSectionParser
Parse the current section. The current parse position is right after the section marker. If the section contains headers the FlatFileParser.parseHeaders() must be called. Use FlatFileParser.nextData() to parse data lines.

Specified by:
parseSection in interface BaseFileSectionParser
Parameters:
parser - The master BASEfile parser (can be used for reporting progress, checking for interrupts, etc.)
ffp - The actual file parser, use this to get the data
Throws:
IOException - If there is a problem reading the data

addSpotIntensityParser

public void addSpotIntensityParser(SpotIntensityParser parser)
Adds a spot intensity parser to the list of used parsers. The first found parser that signals that all required assay fields are present will be used to parse the spot intensity data.

See Also:
GenericIntensityParser, MAParser

2.17.2: 2011-06-17