use of com.genericworkflownodes.knime.parameter.FileParameter in project GenericKnimeNodes by genericworkflownodes.
the class CTDConfigurationReaderTest method testReadTMTAnalyzer.
@Test
public void testReadTMTAnalyzer() throws Exception {
CTDConfigurationReader reader = new CTDConfigurationReader();
assertNotNull(reader);
INodeConfiguration config = reader.read(TestDataSource.class.getResourceAsStream("TMTAnalyzer.ctd"));
assertEquals("Quantitation", config.getCategory());
assertEquals("1.11.0", config.getVersion());
assertNotNull(config.getParameter("TMTAnalyzer.1.in"));
assertTrue(config.getParameter("TMTAnalyzer.1.in") instanceof FileParameter);
assertTrue(config.getParameter("TMTAnalyzer.1.algorithm.Extraction.channel_active") instanceof StringListParameter);
StringListParameter slp = (StringListParameter) config.getParameter("TMTAnalyzer.1.algorithm.Extraction.channel_active");
assertEquals(2, slp.getValue().size());
assertEquals("126:liver", slp.getValue().get(0));
assertEquals("131:lung", slp.getValue().get(1));
assertTrue(config.getParameter("TMTAnalyzer.1.algorithm.Quantification.isotope_correction.tmt-6plex").isAdvanced());
assertTrue(config.getParameter("TMTAnalyzer.1.algorithm.Quantification.isotope_correction.tmt-6plex").isOptional());
assertFalse(config.getParameter("TMTAnalyzer.1.in").isAdvanced());
assertFalse(config.getParameter("TMTAnalyzer.1.in").isOptional());
}
use of com.genericworkflownodes.knime.parameter.FileParameter in project GenericKnimeNodes by genericworkflownodes.
the class CTDConfigurationReaderTest method testGKNIgnoreTag.
@Test
public void testGKNIgnoreTag() throws Exception {
CTDConfigurationReader reader = new CTDConfigurationReader();
assertNotNull(reader);
INodeConfiguration config = reader.read(TestDataSource.class.getResourceAsStream("test_app.ctd"));
assertEquals("SeqAn/Testing", config.getCategory());
assertEquals("http://www.seqan.de", config.getDocUrl());
FileParameter fp = (FileParameter) config.getParameter("test_app.out");
assertNotNull(fp);
assertEquals("set an output file", fp.getDescription());
// the parameter following parameters were tagged with gkn-ignore and
// hence should not be parsed
assertNull(config.getParameter("test_app.write-ctd-file-ext"));
assertNull(config.getParameter("test_app.in-file-ext"));
assertNull(config.getParameter("test_app.out-file-ext"));
}
use of com.genericworkflownodes.knime.parameter.FileParameter in project GenericKnimeNodes by genericworkflownodes.
the class CTDConfigurationReaderTest method testReadFileFilter.
@Test
public void testReadFileFilter() throws Exception {
CTDConfigurationReader reader = new CTDConfigurationReader();
assertNotNull(reader);
INodeConfiguration config = reader.read(TestDataSource.class.getResourceAsStream("FileFilter.ctd"));
assertEquals("File Handling", config.getCategory());
assertNotNull(config.getParameter("FileFilter.1.in"));
assertTrue(config.getParameter("FileFilter.1.in") instanceof FileParameter);
assertNotNull(config.getInputPortByName("FileFilter.1.in"));
assertEquals("1.11.0", config.getVersion());
FileParameter fp = (FileParameter) config.getParameter("FileFilter.1.in");
assertEquals("temp", fp.getValue());
// get list restrictions
assertNotNull(config.getParameter("FileFilter.1.peak_options.level"));
assertTrue(config.getParameter("FileFilter.1.peak_options.level") instanceof IntegerListParameter);
IntegerListParameter ilp = (IntegerListParameter) config.getParameter("FileFilter.1.peak_options.level");
assertEquals(Integer.valueOf(1), ilp.getLowerBound());
}
use of com.genericworkflownodes.knime.parameter.FileParameter in project GenericKnimeNodes by genericworkflownodes.
the class ParamHandler method createPort.
/**
* Convert the current element into a Port and the respective
* IFileParameter.
*
* @param paramName
* The name of the Parameter.
* @param attributes
* Attributes of the Parameter.
*/
private void createPort(String paramName, Attributes attributes, boolean isList) {
// check if we want to create this port
if (BLACKLIST.contains(paramName)) {
LOG.setLevel(Level.ALL);
LOG.info("Ignoring port: " + paramName);
return;
}
Port p = new Port();
p.setName(m_currentPath + paramName);
p.setMultiFile(isList);
p.setOptional(isOptional(attributes));
p.setActive(true);
List<String> mimetypes = extractMIMETypes(attributes);
for (String mt : mimetypes) {
p.addMimeType(mt);
}
String attr_type = attributes.getValue(ATTR_TYPE);
boolean isInputPort = TYPE_INPUT_FILE.equals(attr_type) || getTags(attributes).contains(INPUTFILE_TAG) || TYPE_INPUT_PREFIX.equals(attr_type);
// to save/load settings.
if (p.isOptional() && !isInputPort) {
p.addMimeType("Inactive");
}
String description = attributes.getValue(ATTR_DESCRIPTION);
p.setDescription(description);
m_currentParameter = null;
// create port parameter
if (isList) {
m_currentParameter = new FileListParameter(paramName, new ArrayList<String>());
((FileListParameter) m_currentParameter).setPort(p);
((FileListParameter) m_currentParameter).setDescription(p.getDescription());
((FileListParameter) m_currentParameter).setIsOptional(p.isOptional());
// Values will be filled at the end of the ITEMLIST tag.
} else {
m_currentParameter = new FileParameter(paramName, "");
((FileParameter) m_currentParameter).setPort(p);
((FileParameter) m_currentParameter).setDescription(p.getDescription());
((FileParameter) m_currentParameter).setIsOptional(p.isOptional());
// Fills parameter with default value
((FileParameter) m_currentParameter).setValue(attributes.getValue(ATTR_VALUE));
}
p.setIsPrefix(TYPE_OUTPUT_PREFIX.equals(attr_type) || TYPE_INPUT_PREFIX.equals(attr_type));
if (isInputPort) {
m_inputPorts.add(p);
} else {
m_outputPorts.add(p);
}
}
use of com.genericworkflownodes.knime.parameter.FileParameter in project GenericKnimeNodes by genericworkflownodes.
the class CLICommandGenerator method handleNonListParameter.
private void handleNonListParameter(final List<List<? extends CommandLineElement>> extractedParameterValues, final Parameter<?> p) {
final List<CommandLineElement> l = new ArrayList<CommandLineElement>();
final CommandLineElement commandLineElement;
if (p instanceof FileParameter) {
commandLineElement = new CommandLineFile((FileParameter) p);
} else {
commandLineElement = new CommandLineParameter(p);
}
l.add(commandLineElement);
extractedParameterValues.add(l);
}
Aggregations