Assignment accessors
accessors.Rd
Access methods for Assignment
S4 class
Usage
featureData(assignment)
# S4 method for Assignment
featureData(assignment)
correlations(assignment)
# S4 method for Assignment
correlations(assignment)
relationships(assignment)
# S4 method for Assignment
relationships(assignment)
iterations(assignment)
# S4 method for Assignment
iterations(assignment)
graph(assignment, iteration, type = c("selected", "all"))
# S4 method for Assignment
graph(assignment, iteration, type = c("selected", "all"))
components(assignment, iteration, type = c("selected", "all"))
# S4 method for Assignment
components(assignment, iteration, type = c("selected", "all"))
featureComponents(assignment, feature, type = c("selected", "all"))
# S4 method for Assignment
featureComponents(assignment, feature, type = c("selected", "all"))
component(assignment, component, iteration, type = c("selected", "all"))
# S4 method for Assignment
component(assignment, component, iteration, type = c("selected", "all"))
assignments(assignment)
# S4 method for Assignment
assignments(assignment)
assignedData(assignment)
# S4 method for Assignment
assignedData(assignment)
summariseAssignments(assignment)
# S4 method for Assignment
summariseAssignments(assignment)
Arguments
- assignment
S4 object of class Assignment
- iteration
the assignment iteration
- type
the graph type to return.
filtered
returns the assignment graph after component selection.all
returns all assignment components.- feature
feature information to extract
- component
component number to extract
Details
featureData
- Return the initially specifed m/z feature data.correlations
- Return the correlation analysis results.relationships
- Return the calculated relationships.iterations
- Return the assignment iteration performed.graph
- Return a selected graph.components
- Return the component information for an assignment iteration.featureComponents
- Return the component information for a selected feature.component
- Extract a component graph.assignments
- Return the molecular formulas assigned to the m/z features.assignedData
- Return the m/z peak intensity matrix with the molecular formula assignments included in the column names.summariseAssignments
- Return a tibble of the assignments summarised by molecular formula.
Examples
plan(future::sequential)
p <- assignmentParameters('FIE-HRMS')
mf_assignments <- assignMFs(feature_data,p)
#>
#> assignments v1.0.2 Thu Jan 11 15:06:54 2024
#> ________________________________________________________________________________
#> Assignment Parameters:
#>
#> Technique: FIE-HRMS
#> Max M: 800
#> MF rank threshold: 3
#> PPM threshold: 4
#> 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+Cl37]1-, [M+K-2H]1-, [M-2H]2-, [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
#> 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.2S]
#> Calculating relationships …
#> Calculating relationships ✔ [2S]
#> Adduct & isotopic assignment …
#> generating molecular formulas…
#> generating molecular formulas ✔ [8.5S]
#> iteration 1…
#> iteration 1 ✔ [0.5S]
#> iteration 2…
#> Adduct & isotopic assignment ✔ [9.6S]
#> Transformation assignment…
#> iteration 1 …
#> iteration 1 ✔ [1.2S]
#> iteration 2 …
#> Transformation assignment ✔ [1.2S]
#> ________________________________________________________________________________
#>
#> Complete! [13.4S]
## Return feature data
featureData(mf_assignments)
#> # A tibble: 60 × 10
#> n191.01962 n192.02306 n193.02388 n226.99693 n228.97636 n228.99274 n231.00069
#> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl>
#> 1 0.109 0.00401 0.000609 0.000417 0.00135 0.0000912 0.00122
#> 2 0.0955 0.00346 0.000466 0.000306 0.00110 0.0000847 0.000831
#> 3 0.109 0.00418 0.000637 0.000294 0.00113 0.0000879 0.00126
#> 4 0.102 0.00360 0.000516 0.000366 0.00107 0.000107 0.00113
#> 5 0.0956 0.00315 0.000520 0.000487 0.000873 0.000111 0.000840
#> 6 0.0940 0.00350 0.000440 0.000311 0.00112 0.0000228 0.00106
#> 7 0.128 0.00578 0.000784 0.000333 0.00113 0.000137 0.00140
#> 8 0.0890 0.00345 0.000483 0.000365 0.00104 0.000100 0.000951
#> 9 0.0887 0.00317 0.000469 0.000463 0.000829 0.000151 0.000922
#> 10 0.0996 0.00369 0.000539 0.000490 0.000866 0.000193 0.00100
#> # ℹ 50 more rows
#> # ℹ 3 more variables: n384.0495 <dbl>, n385.04874 <dbl>, p208.04518 <dbl>
## Return correlations
correlations(mf_assignments)
#> # A tibble: 10 × 12
#> Feature1 Feature2 Mode1 Mode2 `m/z1` `m/z2` RetentionTime1 RetentionTime2
#> <chr> <chr> <chr> <chr> <dbl> <dbl> <dbl> <dbl>
#> 1 n191.01962 p208.04518 n p 191. 208. NA NA
#> 2 n191.01962 n192.02306 n n 191. 192. NA NA
#> 3 n192.02306 p208.04518 n p 192. 208. NA NA
#> 4 n231.00069 n384.0495 n n 231. 384. NA NA
#> 5 n226.99693 n228.99274 n n 227. 229. NA NA
#> 6 n191.01962 n193.02388 n n 191. 193. NA NA
#> 7 n193.02388 p208.04518 n p 193. 208. NA NA
#> 8 n192.02306 n193.02388 n n 192. 193. NA NA
#> 9 n191.01962 n231.00069 n n 191. 231. NA NA
#> 10 n231.00069 p208.04518 n p 231. 208. NA NA
#> # ℹ 4 more variables: RetentionTimeDiff <dbl>, log2IntensityRatio <dbl>,
#> # coefficient <dbl>, ID <int>
## Return relationships
relationships(mf_assignments)
#> # A tibble: 35 × 19
#> Feature1 Feature2 Mode1 Mode2 `m/z1` `m/z2` RetentionTime1 RetentionTime2
#> <chr> <chr> <chr> <chr> <dbl> <dbl> <dbl> <dbl>
#> 1 n191.01962 p208.04518 n p 191. 208. NA NA
#> 2 n191.01962 p208.04518 n p 191. 208. NA NA
#> 3 n191.01962 p208.04518 n p 191. 208. NA NA
#> 4 n191.01962 p208.04518 n p 191. 208. NA NA
#> 5 n191.01962 p208.04518 n p 191. 208. NA NA
#> 6 n191.01962 p208.04518 n p 191. 208. NA NA
#> 7 n191.01962 p208.04518 n p 191. 208. NA NA
#> 8 n191.01962 n192.02306 n n 191. 192. NA NA
#> 9 n191.01962 n192.02306 n n 191. 192. NA NA
#> 10 n191.01962 n192.02306 n n 191. 192. NA NA
#> # ℹ 25 more rows
#> # ℹ 11 more variables: RetentionTimeDiff <dbl>, Adduct1 <chr>, Adduct2 <chr>,
#> # Isotope1 <chr>, Isotope2 <chr>, Transformation1 <chr>,
#> # Transformation2 <chr>, log2IntensityRatio <dbl>, coefficient <dbl>,
#> # Error <dbl>, ID <int>
## Return the available iterations
iterations(mf_assignments)
#> [1] "A&I1" "T1"
## Return a selected graph
graph(mf_assignments,'A&I1')
#> # A tbl_graph: 5 nodes and 4 edges
#> #
#> # A directed acyclic simple graph with 2 components
#> #
#> # Node Data: 5 × 21 (active)
#> name Feature RetentionTime Isotope Adduct MF `Theoretical M` `Measured M`
#> <chr> <chr> <dbl> <chr> <chr> <chr> <dbl> <dbl>
#> 1 n191.… n191.0… NA NA [M-H]… C6H8… 192. 192.
#> 2 n192.… n192.0… NA 13C [M-H]… C6H8… 192. 192.
#> 3 n193.… n193.0… NA 18O [M-H]… C6H8… 192. 192.
#> 4 n226.… n226.9… NA NA [M+Cl… C6H8… 192. 192.
#> 5 n228.… n228.9… NA NA [M+Cl… C6H8… 192. 192.
#> # ℹ 13 more variables: `Theoretical m/z` <dbl>, `Measured m/z` <dbl>,
#> # `PPM error` <dbl>, `MF Plausibility (%)` <dbl>, AIS <dbl>, ID <int>,
#> # Component <dbl>, Size <dbl>, Nodes <int>, Degree <dbl>, Density <dbl>,
#> # `Component Plausibility` <dbl>, Weight <dbl>
#> #
#> # Edge Data: 4 × 23
#> from to Feature1 Feature2 Mode1 Mode2 `m/z1` `m/z2` RetentionTime1
#> <int> <int> <chr> <chr> <chr> <chr> <dbl> <dbl> <dbl>
#> 1 1 2 n191.01962 n192.02306 n n 191. 192. NA
#> 2 1 3 n191.01962 n193.02388 n n 191. 193. NA
#> 3 2 3 n192.02306 n193.02388 n n 192. 193. NA
#> # ℹ 1 more row
#> # ℹ 14 more variables: RetentionTime2 <dbl>, RetentionTimeDiff <dbl>,
#> # Adduct1 <chr>, Adduct2 <chr>, Isotope1 <chr>, Isotope2 <chr>,
#> # Transformation1 <chr>, Transformation2 <chr>, log2IntensityRatio <dbl>,
#> # coefficient <dbl>, Error <dbl>, ID <int>, MF1 <chr>, MF2 <chr>
## Return a component information for a selected graph
components(mf_assignments,'A&I1')
#> # A tibble: 2 × 6
#> Component Size Nodes Degree Density `Component Plausibility`
#> <dbl> <dbl> <int> <dbl> <dbl> <dbl>
#> 1 1 3 3 2 1 0.00107
#> 2 11 1 2 1 1 0.0000981
## Return a component information for a selected feature
featureComponents(mf_assignments,'n191.01962')
#> # A tibble: 2 × 22
#> Iteration name Feature RetentionTime Isotope Adduct MF `Theoretical M`
#> <chr> <chr> <chr> <dbl> <chr> <chr> <chr> <dbl>
#> 1 A&I1 n191.019… n191.0… NA NA [M-H]… C6H8… 192.
#> 2 T1 n191.019… n191.0… NA NA [M-H]… C6H8… 192.
#> # ℹ 14 more variables: `Measured M` <dbl>, `Theoretical m/z` <dbl>,
#> # `Measured m/z` <dbl>, `PPM error` <dbl>, `MF Plausibility (%)` <dbl>,
#> # AIS <dbl>, ID <int>, Component <dbl>, Size <dbl>, Nodes <int>,
#> # Degree <dbl>, Density <dbl>, `Component Plausibility` <dbl>, Weight <dbl>
## Extract a component graph
component(mf_assignments,1,'A&I1')
#> # A tbl_graph: 3 nodes and 3 edges
#> #
#> # A directed acyclic simple graph with 1 component
#> #
#> # Node Data: 3 × 21 (active)
#> name Feature RetentionTime Isotope Adduct MF `Theoretical M` `Measured M`
#> <chr> <chr> <dbl> <chr> <chr> <chr> <dbl> <dbl>
#> 1 n191.… n191.0… NA NA [M-H]… C6H8… 192. 192.
#> 2 n192.… n192.0… NA 13C [M-H]… C6H8… 192. 192.
#> 3 n193.… n193.0… NA 18O [M-H]… C6H8… 192. 192.
#> # ℹ 13 more variables: `Theoretical m/z` <dbl>, `Measured m/z` <dbl>,
#> # `PPM error` <dbl>, `MF Plausibility (%)` <dbl>, AIS <dbl>, ID <int>,
#> # Component <dbl>, Size <dbl>, Nodes <int>, Degree <dbl>, Density <dbl>,
#> # `Component Plausibility` <dbl>, Weight <dbl>
#> #
#> # Edge Data: 3 × 23
#> from to Feature1 Feature2 Mode1 Mode2 `m/z1` `m/z2` RetentionTime1
#> <int> <int> <chr> <chr> <chr> <chr> <dbl> <dbl> <dbl>
#> 1 1 2 n191.01962 n192.02306 n n 191. 192. NA
#> 2 1 3 n191.01962 n193.02388 n n 191. 193. NA
#> 3 2 3 n192.02306 n193.02388 n n 192. 193. NA
#> # ℹ 14 more variables: RetentionTime2 <dbl>, RetentionTimeDiff <dbl>,
#> # Adduct1 <chr>, Adduct2 <chr>, Isotope1 <chr>, Isotope2 <chr>,
#> # Transformation1 <chr>, Transformation2 <chr>, log2IntensityRatio <dbl>,
#> # coefficient <dbl>, Error <dbl>, ID <int>, MF1 <chr>, MF2 <chr>
## Return assignments
assignments(mf_assignments)
#> # A tibble: 6 × 15
#> Name Feature RetentionTime Isotope Adduct MF `Theoretical M` `Measured M`
#> <chr> <chr> <dbl> <chr> <chr> <chr> <dbl> <dbl>
#> 1 n191.… n191.0… NA NA [M-H]… C6H8… 192. 192.
#> 2 n192.… n192.0… NA 13C [M-H]… C6H8… 192. 192.
#> 3 n193.… n193.0… NA 18O [M-H]… C6H8… 192. 192.
#> 4 n226.… n226.9… NA NA [M+Cl… C6H8… 192. 192.
#> 5 n228.… n228.9… NA NA [M+Cl… C6H8… 192. 192.
#> 6 p208.… p208.0… NA NA [M+H]… C6H9… 207. 207.
#> # ℹ 7 more variables: `Theoretical m/z` <dbl>, `Measured m/z` <dbl>,
#> # `PPM error` <dbl>, `MF Plausibility (%)` <dbl>, Mode <chr>,
#> # Component <dbl>, Iteration <chr>
## Return an m/z intensity matrix with the assignments included
## in the column names
assignedData(mf_assignments)
#> # A tibble: 60 × 10
#> `n191.01962 C6H8O7 [M-H]1-` n192.02306 C6H8O7 13C […¹ n193.02388 C6H8O7 18…²
#> <dbl> <dbl> <dbl>
#> 1 0.109 0.00401 0.000609
#> 2 0.0955 0.00346 0.000466
#> 3 0.109 0.00418 0.000637
#> 4 0.102 0.00360 0.000516
#> 5 0.0956 0.00315 0.000520
#> 6 0.0940 0.00350 0.000440
#> 7 0.128 0.00578 0.000784
#> 8 0.0890 0.00345 0.000483
#> 9 0.0887 0.00317 0.000469
#> 10 0.0996 0.00369 0.000539
#> # ℹ 50 more rows
#> # ℹ abbreviated names: ¹`n192.02306 C6H8O7 13C [M-H]1-`,
#> # ²`n193.02388 C6H8O7 18O [M-H]1-`
#> # ℹ 7 more variables: `n226.99693 C6H8O7 [M+Cl]1-` <dbl>, n228.97636 <dbl>,
#> # `n228.99274 C6H8O7 [M+Cl37]1-` <dbl>, n231.00069 <dbl>, n384.0495 <dbl>,
#> # n385.04874 <dbl>, `p208.04518 C6H9NO7 [M+H]1+` <dbl>
## Return the assignments summarised by molecular formula
summariseAssignments(mf_assignments)
#> # A tibble: 2 × 4
#> MF Features Isotopes & Ionisatio…¹ Count
#> <chr> <chr> <chr> <int>
#> 1 C6H8O7 n191.01962; n192.02306; n193.02388; n226… " [M-H]1-; 13C [M-H]1… 5
#> 2 C6H9NO7 p208.04518 " [M+H]1+" 1
#> # ℹ abbreviated name: ¹`Isotopes & Ionisation Products`