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.FileVerificationFailed¶
Bases:
Exception
Common base class for all non-exit exceptions.
- kb_python.validate.validate_bus(path)¶
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 (str) – path to BUS file
- Raises
FileVerificationFailed – if the file failed verification
subprocess.CalledProcessError – if the bustools command failed
- kb_python.validate.validate_mtx(path)¶
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 (str) – path to mtx file
- Raises
FileVerificationFailed – if the file failed verification
- kb_python.validate.VALIDATORS¶
- kb_python.validate.validate(path)¶
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 (str) – path to file
- Raises
FileVerificationFailed – if the file failed verification
- kb_python.validate.validate_files(pre=True, post=True)¶
Function decorator to validate input/output files.
This function does not validate when the current run is a dry run.
- Parameters
pre (bool) – whether to validate input files, defaults to True
post (bool) – whether to validate output files, defaults to True
- Returns
wrapped function
- Return type
function