library("tima")
# Create network edges from spectra
edges <- create_edges(
frags = fragment_list,
nspecs = length(fragment_list),
precs = precursor_mz,
method = "cosine",
ms2_tolerance = 0.02,
ppm_tolerance = 10,
threshold = 0.7,
matched_peaks = 6
)Create spectral similarity network edges
Description
Calculates pairwise spectral similarity between all spectra to create a network edge list. Uses parallel processing via purrr for efficiency.
Usage
create_edges(
frags,
nspecs,
precs,
method,
ms2_tolerance,
ppm_tolerance,
threshold,
matched_peaks
)
Arguments
frags
|
List of fragment spectra matrices |
nspecs
|
Integer number of spectra |
precs
|
Numeric vector of precursor m/z values |
method
|
Similarity method ("entropy", "gnps", or "cosine") |
ms2_tolerance
|
MS2 tolerance in Daltons |
ppm_tolerance
|
PPM tolerance |
threshold
|
Minimum similarity score threshold |
matched_peaks
|
Minimum number of matched peaks required |
Value
Data frame with columns: feature_id, target_id, score, matched_peaks. Returns empty data frame with NA values if no edges pass thresholds.