agentsclimarketplace

Tcn encoder input preprocessing

Skill HolobiomicsLab/asb-skill-collections/collections/metabolomics/v1/skills/tcn-encoder-input-preprocessing

Use when when reproducing or auditing FIDDLE's formula prediction pipeline, or when implementing the TCN encoder in your own codebase and need to confirm that the precursor m/z (env[:, 0]) has been removed from the feature vector to avoid leakage of mass information into the model's learned.From its SKILL.md

Install
npx -y skills add HolobiomicsLab/asb-skill-collections --skill tcn-encoder-input-preprocessing

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

6.8 KB, ~1.2k tokens by cl100k_base, as published. Nobody here has run it

tcn-encoder-input-preprocessing

Summary

Verify that precursor m/z values are consistently zeroed in the input feature array before passing spectra to the temporal convolutional network (TCN) encoder in FIDDLE, preventing mass-based prior learning that would bias molecular formula prediction.

When to use

When reproducing or auditing FIDDLE's formula prediction pipeline, or when implementing the TCN encoder in your own codebase and need to confirm that the precursor m/z (env[:, 0]) has been removed from the feature vector to avoid leakage of mass information into the model's learned representations.

When NOT to use

  • When the precursor m/z is required as a model input (e.g., for mass refinement or ranking tasks that explicitly use the neutral mass)
  • When implementing a variant of FIDDLE that intentionally uses mass information as a supervised signal during training
  • When analyzing a different mass spectrometry model that does not claim independence from precursor mass information

Inputs

  • spectrum feature array (env) with precursor m/z in index 0
  • Python execution scripts (run_fiddle.py, train_rescore.py, test_caffeine.py)
  • configuration YAML files for TCN model
  • MGF input file with PRECURSOR_MZ field

Outputs

  • preprocessed feature array with env[:, 0] = 0
  • verification report listing script name, preprocessing code location, and pass/fail status
  • structured comparison of zeroing operations across three scripts

How to apply

Load the three main FIDDLE execution scripts (run_fiddle.py, train_rescore.py, test_caffeine.py) and locate the spectrum preprocessing section where the input feature array env is assembled before encoder input. Verify that env[:, 0] is explicitly set to zero at the same execution point in all three scripts, ensuring the precursor m/z channel is neutralized before the TCN encoder processes the spectrum. Document the exact line numbers, surrounding context, and confirm the timing of the zeroing operation relative to model inference or training. The zeroing must occur after feature array construction but before the array is passed to the model's forward pass to guarantee no mass information leaks into learned encoder weights.

Related tools

  • FIDDLE (Deep learning model for molecular formula prediction from MS/MS spectra; provides the TCN encoder architecture and scripts requiring input preprocessing verification) — https://github.com/JosieHong/FIDDLE
  • msfiddle (PyPI package and CLI wrapper for FIDDLE inference; may be used for end-to-end prediction validation to ensure preprocessing is applied correctly) — https://github.com/josiehong/msfiddle

Examples

# Load run_fiddle.py and search for env[:, 0] zeroing:
git clone https://github.com/JosieHong/FIDDLE.git && cd FIDDLE && grep -n "env\[:, 0\]" run_fiddle.py train_rescore.py test_caffeine.py && head -30 run_fiddle.py | grep -A 5 -B 5 'env'

Evaluation signals

  • All three scripts (run_fiddle.py, train_rescore.py, test_caffeine.py) contain an explicit assignment env[:, 0] = 0 or equivalent masking operation
  • The zeroing operation occurs at the same logical step in the preprocessing pipeline across all three scripts (i.e., same position relative to feature normalization and model input)
  • Diff comparison of preprocessing blocks in the three scripts shows identical or semantically equivalent zeroing code and timing
  • Formula prediction outputs are invariant to changes in input precursor_mz values (i.e., the same spectrum with different precursor m/z values yields the same predicted formula), confirming no mass leakage
  • Code review confirms env[:, 0] is zeroed before the array is indexed into the model.forward() call or equivalent encoder input

Limitations

  • The verification scope is limited to the three named scripts; other unofficial FIDDLE implementations or forks may not follow this preprocessing convention
  • Zeroing at the wrong execution point (e.g., after encoder inference has already consumed the value) would pass string matching but still fail functional verification
  • The check does not verify whether the zeroing operation is actually executed at runtime; static code inspection alone cannot catch conditional or exception-based logic that skips zeroing
  • Pre-trained model weights may have been trained with or without proper zeroing; this skill verifies preprocessing code consistency, not historical training practices

Evidence

  • [other] Is the precursor m/z value (env[:, 0]) consistently zeroed before spectrum encoding across the three main execution scripts in the FIDDLE codebase?: "Is the precursor m/z value (env[:, 0]) consistently zeroed before spectrum encoding across the three main execution scripts"
  • [other] Locate the spectrum preprocessing section in each script where env (input feature array) is prepared before passing to the TCN encoder.: "Locate the spectrum preprocessing section in each script where env (input feature array) is prepared before passing to the TCN encoder"
  • [other] Confirm that env[:, 0] is set to zero in each script and document the exact line(s) and context.: "Confirm that env[:, 0] is set to zero in each script and document the exact line(s) and context"
  • [readme] FIDDLE is a deep learning method for predicting molecular formulas from MS/MS spectra. This repository contains the full research codebase for model training, evaluation, and paper reproduction.: "FIDDLE is a deep learning method for predicting molecular formulas from MS/MS spectra. This repository contains the full research codebase for model training, evaluation, and paper reproduction"
  • [readme] See test_caffeine.py for a worked example running FIDDLE on a caffeine Orbitrap spectrum fetched live from GNPS.: "See test_caffeine.py for a worked example running FIDDLE on a caffeine Orbitrap spectrum fetched live from GNPS"

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.