Create edges spectra

Description

This function creates molecular network edges based on MS2 fragmentation spectra similarity. Compares all spectra against each other using spectral similarity metrics to identify related features. It annotates the resulting edges with community labels derived from the similarity network and retains only intra-community edges, so the edge file itself carries the community structure.

Usage

create_edges_spectra(
  input = get_params(step = "create_edges_spectra")\$files\$spectral\$raw,
  output = get_params(step =
    "create_edges_spectra")\$files\$networks\$spectral\$edges\$raw\$spectral,
  name_source = get_params(step = "create_edges_spectra")\$names\$source,
  name_target = get_params(step = "create_edges_spectra")\$names\$target,
  method = get_params(step = "create_edges_spectra")\$similarities\$methods\$edges,
  ppm = get_params(step = "create_edges_spectra")\$ms\$tolerances\$mass\$ppm\$ms2,
  dalton = get_params(step = "create_edges_spectra")\$ms\$tolerances\$mass\$dalton\$ms2,
  cutoff = get_params(step = "create_edges_spectra")\$ms\$thresholds\$ms2\$intensity,
  min_fragments = get_params(step =
    "create_edges_spectra")\$ms\$thresholds\$ms2\$min_fragments,
  resolution = 0.1,
  n_iterations = 2L,
  seed = NULL
)

Arguments

input character Path or list of paths to query MGF file(s) containing spectra
output character Path for output edges file
name_source character Name of source feature column
name_target character Name of target feature column
method character Similarity method to use
ppm numeric Relative mass tolerance in ppm
dalton numeric Absolute mass tolerance in Daltons
cutoff numeric Intensity cutoff below which MS2 fragments are removed. Non-negative numeric or NULL for dynamic thresholding.
min_fragments integer Minimum number of fragment peaks a spectrum must have after cleaning to be retained
resolution numeric Resolution parameter for the Leiden/Louvain algorithm (higher values -> more, smaller communities). Default: 0.1.
n_iterations integer Number of iterations for the Leiden algorithm. Ignored for Louvain. Default: 2.
seed integer Random seed for reproducible clustering. If NULL, a random seed is used. Default: NULL.

Value

Character string path to the created spectral edges file.

See Also

Other workflow: change_params_small(), create_components(), create_edges(), go_to_cache(), install(), install_tima(), run_app(), run_tima(), tima_full(), validate_inputs()

Examples

library("tima")

copy_backbone()
go_to_cache()
get_file(
  url = get_default_paths()$urls$examples$spectra_mini,
  export = get_params(step = "create_edges_spectra")$files$spectral$raw
)
create_edges_spectra()
unlink("data", recursive = TRUE)