kb_python.validate
¶
Module Contents¶
Functions¶
|
Verify if the provided BUS file is valid. |
|
Verify if the provided Matrix Market (.mtx) file is valid. |
|
Validate a file. |
|
Function decorator to validate input/output files. |
Attributes¶
- kb_python.validate.BUSTOOLS_INSPECT_PARSER¶
- exception kb_python.validate.ValidateError¶
Bases:
Exception
Common base class for all non-exit exceptions.
- kb_python.validate.validate_bus(path: str)¶
Verify if the provided BUS file is valid.
A BUS file is considered valid when bustools inspect can read the file + it has > 0 BUS records.
- Parameters
path – Path to BUS file
- Raises
ValidateError – If the file failed verification
subprocess.CalledProcessError – If the bustools command failed
- kb_python.validate.validate_mtx(path: str)¶
Verify if the provided Matrix Market (.mtx) file is valid.
A BUS file is considered valid when the file can be read with scipy.io.mmread.
- Parameters
path – Path to mtx file
- Raises
ValidateError – If the file failed verification
- kb_python.validate.VALIDATORS¶
- kb_python.validate.validate(path: str)¶
Validate a file.
This function is a wrapper around all validation functions. Given a path, it chooses the correct validation function. This function assumes the file exists.
- Parameters
path – Path to file
- Raises
ValidateError – If the file failed verification
- kb_python.validate.validate_files(pre: bool = True, post: bool = True) Callable ¶
Function decorator to validate input/output files.
This function does not validate when the current run is a dry run. The decorated function is expected to return a dictionary of paths as values.
- Parameters
pre – Whether to validate input files, defaults to True
post – Whether to validate output files, defaults to True
- Returns
Wrapped function