Last data update: 2014.03.03

R: set a rectangular or circular region in an affybatch to a...
setRectRegionR Documentation

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

Description

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

Usage

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

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)

Results


R version 3.3.1 (2016-06-21) -- "Bug in Your Hair"
Copyright (C) 2016 The R Foundation for Statistical Computing
Platform: x86_64-pc-linux-gnu (64-bit)

R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.

R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.

Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.

> library(affyContam)
Loading required package: tools
Loading required package: Biobase
Loading required package: BiocGenerics
Loading required package: parallel

Attaching package: 'BiocGenerics'

The following objects are masked from 'package:parallel':

    clusterApply, clusterApplyLB, clusterCall, clusterEvalQ,
    clusterExport, clusterMap, parApply, parCapply, parLapply,
    parLapplyLB, parRapply, parSapply, parSapplyLB

The following objects are masked from 'package:stats':

    IQR, mad, xtabs

The following objects are masked from 'package:base':

    Filter, Find, Map, Position, Reduce, anyDuplicated, append,
    as.data.frame, cbind, colnames, do.call, duplicated, eval, evalq,
    get, grep, grepl, intersect, is.unsorted, lapply, lengths, mapply,
    match, mget, order, paste, pmax, pmax.int, pmin, pmin.int, rank,
    rbind, rownames, sapply, setdiff, sort, table, tapply, union,
    unique, unsplit

Welcome to Bioconductor

    Vignettes contain introductory material; view with
    'browseVignettes()'. To cite Bioconductor, see
    'citation("Biobase")', and for packages 'citation("pkgname")'.

Loading required package: affy
Loading required package: affydata
     Package    LibPath                            Item      
[1,] "affydata" "/home/ddbj/local/lib64/R/library" "Dilution"
     Title                        
[1,] "AffyBatch instance Dilution"
> png(filename="/home/ddbj/snapshot/RGM3/R_BC/result/affyContam/setRectRegion.Rd_%03d_medium.png", width=480, height=480)
> ### Name: setRectRegion
> ### Title: set a rectangular or circular region in an affybatch to a
> ###   specified set of values
> ### Aliases: setRectRegion setCircRegion getRectRegion getCircRegion
> ### Keywords: models
> 
> ### ** Examples
> 
> library(affydata)
> data(Dilution)
> opar = par(no.readonly=TRUE)
> par(mfrow=c(2,2))
> hist(Dilution, main="original")

Warning messages:
1: replacing previous import 'AnnotationDbi::tail' by 'utils::tail' when loading 'hgu95av2cdf' 
2: replacing previous import 'AnnotationDbi::head' by 'utils::head' when loading 'hgu95av2cdf' 
> 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)
[1] 31397
> ab = setCircRegion(Dilution, 1, vals=pmin(2*ex,65535))
> image(ab[,1], main="chip 1 contaminated by doubling")
> par(opar)
> 
> 
> 
> 
> 
> dev.off()
null device 
          1 
>