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 intoMZTabColumnFactorystructure. NOTICE:MZTabColumnFactorymaintain a couple ofMZTabColumnwhich 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 usePositionMappingstructure 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 MZTabColumnFactoryfactoryprotected de.isas.mztab2.model.Metadatametadata-
Fields inherited from class uk.ac.ebi.pride.jmztab2.utils.parser.MZTabLineParser
context, errorList, items, line, lineNumber, section
-
-
Constructor Summary
Constructors Modifier Constructor Description protectedMZTabHeaderLineParser(MZTabParserContext context, MZTabColumnFactory factory, de.isas.mztab2.model.Metadata metadata)Parse a header line intoMZTabColumnFactorystructure.
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected intcheckAbundanceColumns(int offset, String order)checkAbundanceColumns.protected booleancheckOptColumnName(String nameLabel)Additional columns can be added to the end of the protein table.protected StringfromIndexToOrder(Integer index)fromIndexToOrder.MZTabColumnFactorygetFactory()Getter for the fieldfactory.voidparse(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 intparseColumns()This methods delegates to the subclasses the parsing of the columns.protected intparseIndex(String header, String id)Parse header to a index id number.protected abstract voidrefine()Some validate operation need to be done after the wholeMZTabColumnFactorycreated.protected voidrefineOptionalColumn(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 intoMZTabColumnFactorystructure.- 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 intoMZTabColumnFactorystructure. There are several steps in this method: Step 1:parseColumns()focus on validate and parse all columns. Step 2:refine()- Overrides:
parsein classMZTabLineParser- Parameters:
lineNumber- a int.line- aStringobject.errorList- aMZTabErrorListobject.- 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 wholeMZTabColumnFactorycreated. 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- aStringobject.- 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- aStringobject.- 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 throwMZTabExceptiondirectly.
-
getFactory
public MZTabColumnFactory getFactory()
Getter for the field
factory.- Returns:
- a
MZTabColumnFactoryobject.
-
-