def from_id_dict(d): """ Create an instance from a id dict of options (pbsmrtpipe.options.x:value} """ from pbsmrtpipe.pb_io import REGISTERED_WORKFLOW_OPTIONS import pbsmrtpipe.schema_opt_utils as OP adict = {} for opt_id, schema in REGISTERED_WORKFLOW_OPTIONS.iteritems(): if opt_id in d: v = d[opt_id] OP.validate_value(schema, {opt_id: v}) adict[opt_id] = v else: value = OP.get_default_from_schema(schema) d[opt_id] = value # build map to instance var names adict = { k: d[v] for k, v in WorkflowLevelOptions.ATTR_TO_ID.iteritems() } return WorkflowLevelOptions(**adict)
def from_id_dict(d): """ Create an instance from a id dict of options (pbsmrtpipe.options.x:value} """ adict = {} for opt_id, schema in REGISTERED_WORKFLOW_OPTIONS.iteritems(): if opt_id in d: v = d[opt_id] OP.validate_value(schema, {opt_id: v}) adict[opt_id] = v else: value = OP.get_default_from_schema(schema) d[opt_id] = value # build map to instance var names adict = {k: d[v] for k, v in WorkflowLevelOptions.ATTR_TO_ID.iteritems()} return WorkflowLevelOptions(**adict)