LoomValidator (class)¶
Validate the content of a Loom file against the file format specification and/or attrubute conventions.
>>> lv = loompy.LoomValidator()
>>> if not lv.validate(d+f, strictness="conventions"):
>>> for warn in lv.warnings:
>>> print("WARNING:", warn)
>>> for err in lv.errors:
>>> print("ERROR:", err)
WARNING: Optional global attribute 'Description' is missing
WARNING: Optional global attribute 'Journal' is missing
WARNING: Optional global attribute 'Authors' is missing
WARNING: Optional global attribute 'Title' is missing
WARNING: Optional global attribute 'Year' is missing
WARNING: Optional column attribute 'ClusterName' is missing
WARNING: Optional column attribute 'Valid' is missing
WARNING: Optional row attribute 'Valid' is missing
WARNING: Optional row attribute 'Selected' is missing
ERROR: Column attribute 'ClusterID' is missing
ERROR: Column attribute 'CellID' cannot contain duplicate values
ERROR: For help, see http://linnarssonlab.org/loompy/conventions/
-
class
loompy.
LoomValidator
(version: str = None)[source]¶ -
__init__
(version: str = None) → None[source]¶ - Parameters
version – The Loom file format version to validate against (“3.0.0”, “2.0.1”, “old”), or None to infer from file
- Remarks:
“old” version will accept files that lack the “row_graphs” and “col_graphs” groups
-
version
= None¶ Version of the spec to validate against
-
errors
= None¶ Errors found during validation
-
warnings
= None¶ Warnings triggered during validation
-
summary
= None¶ Summary of the file structure
-
validate
(path: str, strictness: str = 'speconly') → bool[source]¶ Validate a file for conformance to the Loom specification
- Parameters
path – Full path to the file to be validated
strictness – “speconly” or “conventions”
- Remarks:
In “speconly” mode, conformance is assessed relative to the file format specification at http://linnarssonlab.org/loompy/format/. In “conventions” mode, conformance is additionally assessed relative to attribute name and data type conventions given at http://linnarssonlab.org/loompy/conventions/.
-
validate_conventions
(ds: loompy.loompy.LoomConnection) → bool[source]¶ Validate the LoomConnection object against the attribute name/dtype conventions.
- Parameters
ds – LoomConnection object
- Returns
True if the file conforms to the conventions, else False
- Remarks:
Upon return, the instance attributes ‘self.errors’ and ‘self.warnings’ contain lists of errors and warnings.
-
validate_spec
(file: h5py._hl.files.File) → bool[source]¶ Validate the LoomConnection object against the format specification.
- Parameters
file – h5py File object
- Returns
True if the file conforms to the specs, else False
- Remarks:
Upon return, the instance attributes ‘self.errors’ and ‘self.warnings’ contain lists of errors and warnings, and the ‘self.summary’ attribute contains a summary of the file contents.
-