Skip to contents

Reduce m/z features in an analysis that includes putative molecular formula assignments by removing isotopic, adduct or unknown features.

Usage

reduce(
  x,
  isotopes = TRUE,
  adducts = TRUE,
  unknowns = FALSE,
  isotopic_adducts = c("[M+Cl37]1-", "[M+K41]1+")
)

# S4 method for Analysis
reduce(
  x,
  isotopes = TRUE,
  adducts = TRUE,
  unknowns = FALSE,
  isotopic_adducts = c("[M+Cl37]1-", "[M+K41]1+")
)

# S4 method for AnalysisData
reduce(
  x,
  isotopes = TRUE,
  adducts = TRUE,
  unknowns = FALSE,
  isotopic_adducts = c("[M+Cl37]1-", "[M+K41]1+")
)

Arguments

x

an object of S4 class Analysis or AnalysisData

isotopes

TRUE/FALSE remove isotopic features.

adducts

TRUE/FALSE remove features that are multiple adducts of the same molecular formula. The adduct with the highest intensity is retained for each assigned molecular formula.

unknowns

TRUE/FALSE remove unaOssigned m/z features.

isotopic_adducts

a vector of additional isotopic adducts to remove if argument isotopes = TRUE

Value

An object of S4 class Analysis or AnalysisData with reduced m/z features.

Details

If argument isotopes = TRUE, all isotopic features are removed. If argument adducts = TRUE, the feature with the maximum intensity for each molecular formula is retained.

Examples

## Assign molecular formulas
p <- assignments::assignmentParameters('FIE')

assignment <- assignments::assignMFs(assignments::feature_data,p)
#> 
#> assignments v1.0.0 Fri Jul 21 17:29:22 2023
#> ________________________________________________________________________________
#> Assignment Parameters: 
#> 
#> 	 Technique:		 FIE-HRMS 
#> 	 Max M:			 800 
#> 	 MF rank threshold:	 3 
#> 	 PPM threshold:		 6 
#> 	 Relationship limit:	 0.001 
#> 	 RT limit:		  
#> 	 Correlations:
#> 		method: spearman
#>  		pAdjustMethod: bonferroni
#>  		corPvalue: 0.05
#>  		minCoef: 0.7
#>  		maxCor: Inf
#> 
#> 	 Adducts: 
#> 	 n: [M-H]1-, [M+Cl]1-, [M+K-2H]1-, [M-2H]2-, [M+Cl37]1-, [2M-H]1-
#> 	 p: [M+H]1+, [M+K]1+, [M+Na]1+, [M+K41]1+, [M+2H]2+, [2M+H]1+ 
#> 	 Isotopes: 13C, 18O, 13C2 
#> 	 Transformations: M - [O] + [NH2], M - [OH] + [NH2], M + [H2], M - [H2] + [O], M - [H] + [CH3], M - [H] + [NH2], M - [H] + [OH], M + [H2O], M - [H3] + [H2O], M - [H] + [CHO2], M - [H] + [SO3], M - [H] + [PO3H2]
#> ________________________________________________________________________________
#> No. m/z:	10
#> Calculating correlations 
#> Calculating correlations 	 [10 correlations] [0.9S]
#> Calculating relationships 
#> Calculating relationships 	 [2S]
#> Adduct & isotopic assignment 
#> generating molecular formulas…

#> generating molecular formulas	 [23.8S]
#> iteration 1…

#> iteration 1			 [0.5S]
#> iteration 2…

#> Adduct & isotopic assignment 	 [25.1S]
#> Transformation assignment
#> iteration 1 …

#> iteration 1 			 [1.5S]
#> iteration 2 …

#> Transformation assignment 	 [1.5S]
#> ________________________________________________________________________________
#> 
#> Complete! [31.8S]

## Retrieve assigned data
assigned_data <- metabolyseR::analysisData(
 assignments::assignedData(assignment),
 tibble::tibble(sample = seq_len(nrow(assignments::feature_data)))
 )

reduced_data <- metaboMisc::reduce(assigned_data)

reduced_data
#> 
#> AnalysisData object containing:
#> 
#> Samples: 60 
#> Features: 6 
#> Info: 1 
#>