micone.validation package
Submodules
micone.validation.network_schema module
Module that defines the schema for interactions, pvalues, networks and their metadata
- class micone.validation.network_schema.ChildrenmapType(required=False, default=Undefined, serialized_name=None, choices=None, validators=None, deserialize_from=None, export_level=None, serialize_when_none=None, messages=None, metadata=None)[source]
Bases:
BaseType
DataType that describes the expected structure of the children map dictionary
- MESSAGES = {'choices': <schematics.translator.LazyText object>, 'required': <schematics.translator.LazyText object>}
- class micone.validation.network_schema.CorrelationmatrixType(*args, **kwargs)[source]
Bases:
InteractionmatrixType
DataType that describes the expected structure of a correlation matrix
- MESSAGES = {'choices': <schematics.translator.LazyText object>, 'required': <schematics.translator.LazyText object>}
- class micone.validation.network_schema.ElistType(required=False, default=Undefined, serialized_name=None, choices=None, validators=None, deserialize_from=None, export_level=None, serialize_when_none=None, messages=None, metadata=None)[source]
Bases:
BaseType
DataType that describes the expected structure of an edge list
- MESSAGES = {'choices': <schematics.translator.LazyText object>, 'required': <schematics.translator.LazyText object>}
- class micone.validation.network_schema.InteractionmatrixType(symm=False, *args, **kwargs)[source]
Bases:
BaseType
DataType that describes the expected structure of an interaction matrix
- Parameters:
symm (bool, optional) – True if interaction matrix is expected to be symmetric Default value is False
- MESSAGES = {'choices': <schematics.translator.LazyText object>, 'required': <schematics.translator.LazyText object>}
- class micone.validation.network_schema.LinkModel(raw_data=None, trusted_data=None, deserialize_mapping=None, init=True, partial=True, strict=True, validate=False, app_data=None, lazy=False, **kwargs)[source]
Bases:
Model
Model that describes the structure of one link in the network
- pvalue = <FloatType() instance on LinkModel as 'pvalue'>
- source = <StringType() instance on LinkModel as 'source'>
- target = <StringType() instance on LinkModel as 'target'>
- weight = <FloatType() instance on LinkModel as 'weight'>
- class micone.validation.network_schema.LinksModel(raw_data=None, trusted_data=None, deserialize_mapping=None, init=True, partial=True, strict=True, validate=False, app_data=None, lazy=False, **kwargs)[source]
Bases:
Model
Model that describes the structure of one link in the network
- links = <ListType(ModelType) instance on LinksModel as 'links'>
- class micone.validation.network_schema.MetadataModel(raw_data=None, trusted_data=None, deserialize_mapping=None, init=True, partial=True, strict=True, validate=False, app_data=None, lazy=False, **kwargs)[source]
Bases:
Model
Model that describes the expected structure of the network metadata input
- condition = <StringType() instance on MetadataModel as 'condition'>
- description = <StringType() instance on MetadataModel as 'description'>
- experimental_metadata = <DictType(StringType) instance on MetadataModel as 'experimental_metadata'>
- host = <StringType() instance on MetadataModel as 'host'>
- location = <StringType() instance on MetadataModel as 'location'>
- publication = <ModelType(PublicationModel) instance on MetadataModel as 'publication'>
- class micone.validation.network_schema.NetworkmetadataModel(raw_data=None, trusted_data=None, deserialize_mapping=None, init=True, partial=True, strict=True, validate=False, app_data=None, lazy=False, **kwargs)[source]
Bases:
MetadataModel
Model that describes the expected structure of the network metadata
- computational_metadata = <DictType(UnionType) instance on NetworkmetadataModel as 'computational_metadata'>
- condition = <StringType() instance on NetworkmetadataModel as 'condition'>
- description = <StringType() instance on NetworkmetadataModel as 'description'>
- directionality = <StringType() instance on NetworkmetadataModel as 'directionality'>
- experimental_metadata = <DictType(StringType) instance on NetworkmetadataModel as 'experimental_metadata'>
- host = <StringType() instance on NetworkmetadataModel as 'host'>
- interaction_type = <StringType() instance on NetworkmetadataModel as 'interaction_type'>
- location = <StringType() instance on NetworkmetadataModel as 'location'>
- publication = <ModelType(PublicationModel) instance on NetworkmetadataModel as 'publication'>
- class micone.validation.network_schema.NodeModel(raw_data=None, trusted_data=None, deserialize_mapping=None, init=True, partial=True, strict=True, validate=False, app_data=None, lazy=False, **kwargs)[source]
Bases:
Model
Model that describes the structure of one node in the network
- abundance = <FloatType() instance on NodeModel as 'abundance'>
- children = <ListType(StringType) instance on NodeModel as 'children'>
- id = <StringType() instance on NodeModel as 'id'>
- lineage = <StringType() instance on NodeModel as 'lineage'>
- name = <StringType() instance on NodeModel as 'name'>
- taxid = <IntType() instance on NodeModel as 'taxid'>
- taxlevel = <StringType() instance on NodeModel as 'taxlevel'>
- class micone.validation.network_schema.NodesModel(raw_data=None, trusted_data=None, deserialize_mapping=None, init=True, partial=True, strict=True, validate=False, app_data=None, lazy=False, **kwargs)[source]
Bases:
Model
Model that describes the structure of the nodes in the network
- nodes = <ListType(ModelType) instance on NodesModel as 'nodes'>
- class micone.validation.network_schema.PublicationModel(raw_data=None, trusted_data=None, deserialize_mapping=None, init=True, partial=True, strict=True, validate=False, app_data=None, lazy=False, **kwargs)[source]
Bases:
Model
Model that describes the expected structure of the publication input
- authors = <ListType(DictType) instance on PublicationModel as 'authors'>
- date = <DateType() instance on PublicationModel as 'date'>
- pubmed_id = <StringType() instance on PublicationModel as 'pubmed_id'>
- class micone.validation.network_schema.PvaluematrixType(symm=False, *args, **kwargs)[source]
Bases:
InteractionmatrixType
DataType that describes the expected structure of a pvalue matrix
- MESSAGES = {'choices': <schematics.translator.LazyText object>, 'required': <schematics.translator.LazyText object>}
micone.validation.otu_schema module
Module that defines the schema for a valid OTU table
- class micone.validation.otu_schema.BiomType(norm=False, *args, **kwargs)[source]
Bases:
BaseType
DataType that describes the expected structure and format for the biom.Table
- Parameters:
norm (bool, optional) – True if abundances are normalized Default value is False
- MESSAGES = {'choices': <schematics.translator.LazyText object>, 'required': <schematics.translator.LazyText object>}
- class micone.validation.otu_schema.DataType(norm, *args, **kwargs)[source]
Bases:
BaseType
” DataType that describes the expected structure and format for abundance values
- MESSAGES = {'choices': <schematics.translator.LazyText object>, 'required': <schematics.translator.LazyText object>}
- class micone.validation.otu_schema.HeaderType(required=False, default=Undefined, serialized_name=None, choices=None, validators=None, deserialize_from=None, export_level=None, serialize_when_none=None, messages=None, metadata=None)[source]
Bases:
BaseType
DataType that describes the expected structure and format for the sample headers
- MESSAGES = {'choices': <schematics.translator.LazyText object>, 'required': <schematics.translator.LazyText object>}
- class micone.validation.otu_schema.IndexType(required=False, default=Undefined, serialized_name=None, choices=None, validators=None, deserialize_from=None, export_level=None, serialize_when_none=None, messages=None, metadata=None)[source]
Bases:
BaseType
DataType that describes the expected structure and format for the OTU indices
- MESSAGES = {'choices': <schematics.translator.LazyText object>, 'required': <schematics.translator.LazyText object>}
- class micone.validation.otu_schema.ObsmetaType(required=False, default=Undefined, serialized_name=None, choices=None, validators=None, deserialize_from=None, export_level=None, serialize_when_none=None, messages=None, metadata=None)[source]
Bases:
BaseType
DataType that describes the expected structure and format for the observation metadata
- MESSAGES = {'choices': <schematics.translator.LazyText object>, 'required': <schematics.translator.LazyText object>}
- class micone.validation.otu_schema.SamplemetaType(required=False, default=Undefined, serialized_name=None, choices=None, validators=None, deserialize_from=None, export_level=None, serialize_when_none=None, messages=None, metadata=None)[source]
Bases:
BaseType
DataType that describes the expected structure and format for the sample metadata
- MESSAGES = {'choices': <schematics.translator.LazyText object>, 'required': <schematics.translator.LazyText object>}
micone.validation.otu_validator module
Module that deals with the validation of an OTU table
- class micone.validation.otu_validator.OtuValidator(dtype: str, ext: Optional[str] = None)[source]
Bases:
object
Validates input OTU table file and returns the Otu instance of the file
- Parameters:
dtype ({'biom', 'tsv'}) – The type of OtuValidator instance to be created
ext (str, optional) – The extension of the file if other than supported extensions Supported extensions: ‘tsv’ dtype: ‘tsv’, ‘txt’, ‘counts’ ‘biom’ dtype: ‘biom’, ‘hdf5’
- configuration
Dictionary showing the current configuration of the instance
- Type:
Dict[str, Any]
- Raises:
ValidationError – If any of the files do not conform to the schema outlines in otu_schema
Notes
We assume that the extension dictates the filetype
- property configuration: Dict[str, Union[str, List[str]]]
Dictionary showing the current configuration of the instance
- Return type:
Dict[str, Union[str, List[str]]]
- load_validate(otu_file: Path, meta_file: Optional[Path] = None, tax_file: Optional[Path] = None) Table [source]
Load the data and validate
- Parameters:
otu_file (pathlib.Path) – The path to the OTU counts table
meta_file (pathlib.Path, optional) – The path to the sample metadata file This argument is required if dtype is ‘tsv’
tax_file (pathlib.Path, optional) – The path to the taxonomy file This argument is required if dtype is ‘tsv’
- Returns:
biom.Table containing all the data
- Return type:
Table