varona.utils.misc

Miscellaneous utility functions.

multi_suffix_stem(file_path: Path) str[source]

For paths like /path/to/file.vcf.gz, return file.

The pathlib.Path.stem attribute is annoying that it only has the last suffix. This function removes all suffixes.

This function is a bit aggressive, removing everything after the first “.”. Be mindful of this when formulating the file naming strategy.

Examples:

>>> from pathlib import Path
>>> multi_suffix_stem(Path("file.txt"))
'file'
>>> multi_suffix_stem(Path("file.vcf.gz"))
'file'
Parameters:

file_path – The file path.

Returns:

The stem with the multi suffix removed.