Source code for modalysis.cli.parsers.pileup

"""CLI parser registration for pileup command group."""

import argparse

from modalysis.cli.handlers.pileup import handle_pileup_format, handle_pileup_merge
from modalysis.constants import DEFAULT_PORT


[docs] def register_pileup_parser( subparsers: argparse._SubParsersAction, ) -> None: """Register `pileup` subcommands and arguments.""" pileup_parser = subparsers.add_parser("pileup", help="Pileup commands") pileup_subparsers = pileup_parser.add_subparsers(dest="pileup_command") pileup_format_parser = pileup_subparsers.add_parser( "format", help="Format a pileup file" ) pileup_format_parser.add_argument( "--input-path", required=True, help="Path to the input pileup file" ) pileup_format_parser.add_argument( "--output-path", required=True, help="Path to the output directory" ) pileup_format_parser.add_argument( "--output-name", required=True, help="Name for the output file" ) pileup_format_parser.add_argument( "--allowed-chromosomes", required=True, help="Path to a file with one valid chromosome name per line", ) pileup_format_parser.add_argument( "--port", type=int, default=DEFAULT_PORT, help=f"Port the server is running on (default: {DEFAULT_PORT})", ) pileup_format_parser.set_defaults(func=handle_pileup_format) pileup_merge_parser = pileup_subparsers.add_parser( "merge", help="Merge formatted pileup files" ) pileup_merge_parser.add_argument( "--pileup-paths", nargs="+", required=True, help="Paths to the formatted pileup files to merge", ) pileup_merge_parser.add_argument( "--output-path", required=True, help="Path to the output directory" ) pileup_merge_parser.add_argument( "--output-name", required=True, help="Name for the output file" ) pileup_merge_parser.add_argument( "--min-files", type=int, default=2, help="Minimum number of files a key must appear in (default: 2)", ) pileup_merge_parser.add_argument( "--min-file-coverage", type=float, default=50.0, help="Minimum percentage of files a key must appear in (default: 50.0)", ) pileup_merge_parser.add_argument( "--min-reads", type=int, default=5, help="Minimum accumulated N_VALID_COV to include a row (default: 5)", ) pileup_merge_parser.add_argument( "--port", type=int, default=DEFAULT_PORT, help=f"Port the server is running on (default: {DEFAULT_PORT})", ) pileup_merge_parser.set_defaults(func=handle_pileup_merge)