Class MZTabHeaderLineParser
- java.lang.Object
-
- uk.ac.ebi.pride.jmztab2.utils.parser.MZTabLineParser
-
- uk.ac.ebi.pride.jmztab2.utils.parser.MZTabHeaderLineParser
-
- Direct Known Subclasses:
SEHLineParser
,SFHLineParser
,SMHLineParser
public abstract class MZTabHeaderLineParser extends MZTabLineParser
A couple of common method used to parse a header line intoMZTabColumnFactory
structure. NOTICE:MZTabColumnFactory
maintain a couple ofMZTabColumn
which have internal logical position and order. In physical mzTab file, we allow user not obey this logical position organized way, and provide their date with own order. In order to distinguish them, we use physical position (a positive integer) to record the column location in mzTab file. And usePositionMapping
structure the maintain the mapping between them.- Since:
- 11/02/13
- Author:
- qingwei
- See Also:
SMHLineParser
,SMFLineParser
,SMELineParser
-
-
Field Summary
Fields Modifier and Type Field Description protected MZTabColumnFactory
factory
protected de.isas.mztab2.model.Metadata
metadata
-
Fields inherited from class uk.ac.ebi.pride.jmztab2.utils.parser.MZTabLineParser
context, errorList, items, line, lineNumber, section
-
-
Constructor Summary
Constructors Modifier Constructor Description protected
MZTabHeaderLineParser(MZTabParserContext context, MZTabColumnFactory factory, de.isas.mztab2.model.Metadata metadata)
Parse a header line intoMZTabColumnFactory
structure.
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected int
checkAbundanceColumns(int offset, String order)
checkAbundanceColumns.protected boolean
checkOptColumnName(String nameLabel)
Additional columns can be added to the end of the protein table.protected String
fromIndexToOrder(Integer index)
fromIndexToOrder.MZTabColumnFactory
getFactory()
Getter for the fieldfactory
.void
parse(int lineNumber, String line, uk.ac.ebi.pride.jmztab2.utils.errors.MZTabErrorList errorList)
We assume that user before call this method, have parse the raw line is not empty line and start with section prefix.protected abstract int
parseColumns()
This methods delegates to the subclasses the parsing of the columns.protected int
parseIndex(String header, String id)
Parse header to a index id number.protected abstract void
refine()
Some validate operation need to be done after the wholeMZTabColumnFactory
created.protected void
refineOptionalColumn(Section section, String columnHeader)
Refine optional columns and check, whether they were properly defined.
-
-
-
Field Detail
-
factory
protected MZTabColumnFactory factory
-
metadata
protected de.isas.mztab2.model.Metadata metadata
-
-
Constructor Detail
-
MZTabHeaderLineParser
protected MZTabHeaderLineParser(MZTabParserContext context, MZTabColumnFactory factory, de.isas.mztab2.model.Metadata metadata)
Parse a header line intoMZTabColumnFactory
structure.- Parameters:
context
- the parser context, keeping dynamic state and lookup associations.factory
- SHOULD NOT set nullmetadata
- SHOULD NOT set null
-
-
Method Detail
-
parse
public void parse(int lineNumber, String line, uk.ac.ebi.pride.jmztab2.utils.errors.MZTabErrorList errorList) throws uk.ac.ebi.pride.jmztab2.utils.errors.MZTabException
We assume that user before call this method, have parse the raw line is not empty line and start with section prefix. Parse a header line intoMZTabColumnFactory
structure. There are several steps in this method: Step 1:parseColumns()
focus on validate and parse all columns. Step 2:refine()
- Overrides:
parse
in classMZTabLineParser
- Parameters:
lineNumber
- a int.line
- aString
object.errorList
- aMZTabErrorList
object.- Throws:
uk.ac.ebi.pride.jmztab2.utils.errors.MZTabException
- if any.
-
parseColumns
protected abstract int parseColumns() throws uk.ac.ebi.pride.jmztab2.utils.errors.MZTabException
This methods delegates to the subclasses the parsing of the columns. All of the columns are defined inSmallMoleculeColumn
,SmallMoleculeFeatureColumn
, orSmallMoleculeEvidenceColumn
.- Returns:
- the next physical index of column available after the parsing.
- Throws:
uk.ac.ebi.pride.jmztab2.utils.errors.MZTabException
- if any structural or logical errors are encountered that prohibit further processing.
-
refine
protected abstract void refine() throws uk.ac.ebi.pride.jmztab2.utils.errors.MZTabException
Some validate operation need to be done after the wholeMZTabColumnFactory
created. Thus, user can add them, and called at the end of theparse(int, String, MZTabErrorList)
method.- Throws:
uk.ac.ebi.pride.jmztab2.utils.errors.MZTabException
- if any structural or logical errors are encountered that prohibit further processing.
-
refineOptionalColumn
protected void refineOptionalColumn(Section section, String columnHeader) throws uk.ac.ebi.pride.jmztab2.utils.errors.MZTabException
Refine optional columns and check, whether they were properly defined. These re-validate operation will called inrefine()
method.
-
fromIndexToOrder
protected String fromIndexToOrder(Integer index)
fromIndexToOrder.
-
checkOptColumnName
protected boolean checkOptColumnName(String nameLabel) throws uk.ac.ebi.pride.jmztab2.utils.errors.MZTabException
Additional columns can be added to the end of the protein table. These column headers MUST start with the prefix "opt_". Column names MUST only contain the following characters: 'A'-'Z', 'a'-'z', '0'-'9', '_', '-', '[', ']', and ':'. the format: opt_{IndexedElement[id]}_{value}. Spaces within the parameter's name MUST be replaced by '_'.- Parameters:
nameLabel
- aString
object.- Returns:
- a boolean.
- Throws:
uk.ac.ebi.pride.jmztab2.utils.errors.MZTabException
- if any structural or logical errors are encountered that prohibit further processing.
-
checkAbundanceColumns
protected int checkAbundanceColumns(int offset, String order) throws uk.ac.ebi.pride.jmztab2.utils.errors.MZTabException
checkAbundanceColumns.
- Parameters:
offset
- a int.order
- aString
object.- Returns:
- a int.
- Throws:
uk.ac.ebi.pride.jmztab2.utils.errors.MZTabException
- if any structural or logical errors are encountered that prohibit further processing.
-
parseIndex
protected int parseIndex(String header, String id) throws uk.ac.ebi.pride.jmztab2.utils.errors.MZTabException
Parse header to a index id number. If exists parse error, stop validate and throwMZTabException
directly.
-
getFactory
public MZTabColumnFactory getFactory()
Getter for the field
factory
.- Returns:
- a
MZTabColumnFactory
object.
-
-