Skip to content

common

Common CLI options for protein-quest.

BatchSize = PositiveInt module-attribute

Type for batch size parameters (positive integers > 0).

ConfidenceThreshold = NonNegativeFloat module-attribute

Type for confidence threshold parameters (non-negative floats >= 0).

InputDir = Annotated[Path, Parameter(validator=(validators.Path(exists=True, file_okay=False))), INPUT_DIR] module-attribute

Type for input directory parameters (directory paths).

InputFile = Annotated[StdioPath, Parameter(validator=(StdioPathValidator(exists=True, dir_okay=False))), INPUT_FILE] module-attribute

Type for input file parameters (file paths that can also be "-" for stdin).

Limit = PositiveInt module-attribute

Type for limit parameters (positive integers > 0).

MaxResidues = PositiveInt module-attribute

Type for maximum residue parameters (positive integers > 0).

MaxSequenceLength = PositiveInt module-attribute

Type for maximum sequence length parameters (positive integers > 0).

MinResidues = PositiveInt module-attribute

Type for minimum residue parameters (positive integers > 0).

MinSequenceLength = PositiveInt module-attribute

Type for minimum sequence length parameters (positive integers > 0).

OutputDir = Annotated[Path, Parameter(validator=(validators.Path(file_okay=False))), OUTPUT_DIR] module-attribute

Type for output directory parameters (directory paths).

OutputFile = Annotated[StdioPath, Parameter(validator=(StdioPathValidator(dir_okay=False))), OUTPUT_FILE] module-attribute

Type for output file parameters (file paths that can also be "-" for stdout).

Timeout = PositiveInt module-attribute

Type for timeout parameters (positive integers > 0).

CacheParameter dataclass

Cache-related CLI options.

Parameters:

Name Type Description Default
no_cache Annotated[bool, Parameter(negative='')]

Disable caching of files to central location.

False
cache_dir Path

Directory to use as cache for files.

user_cache_root_dir()
copy_method Literal['copy', 'symlink', 'hardlink']

How to make target file be same file as source file. By default uses hardlinks to save disk space. Note that hardlinks only work within the same filesystem and are harder to track. If you want to track cached files easily then use 'symlink'. On Windows you need developer mode or admin privileges to create symlinks.

'hardlink'

Common dataclass

Common CLI options shared across all commands.

Parameters:

Name Type Description Default
verbose Annotated[int, Parameter(name=(-v, --verbose), count=True)]

Increase verbosity (use multiple times for more detail).

0
quiet Annotated[int, Parameter(name=(-q, --quiet), count=True)]

Decrease verbosity (use multiple times for less output).

0
prov Annotated[bool, Parameter(negative=''), RECORD_TRIGGER]

Whether to write provenance information about the command execution to ro-crate-metadata.json file.

False

__post_init__()

Automatically configure logging when Common instance is created.

StdioPathValidator

Bases: Path

Custom Path validator that allows "-" for stdin/stdout.

This validator checks if the path is "-", and if so, it bypasses Path validation.

If given '-', it also checks if a file named '-' already exists, which would conflict with stdin/stdout usage.

setup_logging(verbose, quiet)

Configure root logging and console quiet mode

Parameters:

Name Type Description Default
verbose int

Verbosity level

required
quiet int

Quietness level.

required

Raises:

Type Description
ValueError

If both verbose and quiet are used together.

to_cacher(cache_params)

Initialize cacher based on parameters.

Parameters:

Name Type Description Default
cache_params CacheParameter | None

Cache parameters from CLI.

required

Returns:

Type Description
Cacher

Initialized cacher instance.

write_lines(file, lines)

Write lines to a file

If file is "-", writes to stdout.

Creates parent directories if they do not exist.

Parameters:

Name Type Description Default
file StdioPath

Path to output file.

required
lines Iterable[str]

Iterable of lines to write.

required