normalizeData: Normalize Data

View source: R/Modelling.R

normalizeDataR Documentation

Normalize Data

Description

This function is used to normalize dataset.

Usage

normalizeData(
  dataset,
  direction = c("row", "column"),
  returnNorm = TRUE,
  ignoreColumn = NULL
)

Arguments

dataset

input dataset. As a data frame.

direction

"row" or "column" to indicate the normalization direction (see details).

returnNorm

logical. Used for direction = "column". The function will return normalized data that can be used to process new dataset (test sets, for example). Ignored when direction = "row".

ignoreColumn

numeric or NULL. Input the column number of the dataset to indicate which column(s) will not be normalized. Default: NULL.

Details

The function provides two normalization strategies: by row or by column. If by row, the dataset will be processed with equation (see reference): d_i = (f_i - min{f_1, f_2, ...}) / max{f_1, f_2, ...}. f_1, f_2, ..., f_i are the original values of each row.

If by column, the dataset will be processed with: d_i = (f_i - min{f_1, f_2, ...}) / (max{f_1, f_2, ...} - min{f_1, f_2, ...}).

Value

If direction = "column" and returnNorm = TRUE, the function returns a list containing normalized dataset and normalization data. Otherwise, only return the processed dataset.

References

Shen J, Zhang J, Luo X, et al. Predicting protein-protein interactions based only on sequences information. Proc. Natl. Acad. Sci. U. S. A. 2007; 104:4337-41

Examples


data(demoPositiveSeq)
seqRNA <- demoPositiveSeq$RNA.positive
seqPro <- demoPositiveSeq$Pro.positive

dataset <- featureFreq(seqRNA = seqRNA, seqPro = seqPro, label = "Interact",
                       featureMode = "conc", computePro = "DeNovo", k.Pro = 3,
                       k.RNA = 2, normalize = "none", parallel.cores = 2)

processed_1 <- normalizeData(dataset, direction = "row", ignoreColumn = 1)
processed_2 <- normalizeData(dataset[,-1], direction = "column",
                             returnNorm = TRUE, ignoreColumn = NULL)


HAN-Siyu/ncProR documentation built on Nov. 3, 2023, 12:08 a.m.