Source code for modalysis.client.plot

"""HTTP client calls for plot endpoints."""

import logging

import requests
from modalysis.constants import DEFAULT_BASE_URL

logger = logging.getLogger(__name__)


[docs] def plot_mean_methylation( gff_path: str, merged_pileup_paths: list[str], labels: list[str], output_path: str, output_name: str, y_min: float = 0.0, y_max: float = 0.1, chromosome_order: list[str] | None = None, plot_title: str | None = None, base_url: str = DEFAULT_BASE_URL, ) -> dict[str, str]: """POST a mean-methylation plotting request to the server.""" url = f"{base_url}/plot/mean-methylation" payload = { "gff_path": gff_path, "merged_pileup_paths": merged_pileup_paths, "labels": labels, "output_path": output_path, "output_name": output_name, "y_min": y_min, "y_max": y_max, "chromosome_order": chromosome_order, "plot_title": plot_title, } logger.info("Client sending plot mean-methylation request to %s", url) response = requests.post(url, json=payload) response.raise_for_status() return response.json()
[docs] def plot_gene_heatmap( annotated_dmr_paths: list[str], manifestations: list[str], modifications: list[str], manifestation_labels: list[str], expression_labels: list[str], annotated_gff_path: str, gff_path: str, merged_pileup_paths: list[str], pileup_manifestations: list[str], pileup_modifications: list[str], output_path: str, output_name: str, show_gene_labels: bool = False, effect_signs: list[str] | None = None, base_url: str = DEFAULT_BASE_URL, ) -> dict[str, str]: """POST a gene-heatmap plotting request to the server.""" url = f"{base_url}/plot/gene-heatmap" payload = { "annotated_dmr_paths": annotated_dmr_paths, "manifestations": manifestations, "modifications": modifications, "manifestation_labels": manifestation_labels, "expression_labels": expression_labels, "annotated_gff_path": annotated_gff_path, "gff_path": gff_path, "merged_pileup_paths": merged_pileup_paths, "pileup_manifestations": pileup_manifestations, "pileup_modifications": pileup_modifications, "output_path": output_path, "output_name": output_name, "show_gene_labels": show_gene_labels, "effect_signs": effect_signs, } logger.info("Client sending plot gene-heatmap request to %s", url) response = requests.post(url, json=payload) response.raise_for_status() return response.json()
[docs] def plot_dmr_dotplot( annotated_dmr_paths: list[str], manifestations: list[str], modifications: list[str], manifestation_labels: list[str], expression_labels: list[str], annotated_gff_path: str, gff_path: str, output_path: str, output_name: str, show_gene_labels: bool = False, effect_signs: list[str] | None = None, base_url: str = DEFAULT_BASE_URL, ) -> dict[str, str]: """POST a DMR dotplot request to the server.""" url = f"{base_url}/plot/dmr-dotplot" payload = { "annotated_dmr_paths": annotated_dmr_paths, "manifestations": manifestations, "modifications": modifications, "manifestation_labels": manifestation_labels, "expression_labels": expression_labels, "annotated_gff_path": annotated_gff_path, "gff_path": gff_path, "output_path": output_path, "output_name": output_name, "show_gene_labels": show_gene_labels, "effect_signs": effect_signs, } logger.info("Client sending plot dmr-dotplot request to %s", url) response = requests.post(url, json=payload) response.raise_for_status() return response.json()
[docs] def plot_common_genes_venn( annotated_dmr_paths: list[str], manifestations: list[str], modifications: list[str], modification_a: str, modification_b: str, output_path: str, output_name: str, base_url: str = DEFAULT_BASE_URL, ) -> dict[str, str]: """POST a common-genes Venn plotting request to the server.""" url = f"{base_url}/plot/common-genes-venn" payload = { "annotated_dmr_paths": annotated_dmr_paths, "manifestations": manifestations, "modifications": modifications, "modification_a": modification_a, "modification_b": modification_b, "output_path": output_path, "output_name": output_name, } logger.info("Client sending plot common-genes-venn request to %s", url) response = requests.post(url, json=payload) response.raise_for_status() return response.json()