MZTabConstants.java

  1. package uk.ac.ebi.pride.jmztab2.model;

  2. /**
  3.  * Define a couple of constants used in the jmzTab API.
  4.  *
  5.  * @author qingwei
  6.  * @author nilshoffmann
  7.  * @since 08/03/13
  8.  *
  9.  */
  10. public final class MZTabConstants {
  11.     /** Constant <code>NEW_LINE="System.getProperty(line.separator)"</code> */
  12.     public static final String NEW_LINE = "\r\n";//System.getProperty("line.separator");
  13.     /** Constant <code>NULL="null"</code> */
  14.     public static final String NULL = "null";
  15.     /** Constant <code>INFINITY="INF"</code> */
  16.     public static final String INFINITY = "INF";
  17.     /** Constant <code>CALCULATE_ERROR="NaN"</code> */
  18.     public static final String CALCULATE_ERROR = "NaN";

  19.     /** Constant <code>TAB='\u0009'</code> */
  20.     public static final char TAB = '\u0009';
  21.     /** Constant <code>TABs=""+'\u0009'</code> */
  22.     public static final String TAB_STRING = ""+TAB;
  23.     /** Constant <code>MINUS='-'</code> */
  24.     public static final char MINUS = '-';
  25.     /** Constant <code>BAR='\u007c'</code> */
  26.     public static final char BAR = '\u007c';
  27.     /** Constant <code>BAR='\u007c'</code> */
  28.     public static final String BAR_S = ""+BAR;
  29.     /** Constant <code>COLON=':'</code> */
  30.     public static final char COLON = ':';
  31.     /** Constant <code>COMMA=','</code> */
  32.     public static final char COMMA = ',';
  33.     /** Constant <code>VERSION="2.0.0-M"</code> */
  34.     public static final String VERSION_MZTAB_M = "2.0.0-M";
  35.     /** Constant <code>OPT_PREFIX="opt_"</code> */
  36.     public static final String OPT_PREFIX = "opt_";
  37.     /** Constant <code>ABUNDANCE_PREFIX="abundance_"</code> */
  38.     public static final String ABUNDANCE_PREFIX = "abundance_";
  39.     /** Constant <code>GLOBAL="global"</code> */
  40.     public static final String GLOBAL = "global";
  41.     /** Constant <code>CV_PREFIX="cv_"</code> */
  42.     public static final String CV_PREFIX = "cv_";
  43.    
  44.     /*
  45.      Regular expressions that are not directly applicable to domain objects.
  46.     */
  47.     /** Constant <code>REGEX_INDEXED_VALUE="\\[(\\d+)\\]"</code> */
  48.     public static final String REGEX_INDEXED_VALUE = "\\[(\\d+)\\]";
  49.     /** Constant <code>REGEX_CV_PARAM_OPT_COLUMN_NAME="cv(_([A-Za-z0-9\\-\\[\\]:\\.]+))?(_([A-Za-z0-9_\\-\\[\\]:\\.]+)*)"</code> */
  50.     public static final String REGEX_CV_PARAM_OPT_COLUMN_NAME = "cv(_([A-Za-z0-9\\-\\[\\]:\\.]+))?(_([A-Za-z0-9_\\-\\[\\]:\\.]+)*)";
  51.     /** Constant <code>REGEX_OPT_COLUMN_NAME="opt_((assay|study_variable|ms_run)\\[(\\w+)\\]|global)_([A-Za-z0-9_\\-\\[\\]:\\.]+)"</code> */
  52.     public static final String REGEX_OPT_COLUMN_NAME = "opt_((assay|study_variable|ms_run)\\[(\\w+)\\]|global)_([A-Za-z0-9_\\-\\[\\]:\\.]+)";
  53.     /** Constant <code>REGEX_ABUNDANCE_COLUMN_NAME="abundance_(.+)"</code> */
  54.     public static final String REGEX_ABUNDANCE_COLUMN_NAME = "abundance_(.+)";
  55.     /** Constant <code>REGEX_ABUNDANCE_ASSAY_COLUMN_NAME="assay\\[(\\d+)\\]"</code> */
  56.     public static final String REGEX_ABUNDANCE_ASSAY_COLUMN_NAME = "assay"+REGEX_INDEXED_VALUE;
  57.     /** Constant <code>REGEX_STUDY_VARIABLE_COLUMN_NAME="study_variable\\[(\\d+)\\]"</code> */
  58.     public static final String REGEX_STUDY_VARIABLE_COLUMN_NAME = "study_variable"+REGEX_INDEXED_VALUE;
  59.     /** Constant <code>REGEX_NORMAL_METADATA="(\\w+)(\\[(\\w+)\\])?(-(\\w+)(\\[(\\w+)\\])?)?(-(\\w+))?"</code> */
  60.     public static final String REGEX_NORMAL_METADATA = "(\\w+)(\\[(\\w+)\\])?(-(\\w+)(\\[(\\w+)\\])?)?(-(\\w+))?";
  61.     /** 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> */
  62.     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,})";
  63.     /** Constant {@code REGEX_MZTAB_M="(?<major>[2]{1})\\.(?<minor>\\d{1})\\.(?<micro>\\d{1})-(?<profile>[M]{1})"} */
  64.     public static final String REGEX_MZTAB_M = "(?<major>[2]{1})\\.(?<minor>\\d{1})\\.(?<micro>\\d{1})-(?<profile>[M]{1})";
  65.     /** Constant <code>REGEX_PARAM_SPLIT=",(?=([^\"]*\"[^\"]*\")*[^\"]*$)"</code> */
  66.     public static final String REGEX_PARAM_SPLIT = ",(?=([^\"]*\"[^\"]*\")*[^\"]*$)";
  67.     /** Constant <code>REGEX_DEFAULT_RELIABILITY="[1234]{1}"</code> */
  68.     public static final String REGEX_DEFAULT_RELIABILITY = "[1234]{1}";
  69.     /** More complex for isotopes: \[\d*M([\w\d]+)*([+-][\w\d]+)*\]\d*[+-] **/
  70.     /** Constant <code>REGEX_ADDUCT="^\[\d*M([+-][\w\d]+)*\]\d*[+-]$"</code> */
  71.     public static final String REGEX_ADDUCT = "^\\[\\d*M([+-][\\w\\d]+)*\\]\\d*[+-]$";
  72.    
  73. }