Coverage for src/python/ensembl/vep/workflow/build/default.py: 100%
16 statements
« prev ^ index » next coverage.py v7.17.2, created at 2026-11-18 14:41 +0000
« prev ^ index » next coverage.py v7.17.2, created at 2026-11-18 14:41 +0000
1# See the NOTICE file distributed with this work for additional information
2# regarding copyright ownership.
3#
4# Licensed under the Apache License, Version 2.0 (the "License");
5# you may not use this file except in compliance with the License.
6# You may obtain a copy of the License at
7# http://www.apache.org/licenses/LICENSE-2.0
8#
9# Unless required by applicable law or agreed to in writing, software
10# distributed under the License is distributed on an "AS IS" BASIS,
11# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12# See the License for the specific language governing permissions and
13# limitations under the License.
14"""The default annotation workflow builder."""
16from __future__ import annotations
18from typing import Any
20from ensembl.vep.config import Config
21from ensembl.vep.workflow.base import Workflow
22from ensembl.vep.workflow.build.registry import register_workflow
23from ensembl.vep.workflow.tracks.base import AnnotationTrack, TrackResources
24from ensembl.vep.workflow.tracks.registry import build_tracks
26__all__ = ["DEFAULT_TRACKS", "build_default_workflow"]
28DEFAULT_TRACKS = (
29 "consequence.transcript",
30 "consequence.regulatory",
31 "colocated",
32 "custom",
33)
34"""Every kind of track a default run can annotate with, in output order.
36Each kind decides from the configuration how many tracks it contributes, so a kind nothing asks
37for contributes none and the order of those that remain is this one. Transcript consequences come
38first because that is the order VEP writes them in.
39"""
42@register_workflow("default")
43def build_default_workflow(config: Config, resources: TrackResources) -> Workflow:
44 """Build the standard per-variant workflow from the configured tracks.
46 Args:
47 config (Config): The run's configuration.
48 resources (TrackResources): What every track in the workflow shares.
50 Returns:
51 Workflow: The workflow, holding one live track per configured kind.
52 """
53 tracks: list[AnnotationTrack[Any]] = []
54 for name in DEFAULT_TRACKS:
55 tracks.extend(build_tracks(name, config, resources))
56 return Workflow(name="default", tracks=tuple(tracks))