Skip to content

Commit

Permalink
improve linting
Browse files Browse the repository at this point in the history
  • Loading branch information
d-callan committed Apr 17, 2024
1 parent 8df79a1 commit 1d69dd7
Show file tree
Hide file tree
Showing 10 changed files with 163 additions and 31 deletions.
7 changes: 6 additions & 1 deletion R/methods-ComputeResult.R
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,12 @@ mergeComputeResultAndMetadata <- function(computeResult, dataset, metadataVariab
#' method='shannon',
#' verbose=FALSE
#' )
#' alphaDivDT <- getComputeResultWithMetadata(alphaDivOutput, microbiomeData::DiabImmune, metadataVariables = c('country', 'delivery_mode'))
#'
#' alphaDivDT <- getComputeResultWithMetadata(
#' alphaDivOutput,
#' microbiomeData::DiabImmune,
#' metadataVariables = c('country', 'delivery_mode')
#' )
#' @param object A Microbiome Dataset
#' @param dataset The MbioDataset, AbundanceData or Collection object from which the compute result was obtained.
#' @param format The format you want the compute result in. Currently only "data.table" is supported.
Expand Down
30 changes: 25 additions & 5 deletions R/methods-MbioDataset.R
Original file line number Diff line number Diff line change
Expand Up @@ -133,11 +133,31 @@ setMethod("updateCollectionName", "MbioDataset", function(object, oldName, newNa
#' Get a collection from the Microbiome Dataset. The collection will be returned
#' as an AbundanceData, phyloseq, or Collection object.
#'
#' @examples
#' genus <- getCollection(microbiomeData::DiabImmune, "16S (V4) Genus")
#' genus_phyloseq <- getCollection(microbiomeData::DiabImmune, "16S (V4) Genus", format = "phyloseq")
#' genus_continuous <- getCollection(microbiomeData::DiabImmune, "16S (V4) Genus", continuousMetadataOnly = TRUE) ## to pass to correlation method
#' genus_collection <- getCollection(microbiomeData::DiabImmune, "16S (V4) Genus", format = "Collection") ## with no metadata
#' @examples
#' genus <- getCollection(
#' microbiomeData::DiabImmune,
#' "16S (V4) Genus"
#' )
#'
#' genus_phyloseq <- getCollection(
#' microbiomeData::DiabImmune,
#' "16S (V4) Genus",
#' format = "phyloseq"
#' )
#'
#' ## to pass to correlation method, we want only continuous metadata
#' genus_continuous <- getCollection(
#' microbiomeData::DiabImmune,
#' "16S (V4) Genus",
#' continuousMetadataOnly = TRUE
#' )
#'
#' ## with no metadata
#' genus_collection <- getCollection(
#' microbiomeData::DiabImmune,
#' "16S (V4) Genus",
#' format = "Collection"
#' )
#' @param object A Microbiome Dataset
#' @param collectionName The name of the collection to return
#' @param format The format of the collection to return. Currently supported options are "AbundanceData", "phyloseq" and "Collection".
Expand Down
61 changes: 51 additions & 10 deletions R/reexports-microbiomeComputations.R
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,10 @@
#' This function returns abundances, ranked by a selected ranking function
#'
#' @examples
#' rankedAbundOutput <- rankedAbundance(getCollection(microbiomeData::DiabImmune, "16S (V4) Genus"), method = "median")
#' rankedAbundOutput <- rankedAbundance(
#' getCollection(microbiomeData::DiabImmune, "16S (V4) Genus"),
#' method = "median"
#' )
#' @param data AbundanceData object
#' @param method string defining the ranking strategy by which to order the taxa. Accepted values are 'median','max','q3',and 'variance'. Note that taxa that return a value of 0 for a given method will not be included in the results.
#' @param cutoff integer indicating the maximium number of taxa to be kept after ranking.
Expand All @@ -19,7 +22,10 @@ microbiomeComputations::rankedAbundance
#' This function returns alpha diversity values for each sample.
#'
#' @examples
#' alphaDivOutput <- alphaDiv(getCollection(microbiomeData::DiabImmune, "16S (V4) Genus"), method = "shannon")
#' alphaDivOutput <- alphaDiv(
#' getCollection(microbiomeData::DiabImmune, "16S (V4) Genus"),
#' method = "shannon"
#' )
#' @param data AbundanceData object
#' @param method string defining the the alpha diversity method. Accepted values are 'shannon','simpson', and 'evenness'
#' @param verbose boolean indicating if timed logging is desired
Expand All @@ -34,7 +40,11 @@ microbiomeComputations::alphaDiv
#' This function returns pcoa coordinates calculated from the beta diversity dissimilarity matrix.
#'
#' @examples
#' betaDivOutput <- betaDiv(getCollection(microbiomeData::DiabImmune, "16S (V4) Genus"), method = "bray", k = 2)
#' betaDivOutput <- betaDiv(
#' getCollection(microbiomeData::DiabImmune, "16S (V4) Genus"),
#' method = "bray",
#' k = 2
#' )
#' @param data AbundanceData object
#' @param method string defining the the beta diversity dissimilarity method. Accepted values are 'bray','jaccard', and 'jsd'
#' @param k integer determining the number of pcoa axes to return
Expand All @@ -50,10 +60,28 @@ microbiomeComputations::betaDiv
#' This function returns correlation coefficients for variables in one dataset against variables in a second dataset
#'
#' @examples
#' diabImmune_genus <- getCollection(microbiomeData::DiabImmune, "16S (V4) Genus", continuousMetadataOnly = TRUE)
#' correlationDT <- correlation(diabImmune_genus, method = 'spearman', format = 'data.table')
#' correlationOutput <- correlation(diabImmune_genus, method = 'spearman', format = 'ComputeResult')
#' alsoCorrelationDT <- getComputeResult(correlationOutput, "data.table")
#' diabImmune_genus <- getCollection(
#' microbiomeData::DiabImmune,
#' "16S (V4) Genus",
#' continuousMetadataOnly = TRUE
#' )
#'
#' correlationDT <- correlation(
#' diabImmune_genus,
#' method = 'spearman',
#' format = 'data.table'
#' )
#'
#' correlationOutput <- correlation(
#' diabImmune_genus,
#' method = 'spearman',
#' format = 'ComputeResult'
#' )
#'
#' alsoCorrelationDT <- getComputeResult(
#' correlationOutput,
#' "data.table"
#' )
#' @param data1 first dataset. A data.table
#' @param data2 second dataset. A data.table
#' @param method string defining the type of correlation to run.
Expand All @@ -74,9 +102,22 @@ veupathUtils::correlation
#' convenience wrapper around veupathUtils::correlation, with the exception that it additionally supports sparcc.
#'
#' @examples
#' correlationDT <- selfCorrelation(getCollection(microbiomeData::DiabImmune, "16S (V4) Genus"), method = 'sparcc', format = 'data.table')
#' correlationOutput <- selfCorrelation(getCollection(microbiomeData::DiabImmune, "16S (V4) Genus"), method = 'sparcc', format = 'ComputeResult')
#' alsoCorrelationDT <- getComputeResult(correlationOutput, "data.table")
#' correlationDT <- selfCorrelation(
#' getCollection(microbiomeData::DiabImmune, "16S (V4) Genus"),
#' method = 'sparcc',
#' format = 'data.table'
#' )
#'
#' correlationOutput <- selfCorrelation(
#' getCollection(microbiomeData::DiabImmune, "16S (V4) Genus"),
#' method = 'sparcc',
#' format = 'ComputeResult'
#' )
#'
#' alsoCorrelationDT <- getComputeResult(
#' correlationOutput,
#' "data.table"
#' )
#' @param data An AbundanceData object
#' @param method string defining the type of correlation to run. The currently supported values are 'spearman','pearson' and 'sparcc'
#' @param format string defining the desired format of the result. The currently supported values are 'data.table' and 'ComputeResult'.
Expand Down
5 changes: 4 additions & 1 deletion man/alphaDiv-methods.Rd

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

6 changes: 5 additions & 1 deletion man/betaDiv-methods.Rd

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

26 changes: 22 additions & 4 deletions man/correlation-methods.Rd

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

28 changes: 24 additions & 4 deletions man/getCollection.Rd

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

7 changes: 6 additions & 1 deletion man/getComputeResultWithMetadata.Rd

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

5 changes: 4 additions & 1 deletion man/rankedAbundance-methods.Rd

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

19 changes: 16 additions & 3 deletions man/selfCorrelation-methods.Rd

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

0 comments on commit 1d69dd7

Please sign in to comment.