Attributes
Attribute
s serve as "parameters" and are a way of providing validation and type-checking for values that are passed around within WebMEV. The different types represent different simple entities within WebMEV. For example, we have simple wrappers around primitives like integers which enforce constraints on the underlying primitive type (e.g. for a probability, we can use a BoundedFloatAttribute
set with bounds of [0,1]). Other types can represent and validate files ("data resources")
Attribute
s are used to provide metadata (e.g. a phenotype of a sample given as a StringAttribute
) or are used as parameters to analyses (e.g. a BoundedFloatAttribute
for filtering p-values less than a particular value)
data_structures.base_attribute.BaseAttributeType
(val, **kwargs)This is a base class for all the types of attributes we might implement. It contains common operations/logic.
data_structures.attribute_types.BoundedBaseAttribute
(value, **kwargs)This class derives from BaseAttributeType
and adds
logic for numeric attributes that are bounded between
specified values.
In addition to the typename
and value
members, these
require a min
and a max
to set the bounds.
Classes deriving from this can be used for things like bounding a p-value from a hypothesis test (which is 0<=p<=1)
data_structures.attribute_types.IntegerAttribute
(val, **kwargs)General, unbounded integers. Represented by
{
"attribute_type": "Integer",
"value": <integer>
}
data_structures.attribute_types.PositiveIntegerAttribute
(val, **kwargs)Integers > 0
{
"attribute_type": "PositiveInteger",
"value": <integer>
}
data_structures.attribute_types.NonnegativeIntegerAttribute
(val, **kwargs)Integers >=0
{
"attribute_type": "NonNegativeInteger",
"value": <integer>
}
data_structures.attribute_types.BoundedIntegerAttribute
(value, **kwargs)Integers that are bounded between a min and max value.
{
"attribute_type": "BoundedInteger",
"value": <integer>,
"min": <integer lower bound>,
"max": <integer upper bound>
}
data_structures.attribute_types.FloatAttribute
(val, **kwargs)General, unbounded float type
{
"attribute_type": "Float",
"value": <float>
}
Note that positive/negative infinite values are acceptable provided they are specified using constants.POSITIVE_INF_MARKER constants.NEGATIVE_INF_MARKER
data_structures.attribute_types.PositiveFloatAttribute
(val, **kwargs)Positive (>0) float type
{
"attribute_type": "PositiveFloat",
"value": <float>
}
Note that positive infinite values are acceptable provided they are specified using constants.POSITIVE_INF_MARKER
data_structures.attribute_types.NonnegativeFloatAttribute
(val, **kwargs)Non-negative (>=0) float type
{
"attribute_type": "NonNegativeFloat",
"value": <float>
}
Note that positive infinite values are acceptable provided they are specified using constants.POSITIVE_INF_MARKER
data_structures.attribute_types.BoundedFloatAttribute
(value, **kwargs)Floats that are bounded between a min and max value.
{
"attribute_type": "BoundedFloat",
"value": <float>,
"min": <integer/float lower bound>,
"max": <integer/float upper bound>
}
data_structures.attribute_types.StringAttribute
(val, **kwargs)String type that has basic guards against non-typical characters.
{
"attribute_type": "String",
"value": <str>
}
data_structures.attribute_types.OptionStringAttribute
(value, **kwargs)A String type that only admits one from a set of preset options (e.g. like a dropdown)
{
"attribute_type": "OptionString",
"value": <str>,
"options": [<str>, <str>,...,<str>]
}
data_structures.attribute_types.BooleanAttribute
(val, **kwargs)Basic boolean
{
"attribute_type": "Boolean",
"value": <bool>
}
data_structures.data_resource_attributes.DataResourceAttribute
(value, **kwargs)This class holds info that represents one or more resources of a fixed type.
If the input can be one of multiple types, use one of the other classes.
The serialized representation looks like:
{
"attribute_type": "DataResource",
"value": <one or more Resource UUIDs>,
"many": <bool>,
"resource_type": <str>
}
resource_type
dictates the allowable type of resource
(e.g. integer matrix only). It's value is matched against a controlled
set of strings.
data_structures.data_resource_attributes.OperationDataResourceAttribute
(value, **kwargs)Used to specify a reference to one or more Resource instances which are user-independent, such as database-like resources which are used for analyses.
Structure
{
"attribute_type": "OperationDataResource",
"value": <one or more Resource UUIDs>,
"many": <bool>,
"resource_type": <str>,
}
Note that "many" controls whether >1 are allowed. It's not an indicator for whether there are multiple Resources specified in the "value" key.