Skip to content

Commit

Permalink
Fixed error with accessing ratio col names and updated vignette
Browse files Browse the repository at this point in the history
  • Loading branch information
[email protected] authored and clabornd committed Sep 21, 2023
1 parent c17f80a commit 4fad253
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 9 deletions.
10 changes: 5 additions & 5 deletions R/colname_methods.R
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ getOCRatioColName <- function(ftmsObj) {
if (!inherits(ftmsObj, "ftmsData")) {
stop("ftmsObj must be of type ftmsData")
}
return(attr(ftmsObj, "cnames")$ratio_cnames["O:C"])
return(getRatioColName(ftmsObj, "O:C"))
}

#' Set the name of the O:C ratio column
Expand Down Expand Up @@ -197,7 +197,7 @@ getHCRatioColName <- function(ftmsObj) {
if (!inherits(ftmsObj, "ftmsData")) {
stop("ftmsObj must be of type ftmsData")
}
return(attr(ftmsObj, "cnames")$ratio_cnames["H:C"])
return(getRatioColName(ftmsObj, "H:C"))
}

#' Set the name of the H:C ratio column
Expand Down Expand Up @@ -233,7 +233,7 @@ getNCRatioColName <- function(ftmsObj) {
if (!inherits(ftmsObj, "ftmsData")) {
stop("ftmsObj must be of type ftmsData")
}
return(attr(ftmsObj, "cnames")$ratio_cnames["N:C"])
return(getRatioColName(ftmsObj, "N:C"))
}

#' Set the name of the N:C ratio column
Expand Down Expand Up @@ -269,7 +269,7 @@ getPCRatioColName <- function(ftmsObj) {
if (!inherits(ftmsObj, "ftmsData")) {
stop("ftmsObj must be of type ftmsData")
}
return(attr(ftmsObj, "cnames")$ratio_cnames["P:C"])
return(getRatioColName(ftmsObj, "P:C"))
}

#' Set the name of the P:C ratio column
Expand Down Expand Up @@ -305,7 +305,7 @@ getNPRatioColName <- function(ftmsObj) {
if (!inherits(ftmsObj, "ftmsData")) {
stop("ftmsObj must be of type ftmsData")
}
return(attr(ftmsObj, "cnames")$ratio_cnames["N:P"])
return(getRatioColName(ftmsObj, "N:P"))
}

#' Set the name of the N:P ratio column
Expand Down
7 changes: 3 additions & 4 deletions vignettes/ftmsRanalysis.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ str(ftms12T_fdata)
```

## e_meta (Molecular Identification Data)
The emeta object is a data frame with one row per peak and columns containing other meta data. Either a column giving the molecular formula or elemental count columns (currently the elements C, H, O, S, N, and P are supported) are required. It must have an ID column corresponding to the ID column in edata. If information about isotopic peaks is available and specified, these peaks are currently filtered from the data upon peakData object creation.
The emeta object is a data frame with one row per peak and columns containing other meta data. Either a column giving the molecular formula or elemental count columns are required. It must have an ID column corresponding to the ID column in edata. If information about isotopic peaks is available and specified, these peaks are currently filtered from the data upon peakData object creation.

```{r }
data("ftms12T_emeta")
Expand All @@ -90,9 +90,8 @@ str(ftms12T_emeta)
```{r}
peakObj <- as.peakData(ftms12T_edata, ftms12T_fdata, ftms12T_emeta,
edata_cname="Mass", fdata_cname="SampleID",
mass_cname="Mass", c_cname="C", h_cname="H",
o_cname="O", n_cname="N", s_cname="S",
p_cname="P", isotopic_cname = "C13",
mass_cname="Mass", element_col_names = list("C"="C", "H"="H", "O"="O", "N"="N", "S"="S", "P"="P"),
isotopic_cname = "C13",
isotopic_notation = "1")
peakObj
```
Expand Down

0 comments on commit 4fad253

Please sign in to comment.