selectTimes: selectTimes

Description Usage Arguments Value Examples

View source: R/filter.R

Description

selectTimes

Usage

1
selectTimes(mat, timepoint, order, percent, w)

Arguments

mat

a matrix with rows correspond to phosphosites and columns correspond to samples in replicates for different treatments.

timepoint

a timepoint as factor with a length equal to the number of columns of mat.

order

a vector specifying the order of timepoints.

percent

a percent (decimal) from 0 to 1, to filter phosphosites with with missing value larger than percent per timepoint.

w

a timepoint window for selection of phosphosites to remove.

Value

a filtered matrix

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
data("phospho_liverInsTC_RUV_sample")
timepoint = gsub("(.*)(\\d+[ms])(.*)", "\\2",
                colnames(phospho.liver.Ins.TC.ratio.RUV))
timepoint[which(timepoint == "0m")] = "0s"
timepoint = factor(timepoint)
timepointOrder = c("0s", "5s", "1m", "2m", "3m", "4m", "6m")

# For demonstration purpose, we introduce missing value at 0s
table(timepoint)

phospho.liver.Ins.TC.sim = phospho.liver.Ins.TC.ratio.RUV
rmId = which(timepoint == "0s")

# We replace the values to NA for the first 26 (~60%) of the '0s' samples
# for the first 100 phosphosite as NA
phospho.liver.Ins.TC.sim[1:100,rmId[1:26]] = NA

phospho.liver.Ins.TC.sim = selectTimes(phospho.liver.Ins.TC.sim,
                                    timepoint, timepointOrder, 0.5,
                                    w = length(table(timepoint)))

# Before filtering
dim(phospho.liver.Ins.TC.ratio.RUV)
# After filtering
dim(phospho.liver.Ins.TC.sim)

PhosR documentation built on Nov. 8, 2020, 6:54 p.m.