util module¶
-
mavis.util.
bash_expands
(expression)[source]¶ expand a file glob expression, allowing bash-style brackets.
Returns: a list of files Return type: list Example
>>> bash_expands('./{test,doc}/*py') [...]
-
mavis.util.
cast
(value, cast_func)[source]¶ cast a value to a given type
Example
>>> cast('1', int) 1
-
mavis.util.
filter_on_overlap
(bpps, regions_by_reference_name)[source]¶ filter a set of breakpoint pairs based on overlap with a set of genomic regions
Parameters: - bpps (
list
ofBreakpointPair
) – list of breakpoint pairs to be filtered - regions_by_reference_name (
dict
oflist
ofBioInterval
bystr
) – regions to filter against
- bpps (
-
mavis.util.
generate_complete_stamp
(output_dir, log=<function devnull>, prefix='MAVIS.', start_time=None)[source]¶ writes a complete stamp, optionally including the run time if start_time is given
Parameters: Returns: path to the complete stamp
Return type: Example
>>> generate_complete_stamp('some_output_dir') 'some_output_dir/MAVIS.COMPLETE'
-
mavis.util.
get_env_variable
(arg, default, cast_type=None)[source]¶ Parameters: arg (str) – the argument/variable name Returns: the setting from the environment variable if given, otherwise the default value
-
mavis.util.
log_arguments
(args)[source]¶ output the arguments to the console
Parameters: args (Namespace) – the namespace to print arguments for
-
mavis.util.
mkdirp
(dirname)[source]¶ Make a directory or path of directories. Suppresses the error that is normally raised when the directory already exists
-
mavis.util.
read_bpp_from_input_file
(filename, expand_orient=False, expand_strand=False, expand_svtype=False, **kwargs)[source]¶ reads a file using the tab module. Each row is converted to a breakpoint pair and other column data is stored in the data attribute
Parameters: Returns: a list of pairs
Return type: Example
>>> read_bpp_from_input_file('filename') [BreakpointPair(), BreakpointPair(), ...]
One can also validate other expected columns that will go in the data attribute using the usual arguments to the tab.read_file function
>>> read_bpp_from_input_file('filename', cast={'index': int}) [BreakpointPair(), BreakpointPair(), ...]