Class GalaxyToolXMLParserUtils


  • public final class GalaxyToolXMLParserUtils
    extends Object
    This class define static utils methods to extract data in Galaxy tool XML file.
    Since:
    2.0
    Author:
    Sandrine Perrin
    • Constructor Detail

      • GalaxyToolXMLParserUtils

        public GalaxyToolXMLParserUtils()
    • Method Detail

      • extractParamElement

        public static Map<String,​ToolElement> extractParamElement​(ToolInfo toolInfo,
                                                                        Element parent,
                                                                        String elementName)
                                                                 throws EoulsanException
        Extract parameter elements.
        Parameters:
        toolInfo - the ToolInfo object
        parent - the parent
        elementName - the element name
        Returns:
        a map with the Galaxy tool elements
        Throws:
        EoulsanException - the Eoulsan exception
      • extractParamElement

        public static Map<String,​ToolElement> extractParamElement​(ToolInfo toolInfo,
                                                                        Element parent,
                                                                        String elementName,
                                                                        Map<String,​Parameter> stepParameters)
                                                                 throws EoulsanException
        Extract parameter elements.
        Parameters:
        toolInfo - the ToolInfo object
        parent - the parent
        elementName - the element name
        stepParameters - step parameters
        Returns:
        a map with the Galaxy tool elements
        Throws:
        EoulsanException - the Eoulsan exception
      • setElementValue

        public static void setElementValue​(ToolElement toolElement,
                                           Map<String,​Parameter> stepParameters)
                                    throws EoulsanException
        Set the tool element value.
        Parameters:
        toolElement - tool element
        stepParameters - step parameters
        Throws:
        EoulsanException - if an error occurs while setting the value
      • extractElementsByTagName

        public static List<Element> extractElementsByTagName​(ToolInfo toolInfo,
                                                             Document doc,
                                                             String tagName,
                                                             int expectedCount)
                                                      throws EoulsanException
        Extract elements by tag name.
        Parameters:
        toolInfo - ToolInfo object
        doc - the doc
        tagName - the tag name
        expectedCount - the expected count
        Returns:
        the list
        Throws:
        EoulsanException - the Eoulsan exception
      • extractElementsByTagName

        public static List<Element> extractElementsByTagName​(Element parent,
                                                             String tagName)
                                                      throws EoulsanException
        Extract elements by tag name.
        Parameters:
        parent - the parent
        tagName - the tag name
        Returns:
        the list
        Throws:
        EoulsanException - the Eoulsan exception
      • extractElementsByTagName

        public static List<Element> extractElementsByTagName​(Element parent,
                                                             String tagName,
                                                             int expectedCount)
                                                      throws EoulsanException
        Extract elements by tag name.
        Parameters:
        parent - the parent
        tagName - the tag name
        expectedCount - the expected count
        Returns:
        the list
        Throws:
        EoulsanException - the Eoulsan exception
      • extractChildElementsByTagName

        public static List<Element> extractChildElementsByTagName​(Element parentElement,
                                                                  String elementName)
        Extract child elements by tag name.
        Parameters:
        parentElement - the parent element
        elementName - the element name
        Returns:
        the list
      • extractOutputs

        public static Map<String,​ToolElement> extractOutputs​(ToolInfo toolInfo,
                                                                   Document doc,
                                                                   Map<String,​Parameter> stepParameters)
                                                            throws EoulsanException
        Extract all output parameters define in document.
        Parameters:
        toolInfo - the tool information
        doc - document represented tool xml
        stepParameters - parameters for analysis
        Returns:
        all output parameters
        Throws:
        EoulsanException - if none output parameter found
      • extractInputs

        public static Map<String,​ToolElement> extractInputs​(ToolInfo toolInfo,
                                                                  Document doc,
                                                                  Map<String,​Parameter> stepParameters)
                                                           throws EoulsanException
        Extract all input parameters define in document.
        Parameters:
        toolInfo - the tool information
        doc - document represented tool xml
        stepParameters - parameters for analysis
        Returns:
        all input parameters
        Throws:
        EoulsanException - if none input parameter found
      • extractCheetahScript

        public static String extractCheetahScript​(Document doc)
        Extract command tag in string.
        Parameters:
        doc - document represented tool xml
        Returns:
        command string
      • extractInterpreters

        public static List<String> extractInterpreters​(Document doc)
        Extract interpreter attribute in string.
        Parameters:
        doc - document represented tool xml
        Returns:
        interpreter names
      • extractDockerImage

        public static String extractDockerImage​(Document doc)
        Extract docker image attribute in string.
        Parameters:
        doc - document represented tool xml
        Returns:
        the docker image name
      • extractDescription

        public static String extractDescription​(Document doc)
        Extract description tag in string.
        Parameters:
        doc - document represented tool xml
        Returns:
        description
      • extractToolVersion

        public static String extractToolVersion​(Document doc)
        Extract tool version attribute in string.
        Parameters:
        doc - document represented tool xml
        Returns:
        tool version string
      • extractToolName

        public static String extractToolName​(Document doc)
        Extract tool name tag in string.
        Parameters:
        doc - document represented tool xml
        Returns:
        tool name string
      • extractToolID

        public static String extractToolID​(Document doc)
        Extract tool id tag in string.
        Parameters:
        doc - document represented tool xml
        Returns:
        tool id string
      • extractValueFromElement

        public static String extractValueFromElement​(Document doc,
                                                     String elementName,
                                                     int index,
                                                     String attributeName)
        Extract text from DOM from tag name, at the index place. If attribute name defined return value attribute, otherwise return content text of element.
        Parameters:
        doc - document represented tool xml
        elementName - element name to extract
        index - index of element name to extract
        attributeName - attribute name from element name to extract
        Returns:
        value corresponding to element name content or attribute of element name. Return null, if none corresponding element or attribute found.