Skip to content

Commit

Permalink
Drop redundant data manager parsing
Browse files Browse the repository at this point in the history
  • Loading branch information
mvdbeek committed Feb 2, 2024
1 parent 72dddac commit 413d156
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 31 deletions.
28 changes: 2 additions & 26 deletions src/ephemeris/_idc_data_managers_to_tools.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,6 @@
"""
import argparse
import logging
from typing import (
Dict,
List,
NamedTuple,
)

import yaml

Expand All @@ -29,29 +24,10 @@
)


class DataManager(NamedTuple):
tool_id: str
repository_name: str
tags: List[str]


def read_data_managers_configuration(path: str) -> Dict[str, DataManager]:
raw_data_managers = read_data_managers(path)
data_managers: Dict[str, DataManager] = {}
for repository_name, data_manager_configuration in raw_data_managers.__root__.items():
data_manager = DataManager(
tool_id=data_manager_configuration.tool_id,
repository_name=repository_name,
tags=data_manager_configuration.tags or [],
)
data_managers[repository_name] = data_manager
return data_managers


def build_shed_install_conf(path: str) -> dict:
data_managers = read_data_managers_configuration(path)
data_managers = read_data_managers(path)
tools = []
for data_manager in data_managers.values():
for data_manager in data_managers.__root__.values():
tool_id = data_manager.tool_id
tool_id_parts = tool_id.split("/")
repo_owner = tool_id_parts[2]
Expand Down
11 changes: 6 additions & 5 deletions src/ephemeris/_idc_split_data_manager_genomes.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,10 @@
)

from . import get_galaxy_connection
from ._idc_data_managers_to_tools import (
from ._config_models import (
DataManager,
read_data_managers_configuration,
DataManagers,
read_data_managers,
)
from .common_parser import get_common_args
from .ephemeris_log import (
Expand Down Expand Up @@ -77,8 +78,8 @@ class SplitOptions:
filters: Filters = Filters()


def tool_id_for(indexer: str, data_managers: Dict[str, DataManager], mode: str) -> str:
data_manager = data_managers[indexer]
def tool_id_for(indexer: str, data_managers: DataManagers, mode: str) -> str:
data_manager = data_managers.__root__[indexer]
assert data_manager, f"Could not find a target data manager for indexer name {indexer}"
tool_shed_guid = data_manager.tool_id
if mode == "short":
Expand Down Expand Up @@ -151,7 +152,7 @@ def write_run_data_manager_to_file(run_data_manager: RunDataManager, path: str):


def walk_over_incomplete_runs(split_options: SplitOptions):
data_managers = read_data_managers_configuration(split_options.data_managers_path)
data_managers = read_data_managers(split_options.data_managers_path)
with open(split_options.merged_genomes_path) as f:
genomes_all = yaml.safe_load(f)
genomes = genomes_all["genomes"]
Expand Down

0 comments on commit 413d156

Please sign in to comment.