Skip to content

Conversation

@Ulthran
Copy link
Contributor

@Ulthran Ulthran commented Jan 29, 2026

Motivation

  • Use an authoritative remote machine_types.tsv to resolve Illumina instrument codes instead of a hardcoded map.
  • Keep behavior robust when the remote resource is unavailable by falling back to a bundled mapping and warning the user.
  • Avoid disk caching and keep a simple in-memory cache for runtime efficiency.

Description

  • Add MACHINE_TYPES_FALLBACK (bundled fallback), MACHINE_TYPES_URL, and an in-memory cache _machine_types_cache with a new load_machine_types() loader that fetches and parses the TSV via urlopen and csv and warns on fallback.
  • Replace direct uses of the old mapping with calls to load_machine_types() in IlluminaDir._parse_folder, IlluminaFastq.machine_type, and the run-name detection logic.
  • Emit warnings.warn messages when the remote TSV cannot be loaded or contains no valid rows, and document the fallback mapping inline with a comment.
  • Add necessary imports (csv, warnings, URLError, urlopen) and keep caching only in-memory (no disk writes).

Testing

  • No automated tests were run against this change.

Codex Task

Copilot AI review requested due to automatic review settings January 29, 2026 21:26
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This pull request replaces the hardcoded MACHINE_TYPES dictionary with a dynamic loader that fetches machine type mappings from a remote TSV file, with fallback to a bundled mapping when the remote resource is unavailable.

Changes:

  • Introduces load_machine_types() function that fetches and caches machine type mappings from a remote TSV URL with fallback to bundled mappings
  • Renames MACHINE_TYPES to MACHINE_TYPES_FALLBACK and adds remote URL configuration
  • Updates three call sites to use the new load_machine_types() function instead of direct dictionary access

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@Ulthran Ulthran closed this Jan 30, 2026
@Ulthran Ulthran deleted the codex/retrieve-machine-mapping-from-external-source branch January 30, 2026 22:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants