Class MZTabUtils


  • public class MZTabUtils
    extends Object
    Provide a couple of functions for translating, parsing and printing formatted strings defined in the mzTab specification.
    Since:
    30/01/13
    Author:
    qingwei, nilshoffmann
    • Method Detail

      • printDouble

        public static String printDouble​(Double value)
        If ratios are included and the denominator is zero, the "INF" value MUST be used. If the result leads to calculation errors (for example 0/0), this MUST be reported as "not a number" ("NaN").
        Parameters:
        value - a Double object.
        Returns:
        a String object.
        See Also:
        parseDouble(String)
      • parseEmail

        public static String parseEmail​(String target)
        Parse the target string, and check is obey the email format or not. If not, return null.
        Parameters:
        target - a String object.
        Returns:
        a String object.
      • parseMzTabVersion

        public static String parseMzTabVersion​(String target)
        Parse the target string, and check it follows the mzTab Version format. If not, return null.
        Parameters:
        target - a String object.
        Returns:
        a String object.
      • parseParam

        public static de.isas.mztab2.model.Parameter parseParam​(String target)
        Parameters are always reported as [CV label, accession, name, value]. Any field that is not available MUST be left empty. If the name or value of param contains comma, quotes MUST be added to avoid problems. Nested double quotes are not supported. Notice: name cell never set null.
        Parameters:
        target - a String object.
        Returns:
        a Parameter object.
      • parseStringList

        public static List<StringparseStringList​(char splitChar,
                                                   String target)
        Multiple identifiers MUST be separated by splitChar.
        Parameters:
        splitChar - a char.
        target - a String object.
        Returns:
        a List object.
      • parseParamList

        public static List<de.isas.mztab2.model.Parameter> parseParamList​(String target)
        A list of '|' separated parameters
        Parameters:
        target - a String object.
        Returns:
        a List object.
      • parseDouble

        public static Double parseDouble​(String target)
        NOTICE: If ratios are included and the denominator is zero, the "INF" value MUST be used. If the result leads to calculation errors (for example 0/0), this MUST be reported as "not a number" ("NaN").
        Parameters:
        target - a String object.
        Returns:
        a Double object.
      • parsePublicationItems

        public static de.isas.mztab2.model.Publication parsePublicationItems​(de.isas.mztab2.model.Publication publication,
                                                                             int lineNumber,
                                                                             String target)
                                                                      throws uk.ac.ebi.pride.jmztab2.utils.errors.MZTabException
        A publication on this unit. PubMed ids must be prefixed by "pubmed:", DOIs by "doi:". Multiple identifiers MUST be separated by "|".
        Parameters:
        publication - a Publication object.
        lineNumber - the line number while parsing.
        target - a String object.
        Returns:
        a Publication object.
        Throws:
        uk.ac.ebi.pride.jmztab2.utils.errors.MZTabException - in case of parsing or formatting issues of the publication string.
      • translateMinusToUnicode

        public static String translateMinusToUnicode​(String target)
        Solve the conflict about minus char between modification position and CHEMMOD charge. For example: 13-CHEMMOD:-159
        Parameters:
        target - a String object.
        Returns:
        a String object.
      • translateUnicodeToMinus

        public static String translateUnicodeToMinus​(String target)
        Solve the conflict about minus char between modification position and CHEMMOD charge. For example: 13-CHEMMOD:-159
        Parameters:
        target - a String object.
        Returns:
        a String object.
      • translateCommaToTab

        public static String translateCommaToTab​(String target)
        locate param label [label, accession, name, value], translate ',' to '\t'
        Parameters:
        target - a String object.
        Returns:
        a String object.
      • translateTabToComma

        public static String translateTabToComma​(String target)
        solve the conflict about comma char which used in split modification and split cv param components.
        Parameters:
        target - a String object.
        Returns:
        a String object.
      • translateTabToMinus

        public static String translateTabToMinus​(String target)
        solve the conflict about comma char which used in split modification and split cv param components.
        Parameters:
        target - a String object.
        Returns:
        a String object.
      • removeDoubleQuotes

        public static String removeDoubleQuotes​(String value)
        If there exists reserved characters in value, like comma, the string need to be escape. However the escaping char is not store because it will be write back in the writer. Nested double quotes are not supported.
        Parameters:
        value - a String object.
        Returns:
        a String object.