Browse code

removed troubleshooting section from copynumber vignette

git-svn-id: file:///home/git/hedgehog.fhcrc.org/bioconductor/branches/RELEASE_2_6/madman/Rpacks/crlmm@49112 bc3139a8-67e5-0310-9ffc-ced21a209358

Rob Scharp authored on 30/08/2010 15:45:42
Showing1 changed files

... ...
@@ -390,12 +390,13 @@ to the univariate prediction regions at nonpolymorphic loci are a future
390 390
 area of research.
391 391
 
392 392
 <<oneSample, fig=TRUE, width=8, height=4, include=FALSE>>=
393
+cn <- crlmm:::totalCopyNumber(x, j=1)
393 394
 par(las=1, mar=c(4, 5, 4, 2))
394
-plot(position(x), copyNumber(x)[, 1]/100, pch=21,
395
+plot(position(x), cn, pch=21,
395 396
      cex=0.4, xaxt="n", col="grey20", ylim=c(0,5),
396 397
      ylab="copy number", xlab="physical position (Mb)",
397 398
      main=paste(sampleNames(x)[1], ", CHR:", unique(chromosome(x))))
398
-points(position(x)[!isSnp(x)], copyNumber(x)[!isSnp(x), 1]/100,
399
+points(position(x)[!isSnp(x)], cn[!isSnp(x)],
399 400
        pch=21, cex=0.4, col="lightblue", bg="lightblue")
400 401
 axis(1, at=pretty(range(position(x))), labels=pretty(range(position(x)))/1e6)
401 402
 abline(h=2)
... ...
@@ -414,40 +415,6 @@ plotCytoband(22, new=FALSE, cytoband.ycoords=c(3.8, 4), label.cytoband=FALSE)
414 415
     blue.}
415 416
 \end{figure}
416 417
 
417
-%
418
-%<<overlayHmmPredictions, fig=TRUE, include=FALSE>>=
419
-%ask <- FALSE
420
-%op <- par(mfrow=c(3, 1), las=1, mar=c(1, 4, 1, 1), oma=c(3, 1, 1, 1), ask=ask)
421
-%##Put fit on the copy number scale
422
-%cns <- copyNumber(cnSet2)
423
-%cnState <- hmmPredictions - as.integer(1)
424
-%xlim <- c(10*1e6, max(position(cnSet2)))
425
-%cols <- brewer.pal(8, "Dark2")[1:4]
426
-%for(j in 1:3){
427
-%	plot(position(cnSet2), cnState[, j], pch=".", col=cols[2], xaxt="n",
428
-%	     ylab="copy number", xlab="Physical position (Mb)", type="s", lwd=2,
429
-%	     ylim=c(0,6), xlim=xlim)
430
-%	points(position(cnSet2), cns[, j], pch=".", col=cols[3])
431
-%	lines(position(cnSet2), cnState[,j], lwd=2, col=cols[2])
432
-%	axis(1, at=pretty(position(cnSet)),
433
-%	     labels=pretty(position(cnSet))/1e6)
434
-%	abline(h=c(1,3), lty=2, col=cols[1])
435
-%	legend("topright", bty="n", legend=sampleNames(cnSet)[j])
436
-%	legend("topleft", lty=1, col=cols[2], legend="copy number state",
437
-%	       bty="n", lwd=2)
438
-%	plotCytoband(CHR, cytoband.ycoords=c(5, 5.2), new=FALSE,
439
-%		     label.cytoband=FALSE, xlim=xlim)
440
-%}
441
-%par(op)
442
-%@
443
-%
444
-%\begin{figure}
445
-%  \includegraphics[width=\textwidth]{copynumber-overlayHmmPredictions}
446
-%  \caption{\label{fig:overlayHmmPredictions} Total copy number (y-axis)
447
-%    for chromosome 22 plotted against physical position (x-axis) for
448
-%    three samples.  Estimates at nonpolymorphic loci are plotted in
449
-%    light blue. }
450
-%\end{figure}
451 418
 
452 419
 \clearpage
453 420
 \paragraph{One SNP at a time}
... ...
@@ -460,131 +427,9 @@ the vignette is currently under development.
460 427
 
461 428
 <<predictionRegions, fig=TRUE, width=8, height=8, include=FALSE, eval=FALSE, echo=FALSE>>=
462 429
 i <- snp.index[1]
463
-#plotCNSetLM=crlmm:::plotCNSetLM
464
-##trace(plotCNSetLM, browser)
465 430
 plot(i, x, copynumber=2)
466
-##myScatter <- function(object, add=FALSE, ...){
467
-##	A <- log2(A(object))
468
-##	B <- log2(B(object))
469
-##	if(!add){
470
-##		plot(A, B, ...)
471
-##	} else{
472
-##		points(A, B, ...)
473
-##	}
474
-##}
475
-##index <- which(isSnp(cnSet))[1:9]
476
-##xlim <- ylim <- c(6.5,13)
477
-##par(mfrow=c(3,3), las=1, pty="s", ask=FALSE, mar=c(2, 2, 2, 2), oma=c(2, 2, 1, 1))
478
-##for(i in index){
479
-##	gt <- calls(cnSet)[i, ]
480
-##	if(i != 89){
481
-##		myScatter(cnSet[i, ],
482
-##			  pch=pch,
483
-##			  col=colors[snpCall(cnSet)[i, ]],
484
-##			  bg=colors[snpCall(cnSet)[i, ]], cex=cex,
485
-##			  xlim=xlim, ylim=ylim)
486
-##		mtext("A", 1, outer=TRUE, line=1)
487
-##		mtext("B", 2, outer=TRUE, line=1)
488
-##		crlmm:::ellipse.CNSet(cnSet[i, ], copynumber=2, batch="C", lwd=2, col="black")
489
-##		crlmm:::ellipse.CNSet(cnSet[i, ], copynumber=2, batch="Y", lwd=2, col="grey50")
490
-##	} else {
491
-##		plot(0:1, xlim=c(0,1), ylim=c(0,1), type="n", xaxt="n", yaxt="n")
492
-##		legend("center",
493
-##		       legend=c("CN = 2, CEPH", "CN = 2, Yoruban"),
494
-##		       col=c("black", "grey50"), lwd=2, bty="n")
495
-##	}
496
-##}
497 431
 @
498 432
 
499
-%\begin{figure}
500
-%  \centering
501
-%  \includegraphics[width=0.8\textwidth]{copynumber-predictionRegions}
502
-%  \caption{\label{fig:prediction} Scatterplots of A versus B
503
-%    intensities.  Each panel displays a single SNP. The ellipses
504
-%    indicate the 95\% probability region for copy number 2 for the CEPH
505
-%    (black) and Yoruban subjects (grey).}
506
-%\end{figure}
507
-
508
-%\section{Details for the copy number estimation procedure}
509
-%
510
-%See the technical report \citep{Scharpf2009}.
511
-
512
-\section{Trouble shooting}
513
-
514
-Suppose that you are only interested in estimating copy number at
515
-autosomal markers and you encountered an error using the
516
-crlmmCopynumber2 function for estimating copy number at nonpolymorphic
517
-markers on chromosome X.
518
-
519
-Making a subset of a cnSet2 without pulling all the data from disk to
520
-memory.
521
-<<>>=
522
-cnSet <- cnSet2
523
-@
524
-
525
-<<>>=
526
-cnSet <- crlmmCopynumber2(cnSet)
527
-@
528
-
529
-
530
-<<>>=
531
-marker.index <- which(chromosome(cnSet) < 23)
532
-nr <- length(marker.index)
533
-nc <- ncol(cnSet)
534
-@
535
-
536
-Set up a new directory for storing ff objects so that we can
537
-completely remove all the ff objects in the old directory when we're
538
-finished.
539
-
540
-<<>>=
541
-library(ff)
542
-ldPath("newDirectory")
543
-dir.create("newDirectory")
544
-@
545
-
546
-Next, initialize the container using utilities from the oligoClasses package.
547
-
548
-<<>>=
549
-CA <- initializeBigMatrix("CA", nr, nc)
550
-CB <- initializeBigMatrix("CB", nr, nc)
551
-A <- initializeBigMatrix("A", nr, nc)
552
-B <- initializeBigMatrix("B", nr, nc)
553
-GT <- initializeBigMatrix("GT", nr, nc)
554
-PP <- initializeBigMatrix("confs", nr, nc)
555
-cnSet.autosomes <- new("CNSetLM",
556
-		       alleleA=A,
557
-		       alleleB=B,
558
-		       call=GT,
559
-		       callProbability=PP,
560
-		       CA=CA,
561
-		       CB=CB,
562
-		       protocolData=protocolData(cnSet),
563
-		       featureData=featureData(cnSet)[marker.index, ],
564
-		       phenoData=phenoData(cnSet),
565
-		       annotation=annotation(cnSet))
566
-@
567
-
568
-Next, we need to populate the ff objects with data. The easiest way to
569
-do this without requiring too much RAM is to loop through the
570
-samples. Lets do 5 samples at a time.
571
-
572
-<<populateWithData>>=
573
-sample.index <- splitIndicesByLength(1:ncol(cnSet), 5)
574
-for(j in sample.index){
575
-	A(cnSet.autosomes)[, j] <- A(cnSet)[marker.index, j]
576
-	B(cnSet.autosomes)[, j] <- B(cnSet)[marker.index, j]
577
-	calls(cnSet.autosomes)[, j] <- calls(cnSet)[marker.index, j]
578
-	snpCallProbability(cnSet.autosomes)[, j] <- snpCallProbability(cnSet)[marker.index, j]
579
-}
580
-@
581
-
582
-Check to see that the data is there.
583
-
584
-The subset operation would pull all the data from disk and create a
585
-cnSet object with matrices.  If the dataset is very large, the subset
586
-operation would be very slow and potentially create a large amount of
587
-RAM.
588 433
 
589 434
 \section{Session information}
590 435
 <<sessionInfo, results=tex>>=
... ...
@@ -593,9 +438,7 @@ toLatex(sessionInfo())
593 438
 
594 439
 \section*{References}
595 440
 
596
-%\begin{bibliography}
597
-  \bibliographystyle{plain}
441
+ \bibliographystyle{plain}
598 442
   \bibliography{refs}
599
-%\end{bibliography}
600 443
 
601 444
 \end{document}