replicate-spectrum-concatenation
Summary
Concatenate MS/MS spectra across all replicate injections for a given feature to create a unified spectrum object that pools signal across technical replicates. This step unifies fragmentation data before downstream denoising and consensus spectrum generation.
When to use
Apply this skill after extracting raw MS/MS spectra from mzML files for individual features (identified by precursor m/z and retention time) and you have multiple replicate spectra for the same feature that need to be pooled for consensus analysis. Use when your goal is to aggregate replicate-level fragmentation data before applying TIC-based filtering or consensus spectrum generation.
When NOT to use
- If spectra are already in a single pre-concatenated Spectra object or feature matrix
- If you are working with single-injection data or non-replicated experiments (no technical replicates to pool)
- If your input files are already consensus spectra rather than raw replicate-level MS/MS data
Inputs
- folder path containing mzML files (raw mass spectrometry data)
- feature information file (Stats.txt or equivalent) with precursor m/z, retention time, and feature identifiers
- mass tolerance parameter (ppm, e.g., 5)
- retention time tolerance parameter (minutes, e.g., 0.1)
Outputs
- list of Spectra objects (l1) indexed by feature ID
- each element is a concatenated Spectra object containing all replicate MS/MS spectra for that feature
- filtered feature list excluding features with no extracted MS/MS spectra
How to apply
Load preprocessed spectra using the preprocess() function with specified m/z tolerance (e.g., 5 ppm) and retention time tolerance (e.g., 0.1 min) to extract MS/MS spectra from mzML files and automatically concatenate all replicates per feature into a single Spectra object. The function reads the feature list (e.g., Stats.txt) and performs m/z and RT matching to group all replicate spectra belonging to each feature. The output is a list (l1) containing concatenated Spectra objects indexed by feature ID, where each element represents the pooled replicate spectra for that feature. Verify concatenation by checking that the number of spectra in each feature element matches the expected replicate count.
Related tools
- preprocess (reads mzML files, extracts MS/MS spectra matching feature m/z and RT, concatenates spectra for each feature into a Spectra object) — https://github.com/BiosystemEngineeringLab-IITB/dures
- Spectra (Bioconductor S4 class for storing and manipulating mass spectrometry spectra data)
- mzR (reads and parses mzML files to extract raw MS/MS data)
- S4Vectors (provides S4 class infrastructure for Spectra object construction)
- dures (package implementing the full denoising workflow including replicate concatenation) — https://github.com/BiosystemEngineeringLab-IITB/dures
Examples
l1 = preprocess(folder_path = "~/metabolomics/test_1/", tol_mz = 5, tol_rt = 0.1)
Evaluation signals
- The returned list (l1) contains one Spectra object per feature with a non-zero number of spectra
- For each feature, the total number of spectra in the concatenated object equals the sum of spectra across all replicates
- Features without any extracted MS/MS spectra (based on m/z and RT tolerance) are removed from the output list
- Spectra are correctly indexed by feature ID and retain all metadata (precursor m/z, retention time, fragment m/z, intensity)
- The concatenated Spectra object preserves individual spectrum identifiers and replicate provenance information
Limitations
- Concatenation accuracy depends on correct feature m/z and RT tolerance settings; loose tolerances may concatenate spectra from different features, tight tolerances may exclude true replicates
- Features with very few replicates (e.g., n=1) may not benefit from subsequent consensus denoising steps
- mzML file format and feature table format must match expected structure; incompatible file formats will cause parsing errors
- All replicates must be present in the same folder path; missing or misnamed files will result in incomplete concatenation
Evidence
- [methods] The extracted spectra are then concatenated for all replicate spectra belonging to a given feature: "The extracted spectra are then concatenated for all replicate spectra belonging to a given feature"
- [readme] l1 <- preprocess(folder_path = folder_path, tol_mz = 25, tol_rt = 0.1): "l1 <- preprocess(folder_path = folder_path, tol_mz = 25, tol_rt = 0.1)#reads mzml files, prepares Stats file, extracts spectra and concatenates spectra"
- [methods] Features that do not have any MS/MS spectra extracted, based on the specified RT and m/z tolerance, are removed from the list: "Features that do not have any MS/MS spectra extracted, based on the specified RT and m/z tolerance, are removed from the list"
- [other] Load preprocessed spectra list (l1) containing concatenated MS/MS replicates for all features using the dures package: "Load preprocessed spectra list (l1) containing concatenated MS/MS replicates for all features using the dures package"
1---2name: replicate-spectrum-concatenation3description: Use when after extracting raw MS/MS spectra from mzML files for individual features (identified by precursor m/z and retention time) and you have multiple replicate spectra for the same feature that need to be pooled for consensus analysis.4license: CC-BY-4.05---67# replicate-spectrum-concatenation89## Summary1011Concatenate MS/MS spectra across all replicate injections for a given feature to create a unified spectrum object that pools signal across technical replicates. This step unifies fragmentation data before downstream denoising and consensus spectrum generation.1213## When to use1415Apply this skill after extracting raw MS/MS spectra from mzML files for individual features (identified by precursor m/z and retention time) and you have multiple replicate spectra for the same feature that need to be pooled for consensus analysis. Use when your goal is to aggregate replicate-level fragmentation data before applying TIC-based filtering or consensus spectrum generation.1617## When NOT to use1819- If spectra are already in a single pre-concatenated Spectra object or feature matrix20- If you are working with single-injection data or non-replicated experiments (no technical replicates to pool)21- If your input files are already consensus spectra rather than raw replicate-level MS/MS data2223## Inputs2425- folder path containing mzML files (raw mass spectrometry data)26- feature information file (Stats.txt or equivalent) with precursor m/z, retention time, and feature identifiers27- mass tolerance parameter (ppm, e.g., 5)28- retention time tolerance parameter (minutes, e.g., 0.1)2930## Outputs3132- list of Spectra objects (l1) indexed by feature ID33- each element is a concatenated Spectra object containing all replicate MS/MS spectra for that feature34- filtered feature list excluding features with no extracted MS/MS spectra3536## How to apply3738Load preprocessed spectra using the `preprocess()` function with specified m/z tolerance (e.g., 5 ppm) and retention time tolerance (e.g., 0.1 min) to extract MS/MS spectra from mzML files and automatically concatenate all replicates per feature into a single Spectra object. The function reads the feature list (e.g., Stats.txt) and performs m/z and RT matching to group all replicate spectra belonging to each feature. The output is a list (`l1`) containing concatenated Spectra objects indexed by feature ID, where each element represents the pooled replicate spectra for that feature. Verify concatenation by checking that the number of spectra in each feature element matches the expected replicate count.3940## Related tools4142- **preprocess** (reads mzML files, extracts MS/MS spectra matching feature m/z and RT, concatenates spectra for each feature into a Spectra object) — https://github.com/BiosystemEngineeringLab-IITB/dures43- **Spectra** (Bioconductor S4 class for storing and manipulating mass spectrometry spectra data)44- **mzR** (reads and parses mzML files to extract raw MS/MS data)45- **S4Vectors** (provides S4 class infrastructure for Spectra object construction)46- **dures** (package implementing the full denoising workflow including replicate concatenation) — https://github.com/BiosystemEngineeringLab-IITB/dures4748## Examples4950```51l1 = preprocess(folder_path = "~/metabolomics/test_1/", tol_mz = 5, tol_rt = 0.1)52```5354## Evaluation signals5556- The returned list (l1) contains one Spectra object per feature with a non-zero number of spectra57- For each feature, the total number of spectra in the concatenated object equals the sum of spectra across all replicates58- Features without any extracted MS/MS spectra (based on m/z and RT tolerance) are removed from the output list59- Spectra are correctly indexed by feature ID and retain all metadata (precursor m/z, retention time, fragment m/z, intensity)60- The concatenated Spectra object preserves individual spectrum identifiers and replicate provenance information6162## Limitations6364- Concatenation accuracy depends on correct feature m/z and RT tolerance settings; loose tolerances may concatenate spectra from different features, tight tolerances may exclude true replicates65- Features with very few replicates (e.g., n=1) may not benefit from subsequent consensus denoising steps66- mzML file format and feature table format must match expected structure; incompatible file formats will cause parsing errors67- All replicates must be present in the same folder path; missing or misnamed files will result in incomplete concatenation6869## Evidence7071- [methods] The extracted spectra are then concatenated for all replicate spectra belonging to a given feature: "The extracted spectra are then concatenated for all replicate spectra belonging to a given feature"72- [readme] l1 <- preprocess(folder_path = folder_path, tol_mz = 25, tol_rt = 0.1): "l1 <- preprocess(folder_path = folder_path, tol_mz = 25, tol_rt = 0.1)#reads mzml files, prepares Stats file, extracts spectra and concatenates spectra"73- [methods] Features that do not have any MS/MS spectra extracted, based on the specified RT and m/z tolerance, are removed from the list: "Features that do not have any MS/MS spectra extracted, based on the specified *RT* and *m/z* tolerance, are removed from the list"74- [other] Load preprocessed spectra list (l1) containing concatenated MS/MS replicates for all features using the dures package: "Load preprocessed spectra list (l1) containing concatenated MS/MS replicates for all features using the dures package"