Skip to contents

Export data tables from Binalysis,MetaboProfile, Analysis and Assignment classes.

Usage

exportData(x, outPath = ".", ...)

# S4 method for Binalysis
exportData(x, outPath = ".")

# S4 method for MetaboProfile
exportData(x, outPath = ".")

# S4 method for AnalysisData
exportData(x, outPath = ".", idx = "name", prefix = "analysis")

# S4 method for Analysis
exportData(x, outPath = ".", type = "raw", idx = "name")

# S4 method for Assignment
exportData(x, outPath = ".")

exportSampleInfo(x, outPath = ".", ...)

# S4 method for Binalysis
exportSampleInfo(x, outPath = ".")

# S4 method for MetaboProfile
exportSampleInfo(x, outPath = ".")

# S4 method for AnalysisData
exportSampleInfo(x, outPath = ".", prefix = "analysis")

# S4 method for Analysis
exportSampleInfo(x, outPath = ".", type = "raw")

exportAccurateData(x, outPath = ".")

# S4 method for Binalysis
exportAccurateData(x, outPath = ".")

exportPeakInfo(x, outPath = ".")

# S4 method for MetaboProfile
exportPeakInfo(x, outPath = ".")

exportModellingMetrics(x, outPath = ".")

# S4 method for Analysis
exportModellingMetrics(x, outPath = ".")

exportModellingImportance(x, outPath = ".")

# S4 method for Analysis
exportModellingImportance(x, outPath = ".")

exportModelling(x, outPath = ".")

# S4 method for Analysis
exportModelling(x, outPath = ".")

exportCorrelations(x, outPath = ".")

# S4 method for Analysis
exportCorrelations(x, outPath = ".")

exportAssignments(x, outPath = ".")

# S4 method for Assignment
exportAssignments(x, outPath = ".")

exportSummarisedAssignments(x, outPath = ".")

# S4 method for Assignment
exportSummarisedAssignments(x, outPath = ".")

exportConstruction(x, outPath = ".")

# S4 method for Construction
exportConstruction(x, outPath = ".")

exportSummarisedConstruction(x, outPath = ".")

# S4 method for Construction
exportSummarisedConstruction(x, outPath = ".")

export(x, outPath = ".", ...)

# S4 method for Binalysis
export(x, outPath = ".")

# S4 method for MetaboProfile
export(x, outPath = ".")

# S4 method for AnalysisData
export(x, outPath = ".", idx = "name", prefix = "analysis")

# S4 method for Analysis
export(x, outPath = ".", type = "raw", idx = "name")

# S4 method for Assignment
export(x, outPath = ".")

# S4 method for Construction
export(x, outPath = ".")

Arguments

x

S4 object of class Binalysis, MetaboProfile, Analysis or Assignment,

outPath

directory path to export to.

...

arguments to pass to relevant method

idx

sample information column name to use as sample IDs

prefix

file name prefix description

type

data type to extract. raw or pre-treated

Value

A character vector of exported file paths.

Examples

## Retrieve file paths and sample information for example data
files <- metaboData::filePaths('FIE-HRMS','BdistachyonEcotypes')[1:2]

info <- metaboData::runinfo('FIE-HRMS','BdistachyonEcotypes')[1:2,]

## Perform spectral binning
analysis <- binneR::binneRlyse(files, 
                               info, 
                               parameters = binneR::detectParameters(files))
#> binneR v2.6.3 Fri Jul 21 17:28:09 2023
#> ________________________________________________________________________________
#> Scans: 5:14 
#> ________________________________________________________________________________
#> Reading raw data
#> Gathering bins
#> Removing single scan events
#> Averaging intensities across scans
#> Calculating bin metrics
#> Calculating accurate m/z
#> Building intensity matrix
#> Gathering file headers
#> 
#> Completed! [2.3S]

## Export spectrally binned data
export(analysis,outPath = tempdir())
#> [1] "/tmp/RtmpDgxoTw/sample_information.csv"          
#> [2] "/tmp/RtmpDgxoTw/accurate_data.csv"               
#> [3] "/tmp/RtmpDgxoTw/negative_mode_processed_data.csv"
#> [4] "/tmp/RtmpDgxoTw/positive_mode_processed_data.csv"

## Perform data pre-treatment and modelling
p <- metabolyseR::analysisParameters(c('pre-treatment','modelling'))
metabolyseR::parameters(p,'pre-treatment') <- metabolyseR::preTreatmentParameters(
   list(occupancyFilter = 'maximum',
        transform = 'TICnorm')
)
metabolyseR::parameters(p,'modelling') <- metabolyseR::modellingParameters('anova')
metabolyseR::changeParameter(p,'cls') <- 'day'
analysis <- metabolyseR::metabolyse(metaboData::abr1$neg[,1:200],
                      metaboData::abr1$fact,
                      p)
#> 
#> metabolyseR  v0.15.1 Fri Jul 21 17:28:12 2023
#> ________________________________________________________________________________
#> Parameters:
#> pre-treatment
#> 	occupancyFilter
#> 		maximum
#> 			cls = day
#> 			occupancy = 2/3
#> 	transform
#> 		TICnorm
#> 
#> modelling
#> 	anova
#> 		cls = day
#> 		pAdjust = bonferroni
#> 		comparisons = list()
#> 		returnModels = FALSE
#> ________________________________________________________________________________
#> Pre-treatment 
#> 
Pre-treatment 	 [0.6S]
#> Modelling 
#> 
Modelling 	 [0.4S]
#> ________________________________________________________________________________
#> 
#> Complete! [1S]
                      
## Export pre-treated data and modelling results
export(analysis,outPath = tempdir())
#> All objects contained within supplied list that are not of class RandomForest will be ignored.
#> [1] "/tmp/RtmpDgxoTw/raw_sample_information.csv"      
#> [2] "/tmp/RtmpDgxoTw/raw_data.csv"                    
#> [3] "/tmp/RtmpDgxoTw/modelling_importance_metrics.csv"

## Perform molecular formula assignment
future::plan(future::sequential)
p <- assignments::assignmentParameters('FIE-HRMS')
assignments <- assignments::assignMFs(assignments::feature_data,p)
#> 
#> assignments v1.0.0 Fri Jul 21 17:28:13 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.8S]
#> Calculating relationships 
#> Calculating relationships 	 [2.8S]
#> Adduct & isotopic assignment 
#> generating molecular formulas…

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

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

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

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

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

## Export molecular formula assignment results
export(assignments,outPath = tempdir())
#> [1] "/tmp/RtmpDgxoTw/assignments.csv"           
#> [2] "/tmp/RtmpDgxoTw/assigned_data.csv"         
#> [3] "/tmp/RtmpDgxoTw/summarised_assignments.csv"

## Perform consensus structural classification
structural_classifications <- construction::construction(assignments)
#> 2 MFs to retrieve out of 2
#> 
#> C6H8O7
#> Searching KEGG...
#> 14 hits returned
#> Retrieving classifications for 14 InChIKeys...
#> ✔ KRKNYBCHXYNGOX-UHFFFAOYSA-N
#> ✔ ODBLHEXUDAPZAU-UHFFFAOYSA-N
#> ✔ ODBLHEXUDAPZAU-ZAFYKAAXSA-N
#> ✔ QUURPCHWPQNNGL-ZAFYKAAXSA-N
#> ✔ RXMWXENJQAINCC-DMTCNVIQSA-N
#> ✔ CIOXZGOUEYHNBF-UHFFFAOYSA-N
#> ✔ QUURPCHWPQNNGL-OKKQSCSOSA-N
#> ✔ GJQWCDSAOUMKSE-STHAYSLISA-N
#> ✔ ODBLHEXUDAPZAU-OKKQSCSOSA-N
#> ✔ YLKFQNUGXOLRNI-KXMYSMCESA-N
#> ✔ YLKFQNUGXOLRNI-QDQPNEQZSA-N
#> ✔ XECPAIJNBXCOBO-LKELSTGYSA-N
#> ✔ QUURPCHWPQNNGL-FONMRSAGSA-N
#> ✔ XECPAIJNBXCOBO-MMPJQOAZSA-N
#> 14 classifications returned
#> Exporting to /tmp/RtmpDgxoTw
#> 
#> C6H9NO7
#> Searching KEGG...
#> 0 hits returned
#> Exporting to /tmp/RtmpDgxoTw
#> 
#> Complete!

## Export consensus structural classification results
export(structural_classifications,outPath = tempdir())
#> [1] "/tmp/RtmpDgxoTw/consensus_structural_classifications.csv"           
#> [2] "/tmp/RtmpDgxoTw/summarised_consensus_structural_classifications.csv"