Skip to content

parse_args

Parse the command line arguments.

:param subparser: the subparser object. :type subparser: argparse.ArgumentParser :param script_desc: the description of the script. :type script_desc: str :param common_args: the common arguments. :type common_args: argparse.ArgumentParser :return: the parser. :rtype: argparse.ArgumentParser

Source code in callingcardstools/PeakCalling/yeast/call_peaks.py
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
def parse_args(
    subparser: argparse.ArgumentParser,
    script_desc: str,
    common_args: argparse.ArgumentParser,
) -> argparse.ArgumentParser:
    """
    Parse the command line arguments.

    :param subparser: the subparser object.
    :type subparser: argparse.ArgumentParser
    :param script_desc: the description of the script.
    :type script_desc: str
    :param common_args: the common arguments.
    :type common_args: argparse.ArgumentParser
    :return: the parser.
    :rtype: argparse.ArgumentParser
    """

    parser = subparser.add_parser(
        "yeast_call_peaks",
        help=script_desc,
        prog="yeast_call_peaks",
        parents=[common_args],
    )

    parser.set_defaults(func=main)

    parser.add_argument(
        "--experiment_data_paths",
        type=str,
        nargs="+",
        help="paths to the experiment data files.",
        required=True,
    )
    parser.add_argument(
        "--experiment_orig_chr_convention",
        type=str,
        help="the chromosome naming convention used in the experiment data " "file.",
        required=True,
    )
    parser.add_argument(
        "--promoter_data_path",
        type=str,
        help="path to the promoter data file.",
        required=True,
    )
    parser.add_argument(
        "--promoter_orig_chr_convention",
        type=str,
        help="the chromosome naming convention used in the promoter data " "file.",
        required=True,
    )
    parser.add_argument(
        "--background_data_path",
        type=str,
        help="path to the background data file.",
        required=True,
    )
    parser.add_argument(
        "--background_orig_chr_convention",
        type=str,
        help="the chromosome naming convention used in the background data " "file.",
        required=True,
    )
    parser.add_argument(
        "--chrmap_data_path",
        type=str,
        help="path to the chromosome map file. this must include the data "
        "files' current naming conventions, the desired naming, and a column "
        "`type` that indicates whether the chromosome is 'genomic' or "
        "something else, eg 'mitochondrial' or 'plasmid'.",
        required=True,
    )
    parser.add_argument(
        "--unified_chr_convention",
        type=str,
        help="the chromosome naming convention to use in the output " "DataFrame.",
        required=False,
        default="ucsc",
    )
    parser.add_argument(
        "--deduplicate_experiment",
        action="store_true",
        help="set this flag to deduplicate the experiment data based on `chr`, "
        "`start` and `end` such that if an insertion is found at the same "
        "coordinate on different strands, only one of those records will be "
        "retained.",
    )
    parser.add_argument(
        "--genomic_only",
        action="store_true",
        help="set this flag to include only genomic chromosomes in the "
        "experiment and background.",
    )
    parser.add_argument(
        "--output_path",
        default="sig_results.csv",
        type=str,
        help="path to the output file.",
    )
    parser.add_argument(
        "--pseudocount",
        type=float,
        help="pseudocount to use when calculating poisson pvalue. Note that "
        "this is used only when the background hops are 0 for a given promoter.",
        required=False,
        default=0.1,
    )
    parser.add_argument(
        "--compress_output",
        action="store_true",
        help="set this flag to gzip the output csv file.",
    )

    return subparser