Package list ctdconverter / 0e37031
[FIX] fixes another variation of setting param_node.attrib["format"] works now with combination of formats from supportedfileformats.txt and other walzer 4 years ago
1 changed file(s) with 13 addition(s) and 4 deletion(s). Raw diff Collapse all Expand all
10031003 if param.restrictions is not None:
10041004 # join all formats of the file, take mapping from supported_file if available for an entry
10051005 if type(param.restrictions) is _FileFormat:
1006 param_format = ','.join([get_supported_file_types(i, supported_file_formats) if
1007 get_supported_file_types(i, supported_file_formats)
1006 param_format = ','.join([get_supported_file_type(i, supported_file_formats) if
1007 get_supported_file_type(i, supported_file_formats)
10081008 else i for i in param.restrictions.formats])
10091009 else:
10101010 raise InvalidModelException("Expected 'file type' restrictions for input file [%(name)s], "
10471047 if param.restrictions.n_max is not None:
10481048 param_node.attrib["max"] = str(param.restrictions.n_max)
10491049 elif type(param.restrictions) is _FileFormat:
1050 param_node.attrib["format"] = ",".join(
1051 get_supported_file_types(param.restrictions.formats, supported_file_formats))
1050 param_node.attrib["format"] = ','.join([get_supported_file_type(i, supported_file_formats) if
1051 get_supported_file_type(i, supported_file_formats)
1052 else i for i in param.restrictions.formats])
10521053 else:
10531054 raise InvalidModelException("Unrecognized restriction type [%(type)s] for parameter [%(name)s]"
10541055 % {"type": type(param.restrictions), "name": param.name})
13141315 return data_node
13151316
13161317
1318 # Get the supported file format for one given format
1319 def get_supported_file_type(format_name, supported_file_formats):
1320 if format_name in supported_file_formats.keys():
1321 return supported_file_formats.get(format_name, DataType(format_name, format_name)).galaxy_extension
1322 else:
1323 return None
1324
1325
13171326 def get_supported_file_types(formats, supported_file_formats):
13181327 return set([supported_file_formats.get(format_name, DataType(format_name, format_name)).galaxy_extension
13191328 for format_name in formats if format_name in supported_file_formats.keys()])