RawCopyNumbers          package:aroma.core          R Documentation

_T_h_e _R_a_w_C_o_p_y_N_u_m_b_e_r_s _c_l_a_s_s

_D_e_s_c_r_i_p_t_i_o_n:

     Package:  aroma.core 
      *Class RawCopyNumbers*

     'Object'
      '~~|'
      '~~+--''RawGenomicSignals'
      '~~~~~~~|'
      '~~~~~~~+--''RawCopyNumbers'

     *Directly known subclasses:*
      SegmentedCopyNumbers

     public static class *RawCopyNumbers*
      extends RawGenomicSignals

_U_s_a_g_e:

     RawCopyNumbers(cn=NULL, ...)

_A_r_g_u_m_e_n_t_s:

      cn: A 'numeric' 'vector' of length J specifying the copy number
          at each loci.

     ...: Arguments passed to 'RawGenomicSignals'.

_F_i_e_l_d_s _a_n_d _M_e_t_h_o_d_s:

     *Methods:*

         'as.data.frame'          -
         'cnRange'                -
         'extractRawCopyNumbers'  -
         'plot'                   -

     *Methods inherited from RawGenomicSignals*:
      addBy, addLocusFields, append, applyBinaryOperator,
     as.data.frame, binnedSmoothing, divideBy,
     estimateStandardDeviation, extractDataForSegmentation,
     extractRegion, extractSubset, gaussianSmoothing, getChromosome,
     getLocusFields, getName, getPositions, getSigma, getSignals,
     getWeights, getXScale, getXY, getYScale, hasWeights,
     kernelSmoothing, lines, multiplyBy, nbrOfLoci, plot, points,
     setLocusFields, setName, setSigma, setWeights, setXScale,
     setYScale, signalRange, sort, subtractBy, summary, xMax, xMin,
     xRange, xSeq, yMax, yMin, yRange

     *Methods inherited from Object*:
      asThis, $, $<-, [[, [[<-, as.character, attach, attachLocally,
     clearCache, clone, detach, equals, extend, finalize, gc,
     getEnvironment, getFields, getInstantiationTime,
     getStaticInstance, hasField, hashCode, ll, load, objectSize,
     print, registerFinalizer, save

_A_u_t_h_o_r(_s):

     Henrik Bengtsson (<URL: http://www.braju.com/R/>)

_E_x_a_m_p_l_e_s:

     # - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
     # Simulating copy-number data
     # - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
     # Number of loci
     J <- 1000

     mu <- double(J)
     mu[200:300] <- mu[200:300] + 1
     mu[650:800] <- mu[650:800] - 1
     eps <- rnorm(J, sd=1/2)
     y <- mu + eps
     x <- sort(runif(length(y), max=length(y)))

     cn <- RawCopyNumbers(y, x)
     print(cn)

     cn2 <- extractSubset(cn, subset=xSeq(cn, by=5))
     print(cn2)

     # - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
     # Plot along genome
     # - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
     plot(cn, ylim=c(-3,3))
     title(main="Complete and subsetted loci")
     points(cn2, col="red", pch=176, cex=2)

     legend("topright", pch=c(19,176), col=c("#999999", "red"), sprintf(c("raw [n=%d]", "every 5th [n=%d]"), c(nbrOfLoci(cn), nbrOfLoci(cn2))), bty="n")

     # - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
     # Binned smoothing
     # - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
     plot(cn, col="#999999", ylim=c(-3,3))
     title(main="Binned smoothing")

     cnSa <- binnedSmoothing(cn, by=3)
     lines(cnSa, col="blue")
     points(cnSa, col="blue")

     cnSb <- binnedSmoothing(cn, by=9)
     lines(cnSb, col="red")
     points(cnSb, col="red")

     legend("topright", pch=19, col=c("#999999", "blue", "red"), sprintf(c("raw [n=%d]", "Bin(w=3) [n=%d]", "Bin(w=9) [n=%d]"), c(nbrOfLoci(cn), nbrOfLoci(cnSa), nbrOfLoci(cnSb))), bty="n")

     # - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
     # Binned smoothing (by count)
     # - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
     plot(cn, col="#999999", ylim=c(-3,3))
     title(main="Binned smoothing (by count)")

     cnSa <- binnedSmoothing(cn, by=3, byCount=TRUE)
     lines(cnSa, col="blue")
     points(cnSa, col="blue")

     cnSb <- binnedSmoothing(cn, by=9, byCount=TRUE)
     lines(cnSb, col="red")
     points(cnSb, col="red")

     legend("topright", pch=19, col=c("#999999", "blue", "red"), sprintf(c("raw [n=%d]", "BinO(w=3) [n=%d]", "BinO(w=9) [n=%d]"), c(nbrOfLoci(cn), nbrOfLoci(cnSa), nbrOfLoci(cnSb))), bty="n")

     # - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
     # Kernel smoothing (default is Gaussian)
     # - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
     plot(cn, col="#999999", ylim=c(-3,3))
     title(main="Kernel smoothing w/ Gaussian kernel")

     cnSa <- kernelSmoothing(cn, h=2)
     points(cnSa, col="blue")

     cnSb <- kernelSmoothing(cn, h=5)
     points(cnSb, col="red")

     legend("topright", pch=19, col=c("#999999", "blue", "red"), sprintf(c("raw [n=%d]", "N(.,sd=2) [n=%d]", "N(.,sd=5) [n=%d]"), c(nbrOfLoci(cn), nbrOfLoci(cnSa), nbrOfLoci(cnSb))), bty="n")

     # - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
     # Kernel smoothing
     # - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
     plot(cn, col="#999999", ylim=c(-3,3))
     title(main="Kernel smoothing w/ uniform kernel")

     xOut <- xSeq(cn, by=10)
     cnSa <- kernelSmoothing(cn, xOut=xOut, kernel="uniform", h=2)
     lines(cnSa, col="blue")
     points(cnSa, col="blue")

     cnSb <- kernelSmoothing(cn, xOut=xOut, kernel="uniform", h=5)
     lines(cnSb, col="red")
     points(cnSb, col="red")

     legend("topright", pch=19, col=c("#999999", "blue", "red"), sprintf(c("raw [n=%d]", "U(w=2) [n=%d]", "U(w=5) [n=%d]"), c(nbrOfLoci(cn), nbrOfLoci(cnSa), nbrOfLoci(cnSb))), bty="n")

