Package 'SpectraToQueries'

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

Help Index


Combine ions into minimal AND/OR expression with sorting

Description

Combine ions into minimal AND/OR expression with sorting

Usage

combine_ions_minimal(ion_lists)

Arguments

ion_lists

List of character vectors representing ion combinations

Value

Single character string representing nested AND/OR expression


Check if spectrum contains all target m/z values

Description

Check if spectrum contains all target m/z values

Usage

contains_all_mz(spec_mz, target_mz, dalton, ppm)

Arguments

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

Value

Logical indicating if all targets are found

Examples

NULL

Create directory

Description

This function creates a directory at the specified path if it does not already exist.

Usage

create_dir(export)

Arguments

export

Path to the directory to be created

Value

Message indicating the status of directory creation

Source

https://github.com/taxonomicallyinformedannotation/tima/blob/main/R/create_dir.R


Create matrix

Description

Create matrix

Usage

create_matrix(spectra, zero_val = 0, name)

Arguments

spectra

Spectra

zero_val

Zero value

name

Name

Value

A matrix with spectra intensity data

Examples

NULL

Filter matrix

Description

Filter matrix

Usage

filter_matrix(matrix, n)

Arguments

matrix

Matrix to filter

n

Minimum number of non-zero values per column

Value

Filtered matrix with columns having at least n non-zero values

Examples

NULL

Fix binned mzs

Description

Fix binned mzs

Usage

fix_binned_mzs(binned_m, original_mzs, dalton, ppm, decimals)

Arguments

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

Value

Matrix with corrected m/z column names

Examples

NULL

Generate combinations

Description

Generate combinations

Usage

generate_combinations(x, max_ions)

Arguments

x

Vector of elements to combine

max_ions

Maximum number of ions in combinations

Value

List of all combinations

Examples

NULL

Generate combinations with progress

Description

Generate combinations with progress

Usage

generate_combinations_progress(indices, ions_list, max_ions)

Arguments

indices

Vector of indices to process

ions_list

List of ions for each index

max_ions

Maximum number of ions in combinations

Value

List of all combinations for each index

Examples

NULL

Harmonize mzs

Description

Harmonize mzs

Usage

harmonize_mzs(spectra, dalton, ppm)

Arguments

spectra

Spectra object

dalton

Tolerance in Dalton

ppm

Tolerance in parts per million

Value

Spectra with harmonized m/z values

Examples

NULL

Normalize peaks

Description

Normalize peaks

Usage

normalize_peaks()

Examples

NULL

Perform list of queries

Description

Perform list of queries

Usage

perform_list_of_queries(index, ions_list, spectra, dalton, ppm)

Arguments

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

Value

Data frame with target and value columns

Examples

NULL

Perform list of queries (progress)

Description

Perform list of queries (progress)

Usage

perform_list_of_queries_progress(ions_list, spectra, dalton, ppm)

Arguments

ions_list

List of ion combinations for queries

spectra

Spectra object to search

dalton

Tolerance in Dalton

ppm

Tolerance in parts per million

Value

List of query results

Examples

NULL

Perform query

Description

Perform query

Usage

perform_query(spectra, frags, nls, dalton, ppm)

Arguments

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

Value

Filtered spectra object

Examples

NULL

Spectra to queries

Description

This function converts spectra to queries.

Usage

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
)

Arguments

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

Value

A file with diagnostic query ions

Examples

NULL