bridge.pipelines.gh2bt_for_meta.map_funcs.biotools_id module

bridge.pipelines.gh2bt_for_meta.map_funcs.biotools_id module#

Map GitHub repository name to bio.tools ID.

This module reconciles the GitHub repository name with the bio.tools ID. It applies a policy that prefers the GitHub name while ensuring uniqueness within bio.tools, generating alternative IDs if necessary.

async bridge.pipelines.gh2bt_for_meta.map_funcs.biotools_id.map_biotools_id(gh_name, bt_id)[source]#

Map and reconcile GitHub repository name to bio.tools ID.

Policy: 1. If no GitHub repo name is available, preserve existing bio.tools ID (even if None). 2. If the existing bio.tools ID and GitHub repo name contain each other

(case-insensitive), preserve the existing bio.tools ID.

  1. If they do not contain each other, log a conflict but continue.

  2. If the GitHub repo name is not already used as a bio.tools ID, use it as the new bio.tools ID.

  3. If the GitHub repo name is already used as a bio.tools ID, attempt to generate a unique ID by appending suffixes -1, -2, … up to -99. If a unique ID is found, use it.

  4. If no unique ID can be generated, log a note and return None, requiring manual intervention.

Parameters:
  • gh_name (str | None) – GitHub repository name.

  • bt_id (str | None) – Existing bio.tools ID.

Returns:

Mapped bio.tools ID, or None if mapping failed.

Return type:

str | None