Source code for modalysis.cli.handlers.dmr

"""CLI handlers for DMR commands."""

import argparse
import logging

from modalysis.client.dmr import (
    dmr_annotate,
    dmr_common_genes,
    dmr_format,
    dmr_gene_counts,
)

logger = logging.getLogger(__name__)


[docs] def handle_dmr_format(args: argparse.Namespace) -> None: """Handle `modalysis dmr format` CLI command.""" with open(args.allowed_chromosomes) as f: allowed_chromosomes = [line.strip() for line in f if line.strip()] base_url = f"http://localhost:{args.port}" result = dmr_format( input_path=args.input_path, output_path=args.output_path, output_name=args.output_name, allowed_chromosomes=allowed_chromosomes, min_score=args.min_score, max_p_value=args.max_p_value, min_pct_a_samples=args.min_pct_a_samples, min_pct_b_samples=args.min_pct_b_samples, min_reads=args.min_reads, base_url=base_url, ) print(result)
[docs] def handle_dmr_annotate(args: argparse.Namespace) -> None: """Handle `modalysis dmr annotate` CLI command.""" base_url = f"http://localhost:{args.port}" result = dmr_annotate( dmr_path=args.dmr_path, gff_path=args.gff_path, output_path=args.output_path, output_name=args.output_name, base_url=base_url, ) print(result)
[docs] def handle_dmr_gene_counts(args: argparse.Namespace) -> None: """Handle `modalysis dmr gene-counts` CLI command.""" base_url = f"http://localhost:{args.port}" result = dmr_gene_counts( annotated_dmr_paths=args.annotated_dmr_paths, manifestations=args.manifestations, modifications=args.modifications, manifestation_labels=args.manifestation_labels, expression_labels=args.expression_labels, annotated_gff_path=args.annotated_gff_path, output_path=args.output_path, output_name=args.output_name, output_excel=args.output_excel, base_url=base_url, ) print(result)
[docs] def handle_dmr_common_genes(args: argparse.Namespace) -> None: """Handle `modalysis dmr common-genes` CLI command.""" base_url = f"http://localhost:{args.port}" result = dmr_common_genes( annotated_dmr_paths=args.annotated_dmr_paths, manifestations=args.manifestations, modifications=args.modifications, manifestation_labels=args.manifestation_labels, expression_labels=args.expression_labels, modification_a=args.modification_a, modification_b=args.modification_b, annotated_gff_path=args.annotated_gff_path, output_path=args.output_path, output_name=args.output_name, base_url=base_url, ) print(result)