Files
PlantAI-dev/tests/unit/test_wgs_joint_genotyping_backend.py
2026-08-03 18:42:47 +08:00

63 lines
2.2 KiB
Python

from __future__ import annotations
from apps.web.vue3.main import ExecuteRequest
from gfa_core.mas.agents.planning_v2 import PlanningAgentV2
from gfa_core.mas.stage_capabilities import CAPABILITIES
from gfa_core.mas.stage_catalog import EXECUTABLE_STAGES, STAGE_DEPENDENCIES
from gfa_core.mas.tools.stage_tools import StageToolRegistry
def test_wgs_joint_genotyping_vertical_registration_is_exact() -> None:
assert STAGE_DEPENDENCIES["wgs_joint_genotyping"] == [
"wgs_gvcf_combine",
"wgs_index",
]
assert "wgs_joint_genotyping" in EXECUTABLE_STAGES
capability = CAPABILITIES["wgs_joint_genotyping"]
assert {item.role for item in capability.consumes} == {
"combined_gvcf",
"combined_gvcf_index",
"reference_fasta",
"reference_fai",
"reference_dict",
}
assert {item.role for item in capability.provides} == {
"joint_vcf",
"joint_vcf_index",
"joint_summary",
"joint_log",
}
definition = next(
item
for item in StageToolRegistry.STAGE_DEFINITIONS
if item["id"] == "wgs_joint_genotyping"
)
assert definition["script"] == "run_wgs_joint_genotyping.py"
assert definition["conda_env"] == "ASAW"
assert capability.env == "ASAW"
assert definition["required_inputs"] == [
"wgs_combine_manifest",
"wgs_index_manifest",
]
assert PlanningAgentV2.REQUIRED_INPUTS["wgs_joint_genotyping"] == []
def test_api_contract_carries_stage08_authorities_tool_and_parameters() -> None:
request = ExecuteRequest(
stage="wgs_joint_genotyping",
wgsCombineManifest="final/Cohort.wgs_gvcf_combine.manifest.json",
wgsIndexManifest="final/Cohort.wgs_index.manifest.json",
wgsGatk="/opt/gatk",
wgsMaxAlternateAlleles=6,
wgsCallingThreshold=10,
wgsIncludeNonVariantSites=False,
)
assert request.wgsCombineManifest.endswith(
".wgs_gvcf_combine.manifest.json"
)
assert request.wgsIndexManifest.endswith(".wgs_index.manifest.json")
assert request.wgsGatk == "/opt/gatk"
assert request.wgsMaxAlternateAlleles == 6
assert request.wgsCallingThreshold == 10
assert request.wgsIncludeNonVariantSites is False