agentsclimarketplace

File format detection and routing

Skill HolobiomicsLab/asb-skill-collections/collections/metabolomics/v2/skills/file-format-detection-and-routing

Use when when you receive a mass spectrometry imaging dataset in unknown or mixed vendor formats and need to apply format-specific preprocessing before generating ion images.From its SKILL.md

Install
npx -y skills add HolobiomicsLab/asb-skill-collections --skill file-format-detection-and-routing

Assembled from the repository path, not quoted from the project. Check it against their README if it does not work.

One thing to look at

  • 15 stars15 stars. Stars are a popularity signal and not a quality one, but at this level it is likely that nobody has read this closely except its author, and you would be relying on your own review.

What its file declares

Copied from the file, not written here

The file declares its own license as CC-BY-4.0. That is the author’s claim about this one file, and it is not the same thing as the license GitHub reports for the repository, which is listed with the other numbers below.

SKILL.md

7.2 KB, ~1.4k tokens by cl100k_base, as published. Nobody here has run it

file-format-detection-and-routing

Summary

Automatically detect mass spectrometry imaging (MSI) input file format by extension and route to the appropriate MSIGen processing module. This skill enables unified handling of vendor-specific (.raw, .d, .baf, .tsf, .tdf) and open-source (.mzML) formats within a single data processing pipeline.

When to use

When you receive a mass spectrometry imaging dataset in unknown or mixed vendor formats and need to apply format-specific preprocessing before generating ion images. Specifically, use this skill at pipeline entry when the input file path is provided but the processing module has not yet been determined.

When NOT to use

  • Input file is already converted to a standardized intermediate format (e.g., NumPy array or .mzML) that does not require vendor-specific parsing.
  • File extension is missing or ambiguous (e.g., generic .dat or .bin without vendor metadata).
  • Processing pipeline is designed for a single known vendor format; format detection adds unnecessary latency.

Inputs

  • file path string (e.g., '/data/sample.raw', '/data/sample.d', '/data/sample.mzML')
  • file extension (extracted from path)

Outputs

  • MSIGen module object or handler (e.g., MSIGen.raw, MSIGen.D, MSIGen.baf, MSIGen.tsf, MSIGen.tdf, MSIGen.mzml)
  • confirmation of format support

How to apply

Extract the file extension from the input file path string. Implement conditional dispatch logic that maps each supported extension to its corresponding MSIGen module: MSIGen.raw for Thermo .raw files, MSIGen.D for Agilent .d directories, MSIGen.tsf for Bruker .tsf, MSIGen.baf for Bruker .baf (which requires pyBaf2Sql), MSIGen.tdf for Bruker .tdf, and MSIGen.mzml for open-source .mzML files. Return the selected module object or callable handler. If the file extension is unsupported, raise a clear exception listing the recognized formats. This routing ensures that format-specific metadata extraction, spectral parsing, and mobility filtering (where applicable) are delegated to the correct module.

Related tools

Examples

# Python snippet
from pathlib import Path
import msigen

file_path = '/data/sample.raw'
extension = Path(file_path).suffix.lower()

if extension == '.raw':
    module = msigen.raw
elif extension == '.d':
    module = msigen.D
elif extension == '.baf':
    module = msigen.baf
elif extension == '.tsf':
    module = msigen.tsf
elif extension == '.tdf':
    module = msigen.tdf
elif extension == '.mzml':
    module = msigen.mzml
else:
    raise ValueError(f'Unsupported format: {extension}')

MSIGen_generator = module(example_file=file_path, mass_list_dir='mass_list.xlsx', ...)

Evaluation signals

  • Verify that the returned module object matches the expected handler for the input file extension (e.g., MSIGen.raw for .raw files).
  • Confirm that the module object is callable or has the required methods (e.g., get_image_data()) for downstream processing.
  • Test with all supported format strings (.raw, .d, .baf, .tsf, .tdf, .mzML) and verify no incorrect mappings occur.
  • Verify that unsupported extensions (e.g., .csv, .xyz) raise an exception with a clear error message listing recognized formats.
  • For .baf files, confirm that pyBaf2Sql is installed and that the BafData class can be instantiated with the routed module.

Limitations

  • Agilent .d format is a directory, not a single file; path extraction must handle directory paths correctly.
  • Bruker .baf format requires optional pyBaf2Sql dependency; if not installed, routing succeeds but downstream instantiation will fail; consider pre-flight dependency check.
  • Extension-based detection does not validate actual file content; a .raw file with corrupted or mismatched headers will be routed correctly but fail during module initialization.
  • Some vendors may use case-sensitive extensions (.RAW vs .raw); normalization to lowercase is recommended but not enforced in the article.

Evidence

  • [other] Accept a file path string as input and extract the file extension (e.g., .raw, .d, .baf, .tsf, .tdf, .mzML). Implement conditional dispatch logic that maps each supported extension to its corresponding MSIGen module: MSIGen.raw for Thermo .raw files, MSIGen.D for Agilent .d, MSIGen.tsf for Bruker .tsf, MSIGen.baf for Bruker .baf (requiring pyBaf2Sql), MSIGen.tdf for Bruker .tdf, and MSIGen.mzml for open-source .mzML files.: "Accept a file path string as input and extract the file extension (e.g., .raw, .d, .baf, .tsf, .tdf, .mzML). Implement conditional dispatch logic that maps each supported extension to its"
  • [other] Return the selected module object or callable handler. Raise a clear exception if the file extension is unsupported or unrecognized.: "Return the selected module object or callable handler. Raise a clear exception if the file extension is unsupported or unrecognized."
  • [intro] MSIGen provides premade files for converting data to images using a GUI, jupyter notebook, or from the command line, with support for multiple vendor formats and data types.: "MSIGen provides premade files for converting data to images using a GUI, jupyter notebook, or from the command line, with support for multiple vendor formats and data types."
  • [readme] If you are planning on using Bruker .d data in the .baf format, you will also need to install pyBaf2Sql from GitHub: "If you are planning on using Bruker .d data in the .baf format, you will also need to install pyBaf2Sql from GitHub"

What ships with it

Read from the repository

Just SKILL.md. No reference files, no scripts.

Keep looking

Skills are one crate of 325,949. Ordering is by how many stacks a row turns up in, so the top of any crate is what has actually been picked rather than what has the most stars.