Class GalaxyToolXMLParserUtils
java.lang.Object
fr.ens.biologie.genomique.eoulsan.galaxytools.GalaxyToolXMLParserUtils
This class define static utils methods to extract data in Galaxy tool XML file.
- Since:
- 2.0
- Author:
- Sandrine Perrin
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic StringExtract command tag in string.extractChildElementsByTagName(Element parentElement, String elementName) Extract child elements by tag name.static Map<String,ToolElement> extractConditionalParamElement(ToolInfo toolInfo, Element parent) Extract conditional param element.static Map<String,ToolElement> extractConditionalParamElement(ToolInfo toolInfo, Element parent, Map<String, Parameter> stepParameters) Extract conditional param element.static StringExtract description tag in string.static StringExtract docker image attribute in string.extractElementsByTagName(ToolInfo toolInfo, Document doc, String tagName) Extract elements by tag name.extractElementsByTagName(ToolInfo toolInfo, Document doc, String tagName, int expectedCount) Extract elements by tag name.extractElementsByTagName(Element parent, String tagName) Extract elements by tag name.extractElementsByTagName(Element parent, String tagName, int expectedCount) Extract elements by tag name.static Map<String,ToolElement> Extract all input parameters define in document.Extract interpreter attribute in string.static Map<String,ToolElement> Extract all output parameters define in document.static Map<String,ToolElement> extractParamElement(ToolInfo toolInfo, Element parent, String elementName) Extract parameter elements.static Map<String,ToolElement> extractParamElement(ToolInfo toolInfo, Element parent, String elementName, Map<String, Parameter> stepParameters) Extract parameter elements.static StringextractToolID(Document doc) Extract tool id tag in string.static StringextractToolName(Document doc) Extract tool name tag in string.static StringExtract tool version attribute in string.static StringextractValueFromElement(Document doc, String elementName, int index, String attributeName) Extract text from DOM from tag name, at the index place.static EoulsanExceptionnewEoulsanException(ToolInfo toolInfo, String message) Create an EoulsanException.static EoulsanExceptionnewEoulsanException(ToolInfo toolInfo, String parameterName, String message) Create an EoulsanException.static voidsetElementValue(ToolElement toolElement, Map<String, Parameter> stepParameters) Set the tool element value.
-
Constructor Details
-
GalaxyToolXMLParserUtils
public GalaxyToolXMLParserUtils()
-
-
Method Details
-
extractParamElement
public static Map<String,ToolElement> extractParamElement(ToolInfo toolInfo, Element parent, String elementName) throws EoulsanException Extract parameter elements.- Parameters:
toolInfo- the ToolInfo objectparent- the parentelementName- 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 EoulsanExceptionExtract parameter elements.- Parameters:
toolInfo- the ToolInfo objectparent- the parentelementName- the element namestepParameters- 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 EoulsanExceptionSet the tool element value.- Parameters:
toolElement- tool elementstepParameters- step parameters- Throws:
EoulsanException- if an error occurs while setting the value
-
extractConditionalParamElement
public static Map<String,ToolElement> extractConditionalParamElement(ToolInfo toolInfo, Element parent) throws EoulsanException Extract conditional param element.- Parameters:
toolInfo- tool info objectparent- the parent- Returns:
- the map
- Throws:
EoulsanException- the Eoulsan exception
-
extractConditionalParamElement
public static Map<String,ToolElement> extractConditionalParamElement(ToolInfo toolInfo, Element parent, Map<String, Parameter> stepParameters) throws EoulsanExceptionExtract conditional param element.- Parameters:
toolInfo- tool info objectparent- the parentstepParameters- the step parameters- Returns:
- the map
- Throws:
EoulsanException- the Eoulsan exception
-
extractElementsByTagName
public static List<Element> extractElementsByTagName(ToolInfo toolInfo, Document doc, String tagName) throws EoulsanException Extract elements by tag name.- Parameters:
toolInfo- tool info objectdoc- the doctagName- the tag name- Returns:
- the list
- Throws:
EoulsanException- the Eoulsan exception
-
extractElementsByTagName
public static List<Element> extractElementsByTagName(ToolInfo toolInfo, Document doc, String tagName, int expectedCount) throws EoulsanException Extract elements by tag name.- Parameters:
toolInfo- ToolInfo objectdoc- the doctagName- the tag nameexpectedCount- the expected count- Returns:
- the list
- Throws:
EoulsanException- the Eoulsan exception
-
newEoulsanException
public static EoulsanException newEoulsanException(ToolInfo toolInfo, String message) throws EoulsanException Create an EoulsanException.- Parameters:
toolInfo- toolInfo objectmessage- error message- Returns:
- a new EoulsanException
- Throws:
EoulsanException- in any case
-
newEoulsanException
public static EoulsanException newEoulsanException(ToolInfo toolInfo, String parameterName, String message) throws EoulsanException Create an EoulsanException.- Parameters:
toolInfo- toolInfo objectparameterName- parameter namemessage- error message- Returns:
- a new EoulsanException
- Throws:
EoulsanException- in any case
-
extractElementsByTagName
public static List<Element> extractElementsByTagName(Element parent, String tagName) throws EoulsanException Extract elements by tag name.- Parameters:
parent- the parenttagName- 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 parenttagName- the tag nameexpectedCount- 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 elementelementName- the element name- Returns:
- the list
-
extractOutputs
public static Map<String,ToolElement> extractOutputs(ToolInfo toolInfo, Document doc, Map<String, Parameter> stepParameters) throws EoulsanExceptionExtract all output parameters define in document.- Parameters:
toolInfo- the tool informationdoc- document represented tool xmlstepParameters- 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 EoulsanExceptionExtract all input parameters define in document.- Parameters:
toolInfo- the tool informationdoc- document represented tool xmlstepParameters- parameters for analysis- Returns:
- all input parameters
- Throws:
EoulsanException- if none input parameter found
-
extractCheetahScript
Extract command tag in string.- Parameters:
doc- document represented tool xml- Returns:
- command string
-
extractInterpreters
Extract interpreter attribute in string.- Parameters:
doc- document represented tool xml- Returns:
- interpreter names
-
extractDockerImage
Extract docker image attribute in string.- Parameters:
doc- document represented tool xml- Returns:
- the docker image name
-
extractDescription
Extract description tag in string.- Parameters:
doc- document represented tool xml- Returns:
- description
-
extractToolVersion
Extract tool version attribute in string.- Parameters:
doc- document represented tool xml- Returns:
- tool version string
-
extractToolName
Extract tool name tag in string.- Parameters:
doc- document represented tool xml- Returns:
- tool name string
-
extractToolID
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 xmlelementName- element name to extractindex- index of element name to extractattributeName- 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.
-