001package uk.ac.ebi.pride.jmztab2.model; 002 003/** 004 * Define a couple of constants used in the jmzTab API. 005 * 006 * @author qingwei 007 * @author nilshoffmann 008 * @since 08/03/13 009 * 010 */ 011public final class MZTabConstants { 012 /** Constant <code>NEW_LINE="System.getProperty(line.separator)"</code> */ 013 public static final String NEW_LINE = "\r\n";//System.getProperty("line.separator"); 014 /** Constant <code>NULL="null"</code> */ 015 public static final String NULL = "null"; 016 /** Constant <code>INFINITY="INF"</code> */ 017 public static final String INFINITY = "INF"; 018 /** Constant <code>CALCULATE_ERROR="NaN"</code> */ 019 public static final String CALCULATE_ERROR = "NaN"; 020 021 /** Constant <code>TAB='\u0009'</code> */ 022 public static final char TAB = '\u0009'; 023 /** Constant <code>TABs=""+'\u0009'</code> */ 024 public static final String TAB_STRING = ""+TAB; 025 /** Constant <code>MINUS='-'</code> */ 026 public static final char MINUS = '-'; 027 /** Constant <code>BAR='\u007c'</code> */ 028 public static final char BAR = '\u007c'; 029 /** Constant <code>BAR='\u007c'</code> */ 030 public static final String BAR_S = ""+BAR; 031 /** Constant <code>COLON=':'</code> */ 032 public static final char COLON = ':'; 033 /** Constant <code>COMMA=','</code> */ 034 public static final char COMMA = ','; 035 /** Constant <code>VERSION="2.0.0-M"</code> */ 036 public static final String VERSION_MZTAB_M = "2.0.0-M"; 037 /** Constant <code>OPT_PREFIX="opt_"</code> */ 038 public static final String OPT_PREFIX = "opt_"; 039 /** Constant <code>ABUNDANCE_PREFIX="abundance_"</code> */ 040 public static final String ABUNDANCE_PREFIX = "abundance_"; 041 /** Constant <code>GLOBAL="global"</code> */ 042 public static final String GLOBAL = "global"; 043 /** Constant <code>CV_PREFIX="cv_"</code> */ 044 public static final String CV_PREFIX = "cv_"; 045 046 /* 047 Regular expressions that are not directly applicable to domain objects. 048 */ 049 /** Constant <code>REGEX_INDEXED_VALUE="\\[(\\d+)\\]"</code> */ 050 public static final String REGEX_INDEXED_VALUE = "\\[(\\d+)\\]"; 051 /** Constant <code>REGEX_CV_PARAM_OPT_COLUMN_NAME="cv(_([A-Za-z0-9\\-\\[\\]:\\.]+))?(_([A-Za-z0-9_\\-\\[\\]:\\.]+)*)"</code> */ 052 public static final String REGEX_CV_PARAM_OPT_COLUMN_NAME = "cv(_([A-Za-z0-9\\-\\[\\]:\\.]+))?(_([A-Za-z0-9_\\-\\[\\]:\\.]+)*)"; 053 /** Constant <code>REGEX_OPT_COLUMN_NAME="opt_((assay|study_variable|ms_run)\\[(\\w+)\\]|global)_([A-Za-z0-9_\\-\\[\\]:\\.]+)"</code> */ 054 public static final String REGEX_OPT_COLUMN_NAME = "opt_((assay|study_variable|ms_run)\\[(\\w+)\\]|global)_([A-Za-z0-9_\\-\\[\\]:\\.]+)"; 055 /** Constant <code>REGEX_ABUNDANCE_COLUMN_NAME="abundance_(.+)"</code> */ 056 public static final String REGEX_ABUNDANCE_COLUMN_NAME = "abundance_(.+)"; 057 /** Constant <code>REGEX_ABUNDANCE_ASSAY_COLUMN_NAME="assay\\[(\\d+)\\]"</code> */ 058 public static final String REGEX_ABUNDANCE_ASSAY_COLUMN_NAME = "assay"+REGEX_INDEXED_VALUE; 059 /** Constant <code>REGEX_STUDY_VARIABLE_COLUMN_NAME="study_variable\\[(\\d+)\\]"</code> */ 060 public static final String REGEX_STUDY_VARIABLE_COLUMN_NAME = "study_variable"+REGEX_INDEXED_VALUE; 061 /** Constant <code>REGEX_NORMAL_METADATA="(\\w+)(\\[(\\w+)\\])?(-(\\w+)(\\[(\\w+)\\])?)?(-(\\w+))?"</code> */ 062 public static final String REGEX_NORMAL_METADATA = "(\\w+)(\\[(\\w+)\\])?(-(\\w+)(\\[(\\w+)\\])?)?(-(\\w+))?"; 063 /** Constant <code>REGEX_EMAIL="[_A-Za-z0-9-]+(\\.[_A-Za-z0-9-']+)*@[A-Za-z0-9]+(?:[-.][A-Za-z0-9]+)*(\\.[A-Za-z]{2,})"</code> */ 064 public static final String REGEX_EMAIL = "[_A-Za-z0-9-]+(\\.[_A-Za-z0-9-']+)*@[A-Za-z0-9]+(?:[-.][A-Za-z0-9]+)*(\\.[A-Za-z]{2,})"; 065 /** Constant {@code REGEX_MZTAB_M="(?<major>[2]{1})\\.(?<minor>\\d{1})\\.(?<micro>\\d{1})-(?<profile>[M]{1})"} */ 066 public static final String REGEX_MZTAB_M = "(?<major>[2]{1})\\.(?<minor>\\d{1})\\.(?<micro>\\d{1})-(?<profile>[M]{1})"; 067 /** Constant <code>REGEX_PARAM_SPLIT=",(?=([^\"]*\"[^\"]*\")*[^\"]*$)"</code> */ 068 public static final String REGEX_PARAM_SPLIT = ",(?=([^\"]*\"[^\"]*\")*[^\"]*$)"; 069 /** Constant <code>REGEX_DEFAULT_RELIABILITY="[1234]{1}"</code> */ 070 public static final String REGEX_DEFAULT_RELIABILITY = "[1234]{1}"; 071 /** More complex for isotopes: \[\d*M([\w\d]+)*([+-][\w\d]+)*\]\d*[+-] **/ 072 /** Constant <code>REGEX_ADDUCT="^\[\d*M([+-][\w\d]+)*\]\d*[+-]$"</code> */ 073 public static final String REGEX_ADDUCT = "^\\[\\d*M([+-][\\w\\d]+)*\\]\\d*[+-]$"; 074 075}