5093 |
10 Sep 09 |
nicklas |
1 |
/** |
5093 |
10 Sep 09 |
nicklas |
$Id$ |
5093 |
10 Sep 09 |
nicklas |
3 |
|
5093 |
10 Sep 09 |
nicklas |
Copyright (C) 2009 Nicklas Nordborg |
5093 |
10 Sep 09 |
nicklas |
5 |
|
5093 |
10 Sep 09 |
nicklas |
This file is part of BASE - BioArray Software Environment. |
5093 |
10 Sep 09 |
nicklas |
Available at http://base.thep.lu.se/ |
5093 |
10 Sep 09 |
nicklas |
8 |
|
5093 |
10 Sep 09 |
nicklas |
BASE is free software; you can redistribute it and/or |
5093 |
10 Sep 09 |
nicklas |
modify it under the terms of the GNU General Public License |
5093 |
10 Sep 09 |
nicklas |
as published by the Free Software Foundation; either version 3 |
5093 |
10 Sep 09 |
nicklas |
of the License, or (at your option) any later version. |
5093 |
10 Sep 09 |
nicklas |
13 |
|
5093 |
10 Sep 09 |
nicklas |
BASE is distributed in the hope that it will be useful, |
5093 |
10 Sep 09 |
nicklas |
but WITHOUT ANY WARRANTY; without even the implied warranty of |
5093 |
10 Sep 09 |
nicklas |
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
5093 |
10 Sep 09 |
nicklas |
GNU General Public License for more details. |
5093 |
10 Sep 09 |
nicklas |
18 |
|
5093 |
10 Sep 09 |
nicklas |
You should have received a copy of the GNU General Public License |
5093 |
10 Sep 09 |
nicklas |
along with BASE. If not, see <http://www.gnu.org/licenses/>. |
5093 |
10 Sep 09 |
nicklas |
21 |
*/ |
5093 |
10 Sep 09 |
nicklas |
22 |
package net.sf.basedb.util.importer.spotdata; |
5093 |
10 Sep 09 |
nicklas |
23 |
|
5093 |
10 Sep 09 |
nicklas |
24 |
import java.util.List; |
5093 |
10 Sep 09 |
nicklas |
25 |
|
5096 |
14 Sep 09 |
nicklas |
26 |
import net.sf.basedb.util.basefile.BaseFileParser; |
5093 |
10 Sep 09 |
nicklas |
27 |
import net.sf.basedb.util.parser.FlatFileParser; |
5093 |
10 Sep 09 |
nicklas |
28 |
|
5093 |
10 Sep 09 |
nicklas |
29 |
/** |
5093 |
10 Sep 09 |
nicklas |
A spot intensity parser is responsible for parsing and extracting |
5093 |
10 Sep 09 |
nicklas |
spot intensity data on a row-by-row basis from a BASEfile. |
5093 |
10 Sep 09 |
nicklas |
After parsing the headers of a 'spot' section each registered |
5093 |
10 Sep 09 |
nicklas |
spot intensity parser will be asked if the section contains |
5096 |
14 Sep 09 |
nicklas |
all needed data columns {@link #hasRequiredAssayFields(BaseFileParser, FlatFileParser, List)}. |
5093 |
10 Sep 09 |
nicklas |
The first parser that gives a positive response will be used to |
5093 |
10 Sep 09 |
nicklas |
parse the spot intensity data for that section. |
5093 |
10 Sep 09 |
nicklas |
<p> |
5093 |
10 Sep 09 |
nicklas |
The actual parsing is done in the second pass. |
5093 |
10 Sep 09 |
nicklas |
39 |
|
5093 |
10 Sep 09 |
nicklas |
@see FirstPassSectionSpotsParser#addSpotIntensityParser(SpotIntensityParser) |
5093 |
10 Sep 09 |
nicklas |
@author Nicklas |
5093 |
10 Sep 09 |
nicklas |
@version 2.14 |
5093 |
10 Sep 09 |
nicklas |
@base.modified $Date$ |
5093 |
10 Sep 09 |
nicklas |
44 |
*/ |
5093 |
10 Sep 09 |
nicklas |
45 |
public interface SpotIntensityParser |
5093 |
10 Sep 09 |
nicklas |
46 |
{ |
5093 |
10 Sep 09 |
nicklas |
47 |
/** |
5093 |
10 Sep 09 |
nicklas |
Check the list of assay fields to see if all columns that are |
5093 |
10 Sep 09 |
nicklas |
required are present or not. This method is called in the |
5093 |
10 Sep 09 |
nicklas |
first pass to decide which spot intensity parser that should |
5093 |
10 Sep 09 |
nicklas |
be used in the second pass. |
5093 |
10 Sep 09 |
nicklas |
52 |
|
5096 |
14 Sep 09 |
nicklas |
@param parser The master BASEfile parser |
5093 |
10 Sep 09 |
nicklas |
@param ffp The flat file parser that parses the current file |
5093 |
10 Sep 09 |
nicklas |
@param assayFields The list of assay fields |
5093 |
10 Sep 09 |
nicklas |
@return TRUE if all required fields are present, FALSE otherwise |
5093 |
10 Sep 09 |
nicklas |
57 |
*/ |
5096 |
14 Sep 09 |
nicklas |
58 |
public boolean hasRequiredAssayFields(BaseFileParser parser, FlatFileParser ffp, List<String> assayFields); |
5093 |
10 Sep 09 |
nicklas |
59 |
|
5093 |
10 Sep 09 |
nicklas |
60 |
/** |
5093 |
10 Sep 09 |
nicklas |
Prepare for parsing the data section. Preparations typically include |
5093 |
10 Sep 09 |
nicklas |
extracting the column indexes of the data columns. This method is |
5093 |
10 Sep 09 |
nicklas |
called in the second pass before starting to parse data for |
5093 |
10 Sep 09 |
nicklas |
a 'spot' section. NOTE! The same object instance may be used to |
5093 |
10 Sep 09 |
nicklas |
parse more than one section in a serial BASEfile. |
5093 |
10 Sep 09 |
nicklas |
66 |
|
5096 |
14 Sep 09 |
nicklas |
@param parser The master BASEfile parser |
5093 |
10 Sep 09 |
nicklas |
@param ffp The flat file parser that parses the current file |
5093 |
10 Sep 09 |
nicklas |
@param assayFields The list of assay fields |
5093 |
10 Sep 09 |
nicklas |
70 |
*/ |
5096 |
14 Sep 09 |
nicklas |
71 |
public void beginSection(BaseFileParser parser, FlatFileParser ffp, List<String> assayFields); |
5093 |
10 Sep 09 |
nicklas |
72 |
|
5093 |
10 Sep 09 |
nicklas |
73 |
/** |
5093 |
10 Sep 09 |
nicklas |
Extract the intensity values from the current data line for a single |
5093 |
10 Sep 09 |
nicklas |
bioassay. If the section contains data for multiple bioassays |
5093 |
10 Sep 09 |
nicklas |
(eg. a matrix BASEfile) this method is called multiple times (with |
5093 |
10 Sep 09 |
nicklas |
different 'firstIndex' value) for each row. |
5093 |
10 Sep 09 |
nicklas |
78 |
|
5093 |
10 Sep 09 |
nicklas |
@param data The current data line |
5093 |
10 Sep 09 |
nicklas |
@param intensities An array that should be populate with intensity values |
5093 |
10 Sep 09 |
nicklas |
@param firstIndex The index of the first data column that contains data |
5093 |
10 Sep 09 |
nicklas |
for the current bioassay |
5093 |
10 Sep 09 |
nicklas |
83 |
|
5093 |
10 Sep 09 |
nicklas |
@return TRUE if the values could be set correctly, FALSE otherwise (which |
5093 |
10 Sep 09 |
nicklas |
means that the spot data will not be inserted) |
5093 |
10 Sep 09 |
nicklas |
86 |
*/ |
5093 |
10 Sep 09 |
nicklas |
87 |
public boolean setIntensities(FlatFileParser.Data data, float[] intensities, int firstIndex); |
5093 |
10 Sep 09 |
nicklas |
88 |
|
5093 |
10 Sep 09 |
nicklas |
89 |
|
5093 |
10 Sep 09 |
nicklas |
90 |
} |