| Title: | Spectra to queries |
|---|---|
| Description: | SpectraToQueries provides the infrastructure to translate spectra to queries. |
| Authors: | Adriano Rutz [aut, cre] (ORCID: <https://orcid.org/0000-0003-0443-9902>), Sarah Szwarc [ctb] (ORCID: <https://orcid.org/0000-0001-6369-5522>) |
| Maintainer: | Adriano Rutz <[email protected]> |
| License: | AGPL (>= 3) |
| Version: | 0.0.0.9002 |
| Built: | 2026-05-27 14:43:44 UTC |
| Source: | https://github.com/spectra-to-knowledge/SpectraToQueries |
Combine ions into minimal AND/OR expression with sorting
combine_ions_minimal(ion_lists)combine_ions_minimal(ion_lists)
ion_lists |
List of character vectors representing ion combinations |
Single character string representing nested AND/OR expression
Check if spectrum contains all target m/z values
contains_all_mz(spec_mz, target_mz, dalton, ppm)contains_all_mz(spec_mz, target_mz, dalton, ppm)
spec_mz |
Numeric vector of spectrum m/z values |
target_mz |
Numeric vector of target m/z values to find |
dalton |
Tolerance in Dalton |
ppm |
Tolerance in parts per million |
Logical indicating if all targets are found
NULLNULL
This function creates a directory at the specified path if it does not already exist.
create_dir(export)create_dir(export)
export |
Path to the directory to be created |
Message indicating the status of directory creation
https://github.com/taxonomicallyinformedannotation/tima/blob/main/R/create_dir.R
Create matrix
create_matrix(spectra, zero_val = 0, name)create_matrix(spectra, zero_val = 0, name)
spectra |
Spectra |
zero_val |
Zero value |
name |
Name |
A matrix with spectra intensity data
NULLNULL
Filter matrix
filter_matrix(matrix, n)filter_matrix(matrix, n)
matrix |
Matrix to filter |
n |
Minimum number of non-zero values per column |
Filtered matrix with columns having at least n non-zero values
NULLNULL
Fix binned mzs
fix_binned_mzs(binned_m, original_mzs, dalton, ppm, decimals)fix_binned_mzs(binned_m, original_mzs, dalton, ppm, decimals)
binned_m |
Binned matrix |
original_mzs |
Original m/z values from spectra |
dalton |
Tolerance in Dalton |
ppm |
Tolerance in parts per million |
decimals |
Number of decimal places for rounding |
Matrix with corrected m/z column names
NULLNULL
Generate combinations
generate_combinations(x, max_ions)generate_combinations(x, max_ions)
x |
Vector of elements to combine |
max_ions |
Maximum number of ions in combinations |
List of all combinations
NULLNULL
Generate combinations with progress
generate_combinations_progress(indices, ions_list, max_ions)generate_combinations_progress(indices, ions_list, max_ions)
indices |
Vector of indices to process |
ions_list |
List of ions for each index |
max_ions |
Maximum number of ions in combinations |
List of all combinations for each index
NULLNULL
Harmonize mzs
harmonize_mzs(spectra, dalton, ppm)harmonize_mzs(spectra, dalton, ppm)
spectra |
Spectra object |
dalton |
Tolerance in Dalton |
ppm |
Tolerance in parts per million |
Spectra with harmonized m/z values
NULLNULL
Normalize peaks
normalize_peaks()normalize_peaks()
NULLNULL
Perform list of queries
perform_list_of_queries(index, ions_list, spectra, dalton, ppm)perform_list_of_queries(index, ions_list, spectra, dalton, ppm)
index |
Index of the ion list to process |
ions_list |
List of ions for queries |
spectra |
Spectra object to search |
dalton |
Tolerance in Dalton |
ppm |
Tolerance in parts per million |
Data frame with target and value columns
NULLNULL
Perform list of queries (progress)
perform_list_of_queries_progress(ions_list, spectra, dalton, ppm)perform_list_of_queries_progress(ions_list, spectra, dalton, ppm)
ions_list |
List of ion combinations for queries |
spectra |
Spectra object to search |
dalton |
Tolerance in Dalton |
ppm |
Tolerance in parts per million |
List of query results
NULLNULL
Perform query
perform_query(spectra, frags, nls, dalton, ppm)perform_query(spectra, frags, nls, dalton, ppm)
spectra |
Spectra object |
frags |
Fragment masses to search for |
nls |
Neutral losses to search for |
dalton |
Tolerance in Dalton |
ppm |
Tolerance in parts per million |
Filtered spectra object
NULLNULL
This function converts spectra to queries.
spectra_to_queries( spectra = NULL, export = "data/interim/queries.tsv", dalton = 0.01, decimals = 4L, intensity_min = 0, ions_max = 10L, n_skel_min = 5L, n_spec_min = 3L, ppm = 30, mcc_min = 0, precision_min = 0, recall_min = 0, zero_val = 0 )spectra_to_queries( spectra = NULL, export = "data/interim/queries.tsv", dalton = 0.01, decimals = 4L, intensity_min = 0, ions_max = 10L, n_skel_min = 5L, n_spec_min = 3L, ppm = 30, mcc_min = 0, precision_min = 0, recall_min = 0, zero_val = 0 )
spectra |
Spectra path |
export |
Export path |
dalton |
Tolerance in Dalton. Default to 0.01 |
decimals |
Number of decimals for rounding. Default to 4L |
intensity_min |
Minimal intensity. Default to 0.0 |
ions_max |
Maximal number of ions in the query. Default to 10L |
n_skel_min |
Minimal number of individuals per skeleton. Default to 5L |
n_spec_min |
Minimal number of individuals where a signal has to be found. Default to 3L |
ppm |
Tolerance in parts per million Default to 30.0 |
mcc_min |
Minimal single-ion Matthews Correlation Coefficient. Default to 0.0 |
precision_min |
Minimal single ion precision (pre-filter before MCC). Default to 0.0 |
recall_min |
Minimal single ion recall (pre-filter before MCC). Default to 0.0 |
zero_val |
Zero value for intensity. Default to 0.0 |
A file with diagnostic query ions
NULLNULL