Skip to content

Argparse

Ariel Balter edited this page Jan 4, 2017 · 4 revisions
if __name__ == "__main__":
    import argparse
    from argparse import RawTextHelpFormatter
    parser = argparse.ArgumentParser(
        formatter_class=RawTextHelpFormatter,
        description="""Generate lists of commands for ChIP - Seq analysis.
            1) Commands to create intersects of peaks from different replicates
            2) Commands to get the coverage for these intersects.""",
        )
    parser.add_argument('--config-file', '-cf',
        required=True,
        type=str,
        help="YAML configuration file"
        )
    parser.add_argument('--intersects', '-i',
        required=False,
        type=str,
        help="Filename for the list of intersection commands.",
        )
    parser.add_argument('--coverage', '-c',
        required=False,
        type=str,
        help="Filename for the list of coverage commands.",
        default=None
        )
    parser.add_argument('--fold', '-f',
        required=False,
        action="store_true",
        help="If included, fold and log-fold coverage will be calculated for intersects.",
        )
    args=parser.parse_args()

    sample_config_file=args.config_file
    intersects_commands_filename=args.intersects
    coverage_commands_filename=args.coverage
    fold = args.fold

    chipseq_config=ChipSeqConfiguration(sample_config_file)

    if intersects_commands_filename:
        chipseq_config.writeIntersectCommands(intersects_commands_filename)

    if coverage_commands_filename:
        chipseq_config.writeCoverageCommands(coverage_commands_filename)

    if fold:
        chipseq_config.writeFoldChange()

Clone this wiki locally