src/core/net/sf/basedb/util/importer/spotdata/SpotIntensityParser.java

Code
Comments
Other
Rev Date Author Line
5093 10 Sep 09 nicklas 1 /**
5093 10 Sep 09 nicklas 2   $Id$
5093 10 Sep 09 nicklas 3
5093 10 Sep 09 nicklas 4   Copyright (C) 2009 Nicklas Nordborg
5093 10 Sep 09 nicklas 5
5093 10 Sep 09 nicklas 6   This file is part of BASE - BioArray Software Environment.
5093 10 Sep 09 nicklas 7   Available at http://base.thep.lu.se/
5093 10 Sep 09 nicklas 8
5093 10 Sep 09 nicklas 9   BASE is free software; you can redistribute it and/or
5093 10 Sep 09 nicklas 10   modify it under the terms of the GNU General Public License
5093 10 Sep 09 nicklas 11   as published by the Free Software Foundation; either version 3
5093 10 Sep 09 nicklas 12   of the License, or (at your option) any later version.
5093 10 Sep 09 nicklas 13
5093 10 Sep 09 nicklas 14   BASE is distributed in the hope that it will be useful,
5093 10 Sep 09 nicklas 15   but WITHOUT ANY WARRANTY; without even the implied warranty of
5093 10 Sep 09 nicklas 16   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
5093 10 Sep 09 nicklas 17   GNU General Public License for more details.
5093 10 Sep 09 nicklas 18
5093 10 Sep 09 nicklas 19   You should have received a copy of the GNU General Public License
5093 10 Sep 09 nicklas 20   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 30   A spot intensity parser is responsible for parsing and extracting
5093 10 Sep 09 nicklas 31   spot intensity data on a row-by-row basis from a BASEfile. 
5093 10 Sep 09 nicklas 32   After parsing the headers of a 'spot' section each registered
5093 10 Sep 09 nicklas 33   spot intensity parser will be asked if the section contains
5096 14 Sep 09 nicklas 34   all needed data columns {@link #hasRequiredAssayFields(BaseFileParser, FlatFileParser, List)}.
5093 10 Sep 09 nicklas 35   The first parser that gives a positive response will be used to 
5093 10 Sep 09 nicklas 36   parse the spot intensity data for that section.
5093 10 Sep 09 nicklas 37   <p>
5093 10 Sep 09 nicklas 38   The actual parsing is done in the second pass.
5093 10 Sep 09 nicklas 39
5093 10 Sep 09 nicklas 40   @see FirstPassSectionSpotsParser#addSpotIntensityParser(SpotIntensityParser)
5093 10 Sep 09 nicklas 41   @author Nicklas
5093 10 Sep 09 nicklas 42   @version 2.14
5093 10 Sep 09 nicklas 43   @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 48     Check the list of assay fields to see if all columns that are
5093 10 Sep 09 nicklas 49     required are present or not. This method is called in the 
5093 10 Sep 09 nicklas 50     first pass to decide which spot intensity parser that should
5093 10 Sep 09 nicklas 51     be used in the second pass.
5093 10 Sep 09 nicklas 52     
5096 14 Sep 09 nicklas 53     @param parser The master BASEfile parser
5093 10 Sep 09 nicklas 54     @param ffp The flat file parser that parses the current file
5093 10 Sep 09 nicklas 55     @param assayFields The list of assay fields
5093 10 Sep 09 nicklas 56     @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 61     Prepare for parsing the data section. Preparations typically include
5093 10 Sep 09 nicklas 62     extracting the column indexes of the data columns. This method is 
5093 10 Sep 09 nicklas 63     called in the second pass before starting to parse data for
5093 10 Sep 09 nicklas 64     a 'spot' section. NOTE! The same object instance may be used to
5093 10 Sep 09 nicklas 65     parse more than one section in a serial BASEfile.
5093 10 Sep 09 nicklas 66
5096 14 Sep 09 nicklas 67     @param parser The master BASEfile parser
5093 10 Sep 09 nicklas 68     @param ffp The flat file parser that parses the current file
5093 10 Sep 09 nicklas 69     @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 74     Extract the intensity values from the current data line for a single 
5093 10 Sep 09 nicklas 75     bioassay. If the section contains data for multiple bioassays
5093 10 Sep 09 nicklas 76     (eg. a matrix BASEfile) this method is called multiple times (with
5093 10 Sep 09 nicklas 77     different 'firstIndex' value) for each row.
5093 10 Sep 09 nicklas 78     
5093 10 Sep 09 nicklas 79     @param data The current data line
5093 10 Sep 09 nicklas 80     @param intensities An array that should be populate with intensity values
5093 10 Sep 09 nicklas 81     @param firstIndex The index of the first data column that contains data
5093 10 Sep 09 nicklas 82       for the current bioassay
5093 10 Sep 09 nicklas 83       
5093 10 Sep 09 nicklas 84     @return TRUE if the values could be set correctly, FALSE otherwise (which
5093 10 Sep 09 nicklas 85       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 }