[Patchwork-commits] r78 - in pkg/patchworkCG: R man

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Mon Feb 6 17:05:26 CET 2012


Author: sebastian_d
Date: 2012-02-06 17:05:26 +0100 (Mon, 06 Feb 2012)
New Revision: 78

Removed:
   pkg/patchworkCG/R/patchwork.AI.r
   pkg/patchworkCG/man/patchwork.AI.Rd
Modified:
   pkg/patchworkCG/R/patchwork.CG.r
   pkg/patchworkCG/man/CG_KaCh.Rd
   pkg/patchworkCG/man/CG_KaChCN.Rd
   pkg/patchworkCG/man/CG_karyotype.Rd
   pkg/patchworkCG/man/subfunctions_CGCNV.Rd
Log:
removed patchworkAI

Deleted: pkg/patchworkCG/R/patchwork.AI.r
===================================================================
--- pkg/patchworkCG/R/patchwork.AI.r	2012-02-02 08:31:28 UTC (rev 77)
+++ pkg/patchworkCG/R/patchwork.AI.r	2012-02-06 16:05:26 UTC (rev 78)
@@ -1,20 +0,0 @@
-patchwork.AI <- function(segs,mastervar)
-	{
-	segs$ai <- segs$snvs <- segs$ratio <- NA
-	
-	for (i in 1:nrow(segs))
-		{
-		#Calculate ratio between relcov and segment lengths
-		segs$ratio[i] = segs$relcov[i] / (sum(as.numeric(segs$relcov*(segs$end-segs$start))) / sum(as.numeric(segs$end - segs$start)))
-		
-		#Index of correct snp positions to pull snp data from
-		#                right chromosome
-		ix = mastervar$chr==as.character(segs$chr[i]) &
-		#    right area (between start and end)
-			(mastervar$begin > segs$start[i] & mastervar$begin < segs$end[i])
-		segs$snvs[i] = sum(ix)
-		segs$ai[i] = 1 - sum(mastervar$min[ix]) / sum(mastervar$max[ix])
-		}
-	segs$ai[is.nan(segs$ai)]=0
-	return(segs)
-	}
\ No newline at end of file

Modified: pkg/patchworkCG/R/patchwork.CG.r
===================================================================
--- pkg/patchworkCG/R/patchwork.CG.r	2012-02-02 08:31:28 UTC (rev 77)
+++ pkg/patchworkCG/R/patchwork.CG.r	2012-02-06 16:05:26 UTC (rev 78)
@@ -253,18 +253,32 @@
 	mastervar$max = apply(mastervar[,c(5,9)],1,max)
 	mastervar$min = mastervar$tot_count - mastervar$max
 	mastervar$ratio = mastervar$tot_count / mean(mastervar$tot_count)
+		
+	segm = patchwork.AI(segm,mastervar)
 	
-	#------------------------------------------------#
-	# Create segs using patchwork.AI, save files
-	#------------------------------------------------#
+	segm$ai <- segm$snvs <- segm$ratio <- NA
 	
-	segs = patchwork.AI(segm,mastervar)
+	#Generate the allelic imbalance calculation, among other things.
+	for (i in 1:nrow(segm))
+		{
+		#Calculate ratio between relcov and segment lengths
+		segm$ratio[i] = segm$relcov[i] / (sum(as.numeric(segm$relcov*(segm$end-segm$start))) / sum(as.numeric(segm$end - segm$start)))
+		
+		#Index of correct snp positions to pull snp data from
+		#                right chromosome
+		ix = mastervar$chr==as.character(segm$chr[i]) &
+		#    right area (between start and end)
+			(mastervar$begin > segm$start[i] & mastervar$begin < segm$end[i])
+		segm$snvs[i] = sum(ix)
+		segm$ai[i] = 1 - sum(mastervar$min[ix]) / sum(mastervar$max[ix])
+		}
+	segm$ai[is.nan(segm$ai)]=0
 	
 	cat("Calculations complete \n")
 	
 	cat("Saving objects to CG.Rdata \n")
 	
-	save(segs,mastervar,depcov,file="CG.Rdata")
+	save(segm,mastervar,depcov,file="CG.Rdata")
 	
 	#------------------------------------------------#
 	# Plot
@@ -272,10 +286,10 @@
 	
 	
 	cat("Initiating Plotting \n")
-	CG_karyotype(segs$chr,segs$start,segs$end,segs$ratio,segs$ai,
+	CG_karyotype(segm$chr,segm$start,segm$end,segm$ratio,segm$ai,
 					name=name,xlim=c(0,2.4),ylim=c(0,1))
 	
-	CG_KaCh(segs$chr,segs$start,segs$end,segs$ratio,segs$ai,
+	CG_KaCh(segm$chr,segm$start,segm$end,segm$ratio,segm$ai,
 					depcov$chr,depcov$begin,depcov$ratio,(1 - mastervar$min/mastervar$max),
 					mastervar$chr,mastervar$begin,
 					name=name,xlim=c(0,2.4),ylim=c(0,1))

Modified: pkg/patchworkCG/man/CG_KaCh.Rd
===================================================================
--- pkg/patchworkCG/man/CG_KaCh.Rd	2012-02-02 08:31:28 UTC (rev 77)
+++ pkg/patchworkCG/man/CG_KaCh.Rd	2012-02-06 16:05:26 UTC (rev 78)
@@ -17,8 +17,7 @@
 
 \arguments{
   	\item{chr}{					
-  	Chromosomes name of segs object, as generated from somaticCnvSegmentsNonDiplod file.
-  	Final version of segs created in patchwork.AI().
+  	Chromosomes name of segm object, as generated from somaticCnvSegmentsNonDiplod file.
 	}
   	\item{start}{				
 	Start position of segment.

Modified: pkg/patchworkCG/man/CG_KaChCN.Rd
===================================================================
--- pkg/patchworkCG/man/CG_KaChCN.Rd	2012-02-02 08:31:28 UTC (rev 77)
+++ pkg/patchworkCG/man/CG_KaChCN.Rd	2012-02-06 16:05:26 UTC (rev 78)
@@ -18,7 +18,7 @@
 
 \arguments{
   	\item{chr}{
-  	Chromosomes name of segs object. Final version of segs created from patchwork.AI().
+  	Chromosomes name of segm object.
 	}
   	\item{start}{			
 	Start position of segment.

Modified: pkg/patchworkCG/man/CG_karyotype.Rd
===================================================================
--- pkg/patchworkCG/man/CG_karyotype.Rd	2012-02-02 08:31:28 UTC (rev 77)
+++ pkg/patchworkCG/man/CG_karyotype.Rd	2012-02-06 16:05:26 UTC (rev 78)
@@ -17,8 +17,7 @@
 
 \arguments{
   	\item{chr}{					
-  	Chromosomes name of segs object, as generated from somaticCnvSegmentsNonDiplod file.
-  	Final version of segs created in patchwork.AI().
+  	Chromosomes name of segm object, as generated from somaticCnvSegmentsNonDiplod file.
 	}
   	\item{start}{				
 	Start position of segment.

Deleted: pkg/patchworkCG/man/patchwork.AI.Rd
===================================================================
--- pkg/patchworkCG/man/patchwork.AI.Rd	2012-02-02 08:31:28 UTC (rev 77)
+++ pkg/patchworkCG/man/patchwork.AI.Rd	2012-02-06 16:05:26 UTC (rev 78)
@@ -1,70 +0,0 @@
-\name{patchwork.AI}
-\alias{patchwork.AI}
-\alias{AI}
-
-
-\title{
-Function to calculate Allelic Imbalance
-}
-
-\description{
-Generates the segs object, internal function within patchwork.CG().
-}
-
-\usage{
-patchwork.AI(segs,mastervar)
-}
-
-\arguments{
-  \item{segs}{
-	This object is initially read from the somaticCnvSegmentsNondiploidBeta file in the CNV directory
-	of your CompleteGenomics data.
-	}
-  \item{mastervar}{
-	This object is initially read then edited from the masterVarBeta file in the ASM directory
-	of your CompleteGenomics data.
-	}
-}
-
-\details{
-As this is an internal function it is mostly there to keep the code clean. It is not recommended
-that this function be run except as it was intended in patchwork.CG().
-}
-
-%\value{
-%%  ~Describe the value returned
-%%  If it is a LIST, use
-%%  \item{comp1 }{Description of 'comp1'}
-%%  \item{comp2 }{Description of 'comp2'}
-%% ...
-%}
-
-%\references{
-%% ~put references to the literature/web site here ~
-%}
-
-\author{
-Markus Mayrhofer, \email{markus.mayrhofer at medsci.uu.se} \cr
-Sebastian DiLorenzo, \email{sebastian.dilorenzo at medsci.uu.se}
-}
-%\note{
-%%  ~~further notes~~
-%}
-
-%% ~Make other sections like Warning with \section{Warning }{....} ~
-
-\seealso{
-\code{\link{patchwork.CG}}
-}
-
-%\examples{
-%##---- Should be DIRECTLY executable !! ----
-%##-- ==>  Define data, use random,
-%##--	or do  help(data=index)  for the standard data sets.
-%Run examples of karyotype stuff. or not, maybe just point back to CNA.
-%}
-
-% Add one or more standard keywords, see file 'KEYWORDS' in the
-% R documentation directory.
-%\keyword{ ~kwd1 }
-%\keyword{ ~kwd2 }% __ONLY ONE__ keyword per line
\ No newline at end of file

Modified: pkg/patchworkCG/man/subfunctions_CGCNV.Rd
===================================================================
--- pkg/patchworkCG/man/subfunctions_CGCNV.Rd	2012-02-02 08:31:28 UTC (rev 77)
+++ pkg/patchworkCG/man/subfunctions_CGCNV.Rd	2012-02-06 16:05:26 UTC (rev 78)
@@ -39,7 +39,7 @@
 	Weights to be applied.
 	}
   \item{vector}{
-	The segs objects chr column.
+	The segm objects chr column.
 	}
 }
 



More information about the Patchwork-commits mailing list