Skip to content

Commit

Permalink
update documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
jeffkimbrel committed Sep 29, 2023
1 parent b8a6b4b commit 6a37cd0
Show file tree
Hide file tree
Showing 11 changed files with 52 additions and 51 deletions.
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Package: qSIP2
Title: qSIP Analysis
Version: 0.4.5.9009
Version: 0.4.5.9010
Authors@R:
person("Jeff", "Kimbrel", , "[email protected]", role = c("aut", "cre"),
comment = c(ORCID = "YOUR-ORCID-ID"))
Expand Down
13 changes: 5 additions & 8 deletions R/add_isotopolog_label.R
Original file line number Diff line number Diff line change
@@ -1,19 +1,16 @@
#' Add isotopolog_label to data
#' Add isotopolog_label to source data
#'
#' To convert from an isotope only dataframe to one with both isotope and
#' isotopolog_label to satisfy MISIP requirements
#'
#' @param data Sample metadata (dataframe)
#' @param isotope Column name with isotope data (string, default: "isotope")
#' @param data (*dataframe*) Sample metadata
#' @param isotope (*string, default: "isotope"*) Column name with isotope data
#'
#' @export
#'
#' @keywords sample_data
#' @family "Source Data"
#'
#' @note This function also renames your isotope column to "isotope", if it
#' isn't already.
#'
#' @return A dataframe with `isotopolog_label` column added and `isotope` column
#' @returns A dataframe with `isotopolog_label` column added and `isotope` column
#' modified

add_isotopolog_label = function(data, isotope = "isotope") {
Expand Down
10 changes: 6 additions & 4 deletions R/add_taxonomy.R
Original file line number Diff line number Diff line change
@@ -1,13 +1,15 @@
#' Add a taxonomy table to qSIP abundance data
#'
#' @param feature_object An object of `qsip_feature_data` class
#' @param taxa A taxa table
#' @param id The column name for the taxa ids that match the ids in the
#' @param feature_object (*qsip_feature_object*) An object of `qsip_feature_data` class
#' @param taxa (*dataframe*) A taxa table
#' @param id (*string*) The column name for the taxa ids that match the ids in the
#' abundance table
#'
#' @export
#'
#' @keywords abundance
#' @family "Feature Data"
#'
#' @returns An updated `qsip_feature_object` with the taxonomy slot populated with a taxonomy dataframe.

add_taxonomy <- function(feature_object, taxa, feature_id) {

Expand Down
6 changes: 3 additions & 3 deletions R/gradient_pos_density_validation.R
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
#' Check the validity of density values
#'
#' @param gradient_pos_density Density value or values (string(s))
#' @param high A high limit for valid density values (numeric, default: 1.8)
#' @param low A low limit for valid density values (numeric, default: 1.55)
#' @param gradient_pos_density (*string or strings*) Density value or values
#' @param high (*numeric, default: 1.8*) A high limit for valid density values
#' @param low (*numeric, default: 1.55*) A low limit for valid density values
#'
#' @return Returns `NULL` if the density values are valid, or a printed error
#'
Expand Down
6 changes: 3 additions & 3 deletions R/gradient_position_validation.R
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,13 @@
#' Valid gradient positions are integers. The value can be `-1` to represent
#' "bulk" or non-qSIP samples.
#'
#' @param gradient_position Gradient position value or values (string(s))
#' @param gradient_position (*string or strings*) Gradient position value or values
#'
#' @return Returns `NULL` if the gradient position values are valid, or a
#' @returns `NULL` if the gradient position values are valid, or a
#' printed error
#'
#' @export
#'


gradient_position_validation = function(gradient_position) {
if (is.numeric(gradient_position)) {
Expand Down
8 changes: 3 additions & 5 deletions R/isotope_validation.R
Original file line number Diff line number Diff line change
@@ -1,23 +1,21 @@
#' Check the validity of an isotope string
#'
#' @param isotope Isotope value or values (string(s))
#' @param isotope_list Isotopes to check against (strings, default: c("12C", "13C", "14N", "15N", "16O", "18O"))
#' @param isotope (*string or strings* Isotope value or values
#' @param isotope_list (*strings, default: c("12C", "13C", "14N", "15N", "16O", "18O")*) Isotopes to check against
#'
#' @return Returns `NULL` if the isotope strings are valid, or a printed error
#' @returns Returns `NULL` if the isotope strings are valid, or a printed error
#'
#' @export
#'
#' @note The isotope_list may change if isotopolog_label stays a thing. Only the "heavy" isotopes will be allowed.


isotope_validation = function(isotope, isotope_list = c("12C", "13C", "14N", "15N", "16O", "18O")) {

if (length(setdiff(isotope, isotope_list)) == 0) {
return(NULL)
} else {
for (error in setdiff(isotope, isotope_list)) {
message(glue::glue(crayon::red("Invalid isotope found: {error}")))

}
return("Please fix the isotope names and try again")
}
Expand Down
6 changes: 3 additions & 3 deletions R/qsip_feature_data.R
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@
#'
#' A class to hold and validate a feature abundance table
#'
#' @slot data A dataframe or tibble
#' @slot feature_id Column name with unique taxa IDs
#' @slot data (*dataframe*) ASV/OTU table or equivalent
#' @slot feature_id (*string*) Column name with unique taxa IDs
#'
#' @export
#' @family "qSIP classes"
#'
#' @keywords object
#' @returns A `qsip_feature_data` that holds a validated feature abundance table.
#' @returns A validated object of the `qsip_feature_data` type

qsip_feature_data <- S7::new_class(
"qsip_feature_data",
Expand Down
18 changes: 9 additions & 9 deletions R/qsip_sample_data.R
Original file line number Diff line number Diff line change
Expand Up @@ -2,21 +2,21 @@
#'
#' A class to hold and validate sample data.
#'
#' @slot data A dataframe or tibble
#' @slot sample_id The unique ID for the sample/fraction
#' @slot source_mat_id The unique ID for the biological subject or replicate
#' @slot gradient_position Column name with the fraction position
#' @slot gradient_pos_density Column name with the gradient density
#' @slot gradient_pos_amt Column name with a total amount per fraction, either
#' @slot data (*dataframe*) Metadata for samples/fractions
#' @slot sample_id (*string*) The unique sample ID
#' @slot source_mat_id (*string*) The unique ID for the biological subject or replicate
#' @slot gradient_position (*string*) Column name with the fraction position
#' @slot gradient_pos_density (*string*) Column name with the gradient density
#' @slot gradient_pos_amt (*string*) Column name with a total amount per fraction, either
#' qPCR copies or DNA
#' @slot gradient_pos_rel_amt Column name with the relative fraction abundance
#' @slot gradient_pos_rel_amt (*string*) Column name with the relative fraction abundance
#' compared to the total
#' @slot fraction_volume The volume loaded onto the column. Required if the `gradient_pos_amt` is reported as a concentration
#' @slot fraction_volume (*string*) The volume loaded onto the column. Required if the `gradient_pos_amt` is reported as a concentration
#'
#' @export
#' @family "qSIP classes"
#'
#' @keywords object
#' @returns A validated object of the `qsip_sample_data` type

qsip_sample_data <- S7::new_class(
"qsip_sample_data",
Expand Down
11 changes: 5 additions & 6 deletions R/qsip_source_data.R
Original file line number Diff line number Diff line change
Expand Up @@ -6,17 +6,16 @@
#' to also calculate growth then you should use the `qsip_source_data_growth`
#' object.
#'
#' @slot data Source metadata (dataframe)
#' @slot isotope Isotope name (string)
#' @slot isotopolog Isotopolog data (string)
#' @slot source_mat_id The unique ID for the biological subject or source (string)
#' @slot data (*dataframe*) Source metadata
#' @slot isotope (*string*) Isotope name
#' @slot isotopolog (*string*) Isotopolog data
#' @slot source_mat_id (*string*) The unique ID for the biological subject or source
#'
#' @export
#'
#' @keywords object
#' @family "qSIP classes"
#'
#' @return A `qsip_source_data` object
#' @return A validated `qsip_source_data` object

qsip_source_data <- S7::new_class(
"qsip_source_data",
Expand Down
15 changes: 12 additions & 3 deletions _pkgdown.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,16 +9,25 @@ reference:
- qsip_source_data
- qsip_sample_data
- qsip_feature_data

- title: Source Data
contents:
- add_isotopolog_data
- remove_isotopolog_data
- show_comparison_groups

- title: Sample Data
contents:
- has_keyword("sample_data")
- add_gradient_pos_rel_amt
- title: Abundance Data

- title: Feature Data
contents:
- has_keyword("abundance")
- add_taxonomy

- title: Data
contents:
- has_keyword("data")

- title: internal
contents:
- abundance_validation
Expand Down
8 changes: 2 additions & 6 deletions man/add_isotopolog_label.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 6a37cd0

Please sign in to comment.