Package uk.ac.ebi.pride.jmztab2.model
Class MZTabColumnFactory
- java.lang.Object
-
- uk.ac.ebi.pride.jmztab2.model.MZTabColumnFactory
-
public class MZTabColumnFactory extends Object
This is a static factory class which used to generate a couple of MZTabColumn objects, and organizes them into "logicalPosition, MZTabColumn" pairs. Currently, mzTab table including three kinds of columns:-
Stable column with stable order: header name, data type, logical position and
order are stable in these columns. All of them are defined in
SmallMoleculeColumn
,SmallMoleculeFeatureColumn
, andSmallMoleculeEvidenceColumn
. -
Optional column with stable order: column name, data type and order are
defined in the
SmallMoleculeColumn
,SmallMoleculeFeatureColumn
, andSmallMoleculeEvidenceColumn
. But header name, logical position dynamically depend onIndexedElement
. -
Optional columns which are placed at the end of a table-based section. There
are three types of optional column:
AbundanceColumn
,OptionColumn
andParameterOptionColumn
, which always are added at the end of the table. These optional columns have no stable column name, data type or order. In this factory, we useaddOptionalColumn(String, Class)
to createOptionColumn
; and#addOptionalColumn(de.isas.mztab2.model.IndexedElement, java.lang.String, java.lang.Class)
or#addOptionalColumn(IndexedElement, Parameter, Class)
to createParameterOptionColumn
.
- Since:
- 23/05/13
- Author:
- qingwei, nilshoffmann
-
Stable column with stable order: header name, data type, logical position and
order are stable in these columns. All of them are defined in
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description String
addAbundanceOptionalColumn(Assay assay, String order)
addAbundanceOptionalColumn.String
addAbundanceOptionalColumn(StudyVariable studyVariable, String columnHeader, String order)
String
addIdConfidenceMeasureColumn(Parameter parameter, Integer index, Class columnType)
addIdConfidenceMeasureColumn.String
addOptionalColumn(Parameter param, Class columnType)
String
addOptionalColumn(String name, Class columnType)
<T> String
addOptionalColumn(T columnEntity, Parameter param, Class columnType)
AddParameterOptionColumn
followed by an indexed element (study variable, assay, ms run) intooptionalColumnMapping
andcolumnMapping
.<T> String
addOptionalColumn(T columnEntity, String name, Class columnType)
AddOptionColumn
followed by an indexed element (study variable, assay, ms run) intooptionalColumnMapping
andcolumnMapping
.IMZTabColumn
findColumnByHeader(String header)
Query the MZTabColumn in factory, based on column header with case-insensitive.SortedMap<String,IMZTabColumn>
getColumnMapping()
Get all columns in the factory.static MZTabColumnFactory
getInstance(Section section)
Retrieves the MZTabColumnFactory accordingly to thesection
SortedMap<Integer,IMZTabColumn>
getOffsetColumnsMap()
The offset record the position of MZTabColumn in header line.SortedMap<String,IMZTabColumn>
getOptionalColumnMapping()
Get all optional columns, including option column with stable order and name, abundance columns, optional columns and cv param optional columns.SortedMap<String,IMZTabColumn>
getStableColumnMapping()
Get stable columns mapping.
-
-
-
Method Detail
-
getInstance
public static MZTabColumnFactory getInstance(Section section)
Retrieves the MZTabColumnFactory accordingly to thesection
- Parameters:
section
- SHOULD beSection.Protein_Header
,Section.Peptide_Header
Section.PSM_Header
orSection.Small_Molecule_Header
.- Returns:
- a
MZTabColumnFactory
object.
-
getStableColumnMapping
public SortedMap<String,IMZTabColumn> getStableColumnMapping()
Get stable columns mapping. Key is logical position, and value is MZTabColumn object. Stable column with stable order: header name, data type, logical position and order are stable in these columns. All of them have been defined in nullSmallMoleculeColumn
,SmallMoleculeFeatureColumn
,SmallMoleculeEvidenceColumn
.- Returns:
- a
SortedMap
object.
-
getOptionalColumnMapping
public SortedMap<String,IMZTabColumn> getOptionalColumnMapping()
Get all optional columns, including option column with stable order and name, abundance columns, optional columns and cv param optional columns. Key is logical position, and value is MZTabColumn object.- Returns:
- a
SortedMap
object. - See Also:
AbundanceColumn
,OptionColumn
,ParameterOptionColumn
-
getColumnMapping
public SortedMap<String,IMZTabColumn> getColumnMapping()
Get all columns in the factory. In this class, we maintain the following constraint at any time:- Returns:
- a
SortedMap
object.
-
addOptionalColumn
public String addOptionalColumn(String name, Class columnType)
Add globalOptionColumn
intooptionalColumnMapping
andcolumnMapping
. The header like: opt_global_{name}- Parameters:
name
- SHOULD NOT be empty.columnType
- SHOULD NOT be empty.- Returns:
- the column's logic position.
-
addOptionalColumn
public <T> String addOptionalColumn(T columnEntity, String name, Class columnType)
AddOptionColumn
followed by an indexed element (study variable, assay, ms run) intooptionalColumnMapping
andcolumnMapping
. The header will look like: opt_study_variable[1]_{name} for a study variable- Type Parameters:
T
- the type of the columnEntity.- Parameters:
columnEntity
- SHOULD NOT be empty.name
- SHOULD NOT be empty.columnType
- SHOULD NOT be empty.- Returns:
- the column's logic position.
-
addOptionalColumn
public String addOptionalColumn(Parameter param, Class columnType)
Add globalParameterOptionColumn
intooptionalColumnMapping
andcolumnMapping
. The header like: opt_global_cv_{accession}_{parameter name}- Parameters:
param
- SHOULD NOT empty.columnType
- SHOULD NOT empty.- Returns:
- the column's logic position.
-
addOptionalColumn
public <T> String addOptionalColumn(T columnEntity, Parameter param, Class columnType)
AddParameterOptionColumn
followed by an indexed element (study variable, assay, ms run) intooptionalColumnMapping
andcolumnMapping
. The header will look like: opt_assay[1]_cv_{accession}_{parameter name} for an assay.- Type Parameters:
T
- the type of the columnEntity.- Parameters:
columnEntity
- SHOULD NOT empty.param
- SHOULD NOT empty.columnType
- SHOULD NOT empty.- Returns:
- the column's logic position.
-
addAbundanceOptionalColumn
public String addAbundanceOptionalColumn(Assay assay, String order)
addAbundanceOptionalColumn.
- Parameters:
assay
- aAssay
object.order
- the order string for this column.- Returns:
- the column's logic position.
-
addAbundanceOptionalColumn
public String addAbundanceOptionalColumn(StudyVariable studyVariable, String columnHeader, String order)
Add anAbundanceColumn
intoAbundanceColumn
,optionalColumnMapping
andcolumnMapping
. The header can be one of abundance_study_variable[1], abundance_coeffvar_study_variable[1].- Parameters:
studyVariable
- SHOULD NOT empty.columnHeader
- the column header without the 'abundance_' prefix.order
- the order string for this column.- Returns:
- the column's logic position.
- See Also:
AbundanceColumn.createOptionalColumns(uk.ac.ebi.pride.jmztab2.model.Section, de.isas.mztab2.model.StudyVariable, java.lang.String, java.lang.String)
-
addIdConfidenceMeasureColumn
public String addIdConfidenceMeasureColumn(Parameter parameter, Integer index, Class columnType)
addIdConfidenceMeasureColumn.
-
getOffsetColumnsMap
public SortedMap<Integer,IMZTabColumn> getOffsetColumnsMap()
The offset record the position of MZTabColumn in header line. For example, protein header line, the relationships between Logical Position, MZTabColumn, offset and order are like following structure: Logical Position MZTabColumn offset order "01" accession 1 01 "02" description 2 02 ...... "08" best_search_engine_score 8 08 "091" search_engine_score_ms_run[1] 9 09 "092" search_engine_score_ms_run[2] 10 09 "10" reliability 11 10 "111" num_psms_ms_run[1] 12 11 "112" num_psms_ms_run[2] 13 11- Returns:
- a
SortedMap
object with the offsets for each column.
-
findColumnByHeader
public IMZTabColumn findColumnByHeader(String header)
Query the MZTabColumn in factory, based on column header with case-insensitive. Notice: for optional columns, header name maybe flexible. For example, num_psms_ms_run[1]. At this time, user SHOULD BE provide the full header name to query MZTabColumn. If just provide num_psms_ms_run, return null.- Parameters:
header
- the column header to use as the search key.- Returns:
- a
IMZTabColumn
object or null.
-
-