Last data update: 2014.03.03

R: Allele-specific copy number estimation using non-negative...
fitSnpNmfArrayR Documentation

Allele-specific copy number estimation using non-negative matrix factorization (NMF)

Description

Allele-specific copy number estimation using non-negative matrix factorization (NMF).

Usage

fitSnpNmfArray(Y, ...)

Arguments

Y

An Lx2xI array where L is number of probe pairs, 2 is the number of alleles (A and B), and I is the number of arrays.

maxIter

A positive integer specifying the maximum number of iterations used to calculate the decomposition.

acc

A positive double specifying the converence threshold. For more details on convergence, see below.

Details

The algorithm is considered to have converged when the maximum update of any allele-specific copy number of any array (H) is greater than acc.

Value

Returns a list of class SnpNmfFit:

Y

The Lx2xI array Y.

W

The Kx2 matrix containing allele-specific affinity estimates where K=2L.

H

A 2xI matrix containing allele-specific copy number estimates.

hasConverged

TRUE if the algorithm converged, otherwise FALSE. If not applicable, it is NA.

nbrOfIterations

The number of iteration ran before stopping. If not applicable, it is NA.

See Also

Internally, the array is stacked into a 2LxI matrix and decomposed using fitSnpNmf(). See plot.SnpNmfFit().

Examples

# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
# DATA: Lx2xI allele-specific signals for six different SNPs
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
filenames <- sprintf("V%d.Rbin", 1:6)
pathnames <- system.file("extData", filenames, package="ACNE")
Ys <- lapply(pathnames, FUN=function(p) snpMatrixToArray(loadToEnv(p)$V))
names(Ys) <- sprintf("SNP #%d", seq_along(Ys))


# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
# ACNE fitting of NMF to the six SNPs
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
for (name in names(Ys)) {
  Y <- Ys[[name]]
  fit <- fitSnpNmfArray(Y)
  str(fit)
  plot(fit, lim=c(0,2^14), main=name)
}

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(ACNE)
Loading required package: aroma.affymetrix
Loading required package: R.utils
Loading required package: R.oo
Loading required package: R.methodsS3
R.methodsS3 v1.7.1 (2016-02-15) successfully loaded. See ?R.methodsS3 for help.
R.oo v1.20.0 (2016-02-17) successfully loaded. See ?R.oo for help.

Attaching package: 'R.oo'

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

    getClasses, getMethods

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

    attach, detach, gc, load, save

R.utils v2.3.0 (2016-04-13) successfully loaded. See ?R.utils for help.

Attaching package: 'R.utils'

The following object is masked from 'package:utils':

    timestamp

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

    cat, commandArgs, getOption, inherits, isOpen, parse, warnings

Loading required package: aroma.core
Loading required package: R.filesets
R.filesets v2.10.0 (2016-01-04) successfully loaded. See ?R.filesets for help.

Attaching package: 'R.filesets'

The following objects are masked from 'package:R.utils':

    extract, validate

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

    append, readLines

Loading required package: R.devices
R.devices v2.14.0 (2016-03-08) successfully loaded. See ?R.devices for help.
aroma.core v3.0.0 (2016-01-05) successfully loaded. See ?aroma.core for help.

Attaching package: 'aroma.core'

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

    .Machine, apply, colMeans, colSums, library, require, write

Loading required package: aroma.light
aroma.light v3.2.0 (2016-01-06) successfully loaded. See ?aroma.light for help.

Attaching package: 'aroma.light'

The following objects are masked from 'package:aroma.affymetrix':

    averageQuantile, normalizeQuantile, plotDensity, plotMvsA,
    plotXYCurve

The following objects are masked from 'package:aroma.core':

    callNaiveGenotypes, normalizeTumorBoost

Loading required package: affxparser

Attaching package: 'affxparser'

The following object is masked from 'package:aroma.affymetrix':

    writeCdf

The following object is masked from 'package:R.utils':

    findFiles

The following object is masked _by_ package:aroma.affymetrix:

    writeCdf

The following object is masked from package:R.utils:

    findFiles

aroma.affymetrix v3.0.0 (2016-01-09) successfully loaded. See ?aroma.affymetrix for help.

Attaching package: 'aroma.affymetrix'

The following objects are masked _by_ 'package:aroma.light':

    averageQuantile, normalizeQuantile, plotDensity, plotMvsA,
    plotXYCurve

The following object is masked from 'package:affxparser':

    writeCdf

ACNE v0.8.1 (2015-10-26) successfully loaded. See ?ACNE for help.
> png(filename="/home/ddbj/snapshot/RGM3/R_CC/result/ACNE/fitSnpNmfArray.Rd_%03d_medium.png", width=480, height=480)
> ### Name: fitSnpNmfArray
> ### Title: Allele-specific copy number estimation using non-negative matrix
> ###   factorization (NMF)
> ### Aliases: fitSnpNmfArray
> ### Keywords: internal
> 
> ### ** Examples
> 
> # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
> # DATA: Lx2xI allele-specific signals for six different SNPs
> # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
> filenames <- sprintf("V%d.Rbin", 1:6)
> pathnames <- system.file("extData", filenames, package="ACNE")
> Ys <- lapply(pathnames, FUN=function(p) snpMatrixToArray(loadToEnv(p)$V))
> names(Ys) <- sprintf("SNP #%d", seq_along(Ys))
> 
> 
> # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
> # ACNE fitting of NMF to the six SNPs
> # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
> for (name in names(Ys)) {
+   Y <- Ys[[name]]
+   fit <- fitSnpNmfArray(Y)
+   str(fit)
+   plot(fit, lim=c(0,2^14), main=name)
+ }
List of 8
 $ W              : num [1:20, 1:2] 1349 1631 1980 2645 2065 ...
 $ H              : num [1:2, 1:64] 0.3432 1.5576 0.1492 1.9473 0.0684 ...
 $ hasConverged   : logi TRUE
 $ nbrOfIterations: int 6
 $ V              : num [1:20, 1:64] 1346 1986 1788 1077 1181 ...
 $ Y              : num [1:10, 1:2, 1:64] 1346 1986 1788 1077 1181 ...
 $ W2             : num [1:10, 1:2, 1:2] 1349 1631 1980 2645 2065 ...
 $ args           : list()
 - attr(*, "class")= chr [1:2] "list" "SnpNmfFit"
 num [1:10, 1:2, 1:64] 1346 1986 1788 1077 1181 ...
 num [1:10, 1:2, 1:64] 1209 1618 1717 1410 1283 ...
List of 8
 $ W              : num [1:20, 1:2] 2208 1884 1811 1704 1420 ...
 $ H              : num [1:2, 1:64] 0.12002 1.14193 0.00001 2.2746 0.04344 ...
 $ hasConverged   : logi TRUE
 $ nbrOfIterations: int 3
 $ V              : num [1:20, 1:64] 846 992 1368 732 884 ...
 $ Y              : num [1:10, 1:2, 1:64] 846 992 1368 732 884 ...
 $ W2             : num [1:10, 1:2, 1:2] 2208 1884 1811 1704 1420 ...
 $ args           : list()
 - attr(*, "class")= chr [1:2] "list" "SnpNmfFit"
 num [1:10, 1:2, 1:64] 846 992 1368 732 884 ...
 num [1:10, 1:2, 1:64] 849 790 746 655 686 ...
List of 8
 $ W              : num [1:20, 1:2] 1986 1910 1842 1954 1682 ...
 $ H              : num [1:2, 1:64] 0.0803 1.7748 0.9925 1.1392 0.1551 ...
 $ hasConverged   : logi TRUE
 $ nbrOfIterations: int 5
 $ V              : num [1:20, 1:64] 1109 787 874 766 881 ...
 $ Y              : num [1:10, 1:2, 1:64] 1109 787 874 766 881 ...
 $ W2             : num [1:10, 1:2, 1:2] 1986 1910 1842 1954 1682 ...
 $ args           : list()
 - attr(*, "class")= chr [1:2] "list" "SnpNmfFit"
 num [1:10, 1:2, 1:64] 1109 787 874 766 881 ...
 num [1:10, 1:2, 1:64] 931 699 683 693 953 ...
List of 8
 $ W              : num [1:20, 1:2] 5795 2373 3124 2870 4918 ...
 $ H              : num [1:2, 1:64] 1.31 9.07e-02 2.34 1.07e-05 1.07 ...
 $ hasConverged   : logi TRUE
 $ nbrOfIterations: int 5
 $ V              : num [1:20, 1:64] 6708 3451 4694 3849 5334 ...
 $ Y              : num [1:10, 1:2, 1:64] 6708 3451 4694 3849 5334 ...
 $ W2             : num [1:10, 1:2, 1:2] 5795 2373 3124 2870 4918 ...
 $ args           : list()
 - attr(*, "class")= chr [1:2] "list" "SnpNmfFit"
 num [1:10, 1:2, 1:64] 6708 3451 4694 3849 5334 ...
 num [1:10, 1:2, 1:64] 7575 3132 4138 3791 6486 ...
List of 8
 $ W              : num [1:20, 1:2] 3849 3385 4410 3073 2964 ...
 $ H              : num [1:2, 1:64] 0.867 1.247 0.891 1.123 0.039 ...
 $ hasConverged   : logi TRUE
 $ nbrOfIterations: int 6
 $ V              : num [1:20, 1:64] 5181 4257 4253 3400 3720 ...
 $ Y              : num [1:10, 1:2, 1:64] 5181 4257 4253 3400 3720 ...
 $ W2             : num [1:10, 1:2, 1:2] 3849 3385 4410 3073 2964 ...
 $ args           : list()
 - attr(*, "class")= chr [1:2] "list" "SnpNmfFit"
 num [1:10, 1:2, 1:64] 5181 4257 4253 3400 3720 ...
 num [1:10, 1:2, 1:64] 4666 3783 4914 3558 3462 ...
List of 8
 $ W              : num [1:20, 1:2] 3506 3189 3843 3520 4083 ...
 $ H              : num [1:2, 1:64] 0.1671 2.894 0.1106 2.0926 0.0674 ...
 $ hasConverged   : logi TRUE
 $ nbrOfIterations: int 7
 $ V              : num [1:20, 1:64] 5870 3369 5017 2700 4315 ...
 $ Y              : num [1:10, 1:2, 1:64] 5870 3369 5017 2700 4315 ...
 $ W2             : num [1:10, 1:2, 1:2] 3506 3189 3843 3520 4083 ...
 $ args           : list()
 - attr(*, "class")= chr [1:2] "list" "SnpNmfFit"
 num [1:10, 1:2, 1:64] 5870 3369 5017 2700 4315 ...
 num [1:10, 1:2, 1:64] 4531 2749 4392 3397 4907 ...
> 
> 
> 
> 
> 
> dev.off()
null device 
          1 
>