setRectRegion: set a rectangular or circular region in an affybatch to a...

Description Usage Arguments Value Author(s) Examples

View source: R/setRegion.R

Description

set a rectangular or circular region in an affybatch to a specified set of values

Usage

1
2
3
4
setRectRegion(x, chip=1, xinds=251:350, yinds=251:350, vals=10, valgen=NULL)
setCircRegion(x, chip=1, center=c(350,350), rad=100, vals=10, valgen=NULL)
getRectRegion(x, chip=1, xinds=251:350, yinds=251:350)
getCircRegion(x, chip=1, center=c(350,350), rad=100)

Arguments

x

AffyBatch instance

chip

sample index

xinds

x coordinates to be contaminated

yinds

y coordinates to be contaminated

vals

values to be assigned to rectangle elements

center

geometric center of circle to be altered

rad

radius of circle to be altered, in xy units of the chip addressing system used by xy2indices in the cdf package

valgen

function of parameter n that generates n values to be inserted in the altered region

Value

set* functions return AffyBatch instance with intensities modified as requested

get* functions return numeric vectors of intensities as requested.

Author(s)

Vince Carey <stvjc@channing.harvard.edu>

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
library(affydata)
data(Dilution)
opar = par(no.readonly=TRUE)
par(mfrow=c(2,2))
hist(Dilution, main="original")
image(Dilution[,1], main="original")
#
# we will contaminate in two ways: thin line at fixed low intensity, and 
# circular blob at moderate random intensity
#
ab = setRectRegion(Dilution, 1, xinds=25:30, yinds=1:620,
  vals=10)
ab = setCircRegion(ab, 1, valgen=function(n){
   rnorm(n, 350,50)})
hist(ab, main="chip 1 contaminated by normal")
image(ab[,1], main="chip 1 contaminated")
ex = getCircRegion(Dilution, 1)
length(ex)
ab = setCircRegion(Dilution, 1, vals=pmin(2*ex,65535))
image(ab[,1], main="chip 1 contaminated by doubling")
par(opar)

affyContam documentation built on Nov. 8, 2020, 8:09 p.m.