build_pseudo_spectra_from_pairs

Function build_pseudo_spectra_from_pairs 

Source
pub fn build_pseudo_spectra_from_pairs(
    ms1: &[ClusterResult1D],
    ms2: &[ClusterResult1D],
    features: &[SimpleFeature],
    pairs: &[(usize, usize)],
    opts: &PseudoSpecOpts,
) -> Vec<PseudoSpectrum>
Expand description

Build pseudo-DDA spectra from:

  • ms1: MS1 clusters
  • ms2: MS2 clusters
  • features: isotopic SimpleFeatures built on MS1
  • pairs: candidate links (ms2_idx, ms1_idx) from your candidate search

Behaviour:

  • If ms1_idx belongs to a feature, use the feature as the precursor.
  • Otherwise, use that MS1 cluster as a degenerate “orphan” precursor.
  • All MS2 clusters linked to any member (for features) are grouped into one spectrum.
  • Fragments are sorted by intensity and capped to top_n_fragments if >0.

This is the DIA→pseudo-DDA “glue” that you can feed into an mzML writer.