mIntersect: Multi-intersection, union

Description Usage Arguments Value Examples

View source: R/toolBox.R

Description

A recusive loop for intersecting multiple sets.

Usage

1
2
mIntersect(x, y, ...)
mUnion(x, y, ...)

Arguments

x, y, ...

objects to find intersection/union.

Value

An intersection/union of input parameters

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')
data('phospho_L6_ratio')

site1 <- gsub('~[STY]', '~',
            sapply(strsplit(rownames(phospho.L6.ratio), '~'),
                    function(x){paste(toupper(x[2]), x[3], sep='~')}))
site2 <- rownames(phospho.liver.Ins.TC.ratio.RUV)

# step 2: rank by fold changes
tmp <- do.call(cbind, lapply(split(1:ncol(phospho.L6.ratio), gsub('_exp\\d+',
                            '', colnames(phospho.L6.ratio))),
                            function(i){rowMeans(phospho.L6.ratio[,i])}))
site1 <- t(sapply(split(data.frame(tmp), site1), colMeans))[,-1]

tmp <- do.call(cbind, lapply(split(1:ncol(phospho.liver.Ins.TC.ratio.RUV),
                            gsub(
                                '(Intensity\\.)(.*)(\\_Bio\\d+)',
                                '\\2',
                                colnames(phospho.liver.Ins.TC.ratio.RUV))),
                            function(i){
                                rowMeans(phospho.liver.Ins.TC.ratio.RUV[,i])
                            }))
site2 <- t(sapply(split(data.frame(tmp), site2), colMeans))

o <- mIntersect(site1, site2)

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