Reference

Constants

barcode_pattern

str(object='') -> str str(bytes_or_buffer[, encoding[, errors]]) -> str

genome_metadata_names

Built-in immutable sequence.

lane_pattern

str(object='') -> str str(bytes_or_buffer[, encoding[, errors]]) -> str

metadata_denylist

Built-in immutable sequence.

metrics_cols

Built-in immutable sequence.

update_message

str(object='') -> str str(bytes_or_buffer[, encoding[, errors]]) -> str

Math and statistics

euclidean

Compute the Euclidean distance between two vectors.

fold_change_to_log_ratio

Convert fold change to log ratio.

geometric_mean

Compute the geometric mean.

headtail

Return (and print) the first and last n elements / rows.

intersect_all

Return the intersection of multiple sequences.

intersection_matrix

Build a Boolean intersection matrix.

log_ratio_to_fold_change

Convert log ratio to fold change.

ranked_matrix

Rank values within each column, with ties averaged.

sem

Compute the standard error of the mean.

zscore

Compute Z-scores (column-wise for matrices).

Data manipulation

dupes

Return duplicated elements.

keep_only_atomic_cols

Keep only columns that contain scalar (atomic) values.

match_all

Return indices of all matches of x in table.

match_nested

Recursively search for x in a nested dict/list structure.

not_dupes

Return elements that appear exactly once.

String utilities

str_extract

Extract first match of pattern from string.

str_extract_all

Return all matches of pattern in string.

str_match

Return the first regex match object of pattern in string.

str_match_all

Return all regex match objects for pattern in string.

str_pad

Pad a string to a minimum width.

str_remove_empty

Remove empty strings and None values from a list.

str_replace_na

Replace None values with a placeholder string.

str_split

Split string by a regex pattern.

print_string

Coerce an object to a human-friendly print string.

truncate_string

Truncate string to n characters, appending '...' if needed.

File and path utilities

basename_sans_ext

Return the file basename without extension(s).

compress

Compress a file.

decompress

Decompress a file.

file_depth

Return the directory depth of path.

file_ext

Return the file extension(s) including compression suffix.

init_dir

Create a directory (and parents) if it does not exist.

parent_dir

Return the n-th parent directory of path.

parent_directory

Return the n-th parent directory of path.

realpath

Resolve path to an absolute real path.

tempdir2

Create a unique temporary directory.

unlink2

Delete a file or directory tree.

Path string manipulation

add_to_path_end

Append new_path to the end of a path string (if not present).

add_to_path_start

Prepend new_path to the start of a path string (if not present).

collapse_to_path_string

Join paths into a single colon-separated string.

remove_from_path

Remove target from a path string.

split_path_string

Split a colon-separated path string.

unique_path_string

Remove duplicate entries from a path string.

System utilities

cpus

Return available CPU count, capped at n if requested.

git_current_branch

Return the name of the current Git branch.

git_default_branch

Return the default branch name of the Git repository.

quietly

Suppress console output and warnings within a block.

ram

Return total system RAM in gibibytes (GiB).

random_string

Generate a random alphanumeric string of length n.

shell

Run a shell command.

Version utilities

major_minor_version

Return major.minor from a version string.

major_version

Return the major component of a version string.

minor_version

Return major.minor from a version string.

sanitize_version

Normalise a version string using PEP 440.

Download and URL

download

Download a file from url.

paste_url

Join URL parts with /.

Display and cache helpers

show_header

Return a formatted header line.

show_slot_info

Return a formatted summary of an object's attributes.

simple_class

Return the simple class name (without module path).

pkg_cache_dir

Return (and create) a package-specific cache directory.