001/* 002 * Copyright 2018 Leibniz-Institut für Analytische Wissenschaften – ISAS – e.V.. 003 * 004 * Licensed under the Apache License, Version 2.0 (the "License"); 005 * you may not use this file except in compliance with the License. 006 * You may obtain a copy of the License at 007 * 008 * http://www.apache.org/licenses/LICENSE-2.0 009 * 010 * Unless required by applicable law or agreed to in writing, software 011 * distributed under the License is distributed on an "AS IS" BASIS, 012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 013 * See the License for the specific language governing permissions and 014 * limitations under the License. 015 */ 016package uk.ac.ebi.pride.jmztab2.model; 017 018import de.isas.mztab2.model.IndexedElement; 019 020/** 021 * <p>IMZTabColumn interface.</p> 022 * 023 * @author nilshoffmann 024 * @since 2.0 025 * 026 */ 027public interface IMZTabColumn { 028 029 /** 030 * Get the column data type Class. 031 * 032 * @return a {@link java.lang.Class} object. 033 */ 034 Class<?> getDataType(); 035 036 /** 037 * Indexed element used in optional column header and logical position 038 * definition. In stable column, the return is null. 039 * 040 * Notice: this design pattern not fit for 041 * {@link uk.ac.ebi.pride.jmztab2.model.AbundanceColumn}, {@link uk.ac.ebi.pride.jmztab2.model.OptionColumn} and 042 * {@link ParameterOptionColumn}. These optional columns need be generated by 043 * calling {@link uk.ac.ebi.pride.jmztab2.model.MZTabColumnFactory} 's methods. 044 * 045 * @see #getHeader() 046 * @see #getLogicPosition() 047 * @see #getHeader() 048 * @see #getLogicPosition() 049 * @return a {@link de.isas.mztab2.model.IndexedElement} object. 050 */ 051 Object getElement(); 052 053 /** 054 * Get the column name. For stable column, name and header are same. While 055 * for optional column, name is part of its header. For example, optional 056 * column which header is search_engine_score_ms_run[1-n], and its name is 057 * search_engine_score. Besides this, ms_run[1-n] is kind of 058 * {@link #getElement()} 059 * 060 * Notice: this design pattern not fit for 061 * {@link uk.ac.ebi.pride.jmztab2.model.AbundanceColumn}, {@link uk.ac.ebi.pride.jmztab2.model.OptionColumn} and 062 * {@link ParameterOptionColumn}. These optional columns need be generated by 063 * calling {@link uk.ac.ebi.pride.jmztab2.model.MZTabColumnFactory} 's methods. 064 * 065 * @see #getName() 066 * @see #setElement(IndexedElement) 067 * @see #getName() 068 * @see #setElement(IndexedElement) 069 * @return a {@link java.lang.String} object. 070 */ 071 String getHeader(); 072 073 /** 074 * Get the column logical position. For stable column, order and logical 075 * position are same. But for optional column, the logical position need to 076 * calculate by concatenate order and index element id. For example, 077 * optional column search_engine_score_ms_run[2] in Protein section, its 078 * order is 09, and the logical position is 092. Because the element 079 * ms_run[2] 's index is 2. 080 * 081 * <p>Notice: this design pattern not fit for 082 * {@link uk.ac.ebi.pride.jmztab2.model.AbundanceColumn}, {@link uk.ac.ebi.pride.jmztab2.model.OptionColumn} and 083 * {@link ParameterOptionColumn}. These optional columns need be generated by 084 * calling {@link uk.ac.ebi.pride.jmztab2.model.MZTabColumnFactory} 's methods.</p> 085 * 086 * <p> 087 * Notice: in {@link uk.ac.ebi.pride.jmztab2.model.MZTabColumnFactory}, we use logical position to 088 * maintain the logical consistence with in {@link de.isas.mztab2.model.MzTab}. During the 089 * process of parsing mzTab file, we create a mapping between physical 090 * position and internal logical position.</p> 091 * 092 * @see #getOrder() 093 * @return a {@link java.lang.String} object. 094 */ 095 String getLogicPosition(); 096 097 /** 098 * Get the column name. For stable column, name and header are same. But for 099 * optional column, name is part of its header. For example, optional column 100 * which header is search_engine_score_ms_run[1-n], and its name is 101 * search_engine_score. Besides this, ms_run[1-n] is kind of 102 * {@link #getElement()} 103 * 104 * Notice: this design pattern not fit for 105 * {@link uk.ac.ebi.pride.jmztab2.model.AbundanceColumn}, {@link uk.ac.ebi.pride.jmztab2.model.OptionColumn} and 106 * {@link ParameterOptionColumn}. These optional columns need be generated by 107 * calling {@link uk.ac.ebi.pride.jmztab2.model.MZTabColumnFactory} 's methods. 108 * 109 * @see #getHeader() 110 * @see #setElement(IndexedElement) 111 * @see #getHeader() 112 * @see #setElement(IndexedElement) 113 * @return a {@link java.lang.String} object. 114 */ 115 String getName(); 116 117 /** 118 * Get the column internal order. For stable column, order and logical 119 * position are same. But for optional column, the logical position need to 120 * be calculated by concatenating order and index element id. For example, 121 * optional column search_engine_score_ms_run[2] in Protein section, its 122 * order is 09, and the logical position is 092. Because the element 123 * ms_run[2] 's index is 2. 124 * 125 * Notice: this design pattern not fit for 126 * {@link uk.ac.ebi.pride.jmztab2.model.AbundanceColumn}, {@link uk.ac.ebi.pride.jmztab2.model.OptionColumn} and 127 * {@link ParameterOptionColumn}. These optional columns need be generated by 128 * calling {@link uk.ac.ebi.pride.jmztab2.model.MZTabColumnFactory} 's methods. 129 * 130 * @see #getLogicPosition() 131 * @return a {@link java.lang.String} object. 132 */ 133 String getOrder(); 134 135 /** 136 * Judge this column belong to stable column or optional column. 137 * 138 * @return a boolean. 139 */ 140 boolean isOptional(); 141 142 /** 143 * <p>setHeader.</p> 144 * 145 * @param header a {@link java.lang.String} object. 146 */ 147 void setHeader(String header); 148 149 /** 150 * <p>setLogicPosition.</p> 151 * 152 * @param logicPosition a {@link java.lang.String} object. 153 */ 154 void setLogicPosition(String logicPosition); 155 156 /* 157 * Allows to reassign the order in case the file doesn't follow the recommended order 158 */ 159 /** 160 * <p>setOrder.</p> 161 * 162 * @param order a {@link java.lang.String} object. 163 */ 164 void setOrder(String order); 165 166 /** 167 * Indexed element used in optional column header and logical position 168 * definition. In stable column, the return is null. 169 * 170 * Notice: this design pattern not fit for 171 * {@link uk.ac.ebi.pride.jmztab2.model.AbundanceColumn}, {@link uk.ac.ebi.pride.jmztab2.model.OptionColumn} and 172 * {@link ParameterOptionColumn}. These optional columns need be generated by 173 * calling {@link uk.ac.ebi.pride.jmztab2.model.MZTabColumnFactory} 's methods. 174 * 175 * @see #getHeader() 176 * @see #getLogicPosition() 177 * @see #getHeader() 178 * @see #getLogicPosition() 179 * @param element SHOULD NOT set null. 180 */ 181 void setElement(Object element); 182 183}