Skip to content

Commit

Permalink
Documentation check for typos
Browse files Browse the repository at this point in the history
  • Loading branch information
andzajan committed Sep 10, 2019
1 parent 97412e1 commit ccaa3e2
Show file tree
Hide file tree
Showing 22 changed files with 157 additions and 138 deletions.
4 changes: 2 additions & 2 deletions R/checkPeakMatrix.R
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#' Check if peak matrix is in format features in rows, samples in columns
#' and that all cell contain numeric values.
#' and that all cells contain numeric values.
#'
#' All functions in pmp pacakge expect input peak matrix to have samples
#' as columns and measured features in rows. This function will check input
Expand All @@ -8,7 +8,7 @@
#' of samples in peak matrix.
#'
#' @param peak_data peak matrix
#' @param classes Vector of class labels
#' @param classes vector of class labels
#' @return matrix where samples are represented in columns and features in rows
#' @examples
#'
Expand Down
2 changes: 1 addition & 1 deletion R/data.R
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,5 @@
#'
#' @format List of testing data sets
#
#' @source N/A
#' @source https://www.ebi.ac.uk/metabolights/MTBLS79
"testData"
66 changes: 33 additions & 33 deletions R/filters.R
Original file line number Diff line number Diff line change
Expand Up @@ -10,27 +10,27 @@ NULL
#' This tool facilitates the removal of such features from the data matrix,
#' as defined using an appropriate blank' sample.
#'
#' @param df Peak intensity matrix
#' @param fold_change Minimum fold change between analytical and blank samples.
#' @param classes Vector of class labels
#' @param blank_label Class label used to identify blank samples
#' @param qc_label Class label for QC sample. If not NULL will use QC samples
#' @param df peak intensity matrix
#' @param fold_change minimum fold change between analytical and blank samples.
#' @param classes vector of class labels
#' @param blank_label class label used to identify blank samples
#' @param qc_label class label for QC sample. If not NULL will use QC samples
#'to calculate the mean intensity
#' @param remove Remove blank samples from peak matrix or not
#' @param fraction_in_blank Number between 0 to 1 to specify fraction in how
#' @param remove remove blank samples from peak matrix or not
#' @param fraction_in_blank number between 0 to 1 to specify fraction in how
#'many blanks peaks should be present
#' @return List of filtered peak intensity matrix and matrix with flags
#' @return list of filtered peak intensity matrix and matrix with flags
#'
#' @examples
#' attach (testData)
#' out <- filter_peaks_by_blank(df=testData$data, fold_change=1.2,
#' classes=testData$class, blank_label='Blank', qc_label=NULL,
#' remove=FALSE, fraction_in_blank=0)
#' classes=testData$class, blank_label='Blank', qc_label=NULL,
#' remove=FALSE, fraction_in_blank=0)
#'
#' @export

filter_peaks_by_blank <- function(df, fold_change, classes, blank_label,
qc_label=NULL, remove=TRUE, fraction_in_blank=0) {
qc_label=NULL, remove=TRUE, fraction_in_blank=0) {

df <- check_peak_matrix(peak_data=df, classes=classes)

Expand Down Expand Up @@ -86,26 +86,26 @@ qc_label=NULL, remove=TRUE, fraction_in_blank=0) {
#' relative proportion (minimum fraction) of samples containing non-missing
#' values.
#'
#' @param df Peak intensity matrix
#' @param min_frac Threshold of fraction of detection
#' @param classes Vector of class labels
#' @param method Method to use. 'QC' - withing QC samples, within' - within
#' @param df peak intensity matrix
#' @param min_frac threshold of fraction of detection
#' @param classes vector of class labels
#' @param method method to use. 'QC' - withing QC samples, within' - within
#'each sample class or across' - across all samples
#' @param qc_label Class label for QC sample
#' @param qc_label class label for QC sample
#'
#' @return List of filtered peak intensity matrix and matrix with flags
#' @return list of filtered peak intensity matrix and matrix with flags
#'
#' @examples
#' attach (testData)
#'
#' out <- filter_peaks_by_fraction(df=testData$data, min_frac=1,
#' classes=testData$class, method='QC', qc_label='QC')
#' classes=testData$class, method='QC', qc_label='QC')
#'
#' out <- filter_peaks_by_fraction(df=testData$data, min_frac=1,
#' classes=testData$class, method='across', qc_label='QC')
#' classes=testData$class, method='across', qc_label='QC')
#'
#' out <- filter_peaks_by_fraction(df=testData$data, min_frac=1,
#' classes=testData$class, method='within', qc_label='QC')
#' classes=testData$class, method='within', qc_label='QC')
#'
#' @export

Expand Down Expand Up @@ -153,10 +153,10 @@ filter_peaks_by_fraction <- function(df, min_frac, classes=NULL,

#' Remove features from peak intensity matrix
#'
#' Filter to remove features
#' Filter to remove features.
#'
#' @param df Peak intensity matrix
#' @param rem_index Logical vector containing TRUE vales for features to remove
#' @param df peak intensity matrix
#' @param rem_index logical vector containing TRUE vales for features to remove
#'
#' @return data frame, filtered peak intensity matrix
#'
Expand Down Expand Up @@ -187,16 +187,16 @@ remove_peaks <- function(df, rem_index) {
#' relative standard deviation of intensity values for a given feature within
#' specified QC samples.
#'
#' @param df Peak intensity matrix
#' @param max_rsd Threshold of QC RSD\% value
#' @param classes Vector of class labels
#' @param qc_label Class label for QC sample
#' @return List of filtered peak intensity matrix and matrix with flags
#' @param df peak intensity matrix
#' @param max_rsd threshold of QC RSD\% value
#' @param classes vector of class labels
#' @param qc_label class label for QC sample
#' @return list of filtered peak intensity matrix and matrix with flags
#' @examples
#'
#' attach (testData)
#' out <- filter_peaks_by_rsd(df=testData$data, max_rsd=20,
#' classes=testData$class, qc_label='QC')
#' classes=testData$class, qc_label='QC')
#'
#' @export

Expand Down Expand Up @@ -228,10 +228,10 @@ filter_peaks_by_rsd <- function(df, max_rsd, classes, qc_label) {
#' must first be addressed. This tool facilitates the removal of samples
#' containing a user-defined maximum percentage of missing values.
#'
#' @param df Peak intensity matrix
#' @param max_perc_mv Threshold of missing value percentage.
#' @param classes Vector of class labels
#' @return List of filtered peak intensity matrix and matrix with flags
#' @param df peak intensity matrix
#' @param max_perc_mv threshold of missing value percentage.
#' @param classes vector of class labels
#' @return list of filtered peak intensity matrix and matrix with flags
#'
#' @examples
#'
Expand Down
22 changes: 11 additions & 11 deletions R/glog_transformation.R
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

NULL

#' variance stabilising (extended) generalised logarithm transformation
#' Variance stabilising (extended) generalised logarithm transformation
#'
#' https://doi.org/10.1186/1471-2105-8-234
#'
Expand All @@ -17,12 +17,12 @@ glog <- function(y, y0=0, lambda){
return(z)
}

#' Internal function for max. likelihood optimisation of glog params
#' Internal function for max. likelihood optimisation of glog params.
#' Calculates the alternative Jacobian function described in
#' https://doi.org/10.1186/1471-2105-8-234
#'
#' @param y values.
#' @param y0 offset applied to y (default=0).
#' @param y values
#' @param y0 offset applied to y (default=0)
#' @param lambda lambda
#' @return numeric, optimised glog parameter

Expand Down Expand Up @@ -55,11 +55,11 @@ SSE <- function(lambda, y0=0, y) {
return(s)
}

#' If glog optimisation fails, this function will will scale values in the
#' peak matrix to the 1 / mean (total signal) over all samples.
#' If glog optimisation fails, this function will scale values in the
#' peak matrix to the 1/mean(total signal) over all samples.
#'
#' @param df Peak intensity matrix
#' @return Scaled peak matrix
#' @param df peak intensity matrix
#' @return scaled peak matrix

glog_rescale_data <- function(df){
#
Expand All @@ -76,9 +76,9 @@ glog_rescale_data <- function(df){
#' https://doi.org/10.1186/1471-2105-8-234
#'
#' @param df Peak intensity matrix
#' @param classes Vector of class labels
#' @param qc_label Class label for QC sample
#' @param store_lambda If value of optimised lambda parameter needs to be
#' @param classes vector of class labels
#' @param qc_label class label for QC sample
#' @param store_lambda if value of optimised lambda parameter needs to be
#'returned
#' @examples
#' attach (testData)
Expand Down
30 changes: 15 additions & 15 deletions R/mv_imputation.R
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@
NULL

#' Replace missing values for specific peak matrix feature
#' @param x Index of matrix feature
#' @param df A peak matrix with features in the rows, samples in the columns
#' @param vals Vector object with the same length as number of features in
#' @param x index of matrix feature
#' @param df a peak matrix with features in the rows, samples in the columns
#' @param vals vector object with the same length as number of features in
#'peak matrix to replca NA values with
#'
#' @return feature at specified index 'x' with replaced missing values
Expand All @@ -19,8 +19,8 @@ replace_na <- function(x, df, vals){
}

#' Imput missing values using mode of each feature
#' @param df A peak matrix with features in the rows, samples in the columns
#' @param method Mode to use for missing value imputation. 'mn' for mean and
#' @param df a peak matrix with features in the rows, samples in the columns
#' @param method mode to use for missing value imputation. 'mn' for mean and
#''md'for median.
#'
#' @return data frame of missing value imputed peak intensity matrix
Expand All @@ -42,16 +42,16 @@ impute_mode <- function (df, method){

#' Missing value imputation using different algorithms
#'
#' @param df A peak matrix with features in the rows, samples in the columns
#' @param method Missing value imputation method. Supported methods are 'knn',
#''rf', 'bpca', 'sv', 'mn' and 'md'.
#' @param k Number of neighbors to be used in the imputation
#' @param rowmax Fraction of missing values per row.
#' @param colmax Fraction of missing values per column.
#' @param maxp Number of features to run on single core. If set to NULL will
#'use total number of features.
#' @param check_df If set to TRUE will check if input data needs to be
#'transposed, so that features are in rows.
#' @param df a peak matrix with features in the rows, samples in the columns
#' @param method missing value imputation method. Supported methods are 'knn',
#''rf', 'bpca', 'sv', 'mn' and 'md'
#' @param k number of neighbors to be used in the imputation
#' @param rowmax fraction of missing values per row
#' @param colmax fraction of missing values per column
#' @param maxp number of features to run on single core. If set to NULL will
#'use total number of features
#' @param check_df if set to TRUE will check if input data needs to be
#'transposed, so that features are in rows
#' @return data frame of missing value imputed peak intensity matrix
#'
#' @examples
Expand Down
16 changes: 8 additions & 8 deletions R/normalisation.R
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
#' Normalise peak table to the total sum of peak intensities
#' @param df Data frame
#' @param check_df If set to TRUE will check if input data needs to be
#'transposed, so that features are in rows.
#' @return Normalised peak matrix.
#' @param df data frame
#' @param check_df ff set to TRUE will check if input data needs to be
#'transposed, so that features are in rows
#' @return normalised peak matrix
#' @examples
#' attach (testData)
#' out <- normalise_to_sum (testData$data)
Expand All @@ -19,11 +19,11 @@ normalise_to_sum <- function(df, check_df=TRUE) {

#' Normalise peak table using PQN method
#'
#' @param df Data frame.
#' @param classes Vector of class labels.
#' @param qc_label Label used for QC samples. If set to 'all', all samples will
#' @param df data frame
#' @param classes vector of class labels
#' @param qc_label label used for QC samples. If set to 'all', all samples will
#'be used to calculate correction factor
#' @return List of normalised data set and correction coefficients
#' @return list of normalised data set and correction coefficients
#' @examples
#' attach (testData)
#' pqn_normalisation(df=testData$data, classes=testData$class, qc_label='QC')
Expand Down
4 changes: 2 additions & 2 deletions man/check_peak_matrix.Rd

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

22 changes: 11 additions & 11 deletions man/filter_peaks_by_blank.Rd

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

20 changes: 10 additions & 10 deletions man/filter_peaks_by_fraction.Rd

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

Loading

0 comments on commit ccaa3e2

Please sign in to comment.