[Patchwork-commits] r147 - / .git .git/logs .git/logs/refs/heads .git/logs/refs/remotes/origin .git/refs/heads .git/refs/remotes/origin pkg/patchwork pkg/patchwork/R pkg/patchwork/inst/perl pkg/patchwork/inst/python pkg/patchwork/man pkg/patchworkCG/R www

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Fri Aug 31 16:06:07 CEST 2012


Author: sebastian_d
Date: 2012-08-31 16:06:07 +0200 (Fri, 31 Aug 2012)
New Revision: 147

Added:
   pkg/patchwork/inst/perl/mpile2alleles.pl
Modified:
   .git/
   .git/COMMIT_EDITMSG
   .git/index
   .git/logs/HEAD
   .git/logs/refs/heads/master
   .git/logs/refs/remotes/origin/master
   .git/refs/heads/master
   .git/refs/remotes/origin/master
   .gitignore
   /
   pkg/patchwork/DESCRIPTION
   pkg/patchwork/R/karyotype.r
   pkg/patchwork/R/karyotype_chroms.r
   pkg/patchwork/R/karyotype_chromsCN.r
   pkg/patchwork/R/patchwork.GCNorm.r
   pkg/patchwork/R/patchwork.alleledata.r
   pkg/patchwork/R/patchwork.copynumbers.r
   pkg/patchwork/R/patchwork.plot.r
   pkg/patchwork/R/patchwork.readChroms.r
   pkg/patchwork/R/patchwork.segment.r
   pkg/patchwork/R/patchwork.smoothing.r
   pkg/patchwork/inst/perl/pile2alleles.pl
   pkg/patchwork/inst/python/Check.py
   pkg/patchwork/man/patchwork.alleledata.Rd
   pkg/patchwork/man/patchwork.copynumbers.Rd
   pkg/patchwork/man/patchwork.plot.Rd
   pkg/patchworkCG/R/patchwork.CG.plot.r
   www/changelog.php
   www/index.php
   www/pw_exec.php
   www/pw_requ.php
Log:
2.2, see github for detailed changes


Property changes on: 
___________________________________________________________________
Added: svn:ignore
   + .git



Property changes on: .git
___________________________________________________________________
Added: svn:ignore
   + .


Modified: .git/COMMIT_EDITMSG
===================================================================
--- .git/COMMIT_EDITMSG	2012-07-10 08:38:08 UTC (rev 146)
+++ .git/COMMIT_EDITMSG	2012-08-31 14:06:07 UTC (rev 147)
@@ -1 +1 @@
-forgot this file =)
+updated changelog and description

Modified: .git/index
===================================================================
(Binary files differ)

Modified: .git/logs/HEAD
===================================================================
--- .git/logs/HEAD	2012-07-10 08:38:08 UTC (rev 146)
+++ .git/logs/HEAD	2012-08-31 14:06:07 UTC (rev 147)
@@ -2,3 +2,17 @@
 6980fef84a3043d074fe5e46a935b84815d90e03 693c0c176e7aaf19c80e78373ef88877e785cd91 Sebastian DiLorenzo <dilorenzo.sebastian at gmail.com> 1340970681 +0200	commit: update changelog post recommit
 693c0c176e7aaf19c80e78373ef88877e785cd91 598eb7173584784980db9537d26490901a99827d Sebastian DiLorenzo <dilorenzo.sebastian at gmail.com> 1341908911 +0200	commit: Added snp data for hg18
 598eb7173584784980db9537d26490901a99827d f33a41d4b92635e2b52ac0bb8a49d6990ed7089c Sebastian DiLorenzo <dilorenzo.sebastian at gmail.com> 1341909020 +0200	commit: forgot this file =)
+f33a41d4b92635e2b52ac0bb8a49d6990ed7089c 43b7aa7a22e01b59c2df83ba5f31397d14da5776 Sebastian DiLorenzo <dilorenzo.sebastian at gmail.com> 1342704674 +0200	commit: Adding support for samtools mpileup and bcftools to be used. Rearranged parameters for patchwork.plot.
+43b7aa7a22e01b59c2df83ba5f31397d14da5776 371c5760912b78ab024065568d5345a48eb9b9ec Sebastian DiLorenzo <dilorenzo.sebastian at gmail.com> 1343055213 +0200	commit: Updated path on pw_requ, updated pile2alleles and mpile2alleles to skip where is * (indels?) for compatability with pileup generated for hg18 sample
+371c5760912b78ab024065568d5345a48eb9b9ec e6c3a237cfa5fa54811afb1890ef826c120f427e Sebastian DiLorenzo <dilorenzo.sebastian at gmail.com> 1343199875 +0200	commit: Minor fix for reading hg18 pileups
+e6c3a237cfa5fa54811afb1890ef826c120f427e 3f9661bba372409a8ee35496472dd90554751e97 Sebastian DiLorenzo <dilorenzo.sebastian at gmail.com> 1343222512 +0200	commit: fixed additional weirdness for hg18 compatability
+3f9661bba372409a8ee35496472dd90554751e97 a1e1ad2eec2208f03abfc56a426c03d3ea7971fd Sebastian DiLorenzo <dilorenzo.sebastian at gmail.com> 1343292937 +0200	commit: fixed an issue with some hg18 gc content files not being sorted
+a1e1ad2eec2208f03abfc56a426c03d3ea7971fd 47e355dc3c2c8f2572996b6a6862eecdbaf84cfb Sebastian DiLorenzo <dilorenzo.sebastian at gmail.com> 1343296008 +0200	pull : Fast-forward
+47e355dc3c2c8f2572996b6a6862eecdbaf84cfb bdec9f453741b1bd726b962081c3cb23a55b5850 Sebastian DiLorenzo <dilorenzo.sebastian at gmail.com> 1343304042 +0200	commit: small fix
+bdec9f453741b1bd726b962081c3cb23a55b5850 34f65c8adcc4f05d5cc22b12a45fe39e478fb22d Sebastian DiLorenzo <dilorenzo.sebastian at gmail.com> 1343380211 +0200	commit: Fixed issue with GC normalization for hg18 genome
+34f65c8adcc4f05d5cc22b12a45fe39e478fb22d 10df9fbfcca0bf63efe178dfedaaa088ef576cfc Sebastian DiLorenzo <dilorenzo.sebastian at gmail.com> 1343640291 +0200	commit: 1st attempt to fix issue with plotting for hg18 where a chromosomes q arm was out of bounds
+10df9fbfcca0bf63efe178dfedaaa088ef576cfc 17891c7c194410b1747a94e33f9c2648f432d8c2 Sebastian DiLorenzo <dilorenzo.sebastian at gmail.com> 1343647383 +0200	commit: attempt two at aforementioned fix
+17891c7c194410b1747a94e33f9c2648f432d8c2 35f1886365a9d8657fba40e6e1e535b07a8d3968 Sebastian DiLorenzo <dilorenzo.sebastian at gmail.com> 1343647843 +0200	commit: Instating fix for all plotting funktions
+35f1886365a9d8657fba40e6e1e535b07a8d3968 dce9edf1dd01665c7e266395f3ad217738315c02 Sebastian DiLorenzo <dilorenzo.sebastian at gmail.com> 1346418135 +0200	commit: kommented line 42 pw.alleledata
+dce9edf1dd01665c7e266395f3ad217738315c02 d5df007a35dcbf109f45dd0c15d100996ee41b9b Sebastian DiLorenzo <dilorenzo.sebastian at gmail.com> 1346420997 +0200	commit: update homepage info slightly
+d5df007a35dcbf109f45dd0c15d100996ee41b9b 0ea92759a953e9e176617cf22b4050ce2fed0bef Sebastian DiLorenzo <dilorenzo.sebastian at gmail.com> 1346421578 +0200	commit: updated changelog and description

Modified: .git/logs/refs/heads/master
===================================================================
--- .git/logs/refs/heads/master	2012-07-10 08:38:08 UTC (rev 146)
+++ .git/logs/refs/heads/master	2012-08-31 14:06:07 UTC (rev 147)
@@ -2,3 +2,17 @@
 6980fef84a3043d074fe5e46a935b84815d90e03 693c0c176e7aaf19c80e78373ef88877e785cd91 Sebastian DiLorenzo <dilorenzo.sebastian at gmail.com> 1340970681 +0200	commit: update changelog post recommit
 693c0c176e7aaf19c80e78373ef88877e785cd91 598eb7173584784980db9537d26490901a99827d Sebastian DiLorenzo <dilorenzo.sebastian at gmail.com> 1341908911 +0200	commit: Added snp data for hg18
 598eb7173584784980db9537d26490901a99827d f33a41d4b92635e2b52ac0bb8a49d6990ed7089c Sebastian DiLorenzo <dilorenzo.sebastian at gmail.com> 1341909020 +0200	commit: forgot this file =)
+f33a41d4b92635e2b52ac0bb8a49d6990ed7089c 43b7aa7a22e01b59c2df83ba5f31397d14da5776 Sebastian DiLorenzo <dilorenzo.sebastian at gmail.com> 1342704674 +0200	commit: Adding support for samtools mpileup and bcftools to be used. Rearranged parameters for patchwork.plot.
+43b7aa7a22e01b59c2df83ba5f31397d14da5776 371c5760912b78ab024065568d5345a48eb9b9ec Sebastian DiLorenzo <dilorenzo.sebastian at gmail.com> 1343055213 +0200	commit: Updated path on pw_requ, updated pile2alleles and mpile2alleles to skip where is * (indels?) for compatability with pileup generated for hg18 sample
+371c5760912b78ab024065568d5345a48eb9b9ec e6c3a237cfa5fa54811afb1890ef826c120f427e Sebastian DiLorenzo <dilorenzo.sebastian at gmail.com> 1343199875 +0200	commit: Minor fix for reading hg18 pileups
+e6c3a237cfa5fa54811afb1890ef826c120f427e 3f9661bba372409a8ee35496472dd90554751e97 Sebastian DiLorenzo <dilorenzo.sebastian at gmail.com> 1343222512 +0200	commit: fixed additional weirdness for hg18 compatability
+3f9661bba372409a8ee35496472dd90554751e97 a1e1ad2eec2208f03abfc56a426c03d3ea7971fd Sebastian DiLorenzo <dilorenzo.sebastian at gmail.com> 1343292937 +0200	commit: fixed an issue with some hg18 gc content files not being sorted
+a1e1ad2eec2208f03abfc56a426c03d3ea7971fd 47e355dc3c2c8f2572996b6a6862eecdbaf84cfb Sebastian DiLorenzo <dilorenzo.sebastian at gmail.com> 1343296008 +0200	pull : Fast-forward
+47e355dc3c2c8f2572996b6a6862eecdbaf84cfb bdec9f453741b1bd726b962081c3cb23a55b5850 Sebastian DiLorenzo <dilorenzo.sebastian at gmail.com> 1343304042 +0200	commit: small fix
+bdec9f453741b1bd726b962081c3cb23a55b5850 34f65c8adcc4f05d5cc22b12a45fe39e478fb22d Sebastian DiLorenzo <dilorenzo.sebastian at gmail.com> 1343380211 +0200	commit: Fixed issue with GC normalization for hg18 genome
+34f65c8adcc4f05d5cc22b12a45fe39e478fb22d 10df9fbfcca0bf63efe178dfedaaa088ef576cfc Sebastian DiLorenzo <dilorenzo.sebastian at gmail.com> 1343640291 +0200	commit: 1st attempt to fix issue with plotting for hg18 where a chromosomes q arm was out of bounds
+10df9fbfcca0bf63efe178dfedaaa088ef576cfc 17891c7c194410b1747a94e33f9c2648f432d8c2 Sebastian DiLorenzo <dilorenzo.sebastian at gmail.com> 1343647383 +0200	commit: attempt two at aforementioned fix
+17891c7c194410b1747a94e33f9c2648f432d8c2 35f1886365a9d8657fba40e6e1e535b07a8d3968 Sebastian DiLorenzo <dilorenzo.sebastian at gmail.com> 1343647843 +0200	commit: Instating fix for all plotting funktions
+35f1886365a9d8657fba40e6e1e535b07a8d3968 dce9edf1dd01665c7e266395f3ad217738315c02 Sebastian DiLorenzo <dilorenzo.sebastian at gmail.com> 1346418135 +0200	commit: kommented line 42 pw.alleledata
+dce9edf1dd01665c7e266395f3ad217738315c02 d5df007a35dcbf109f45dd0c15d100996ee41b9b Sebastian DiLorenzo <dilorenzo.sebastian at gmail.com> 1346420997 +0200	commit: update homepage info slightly
+d5df007a35dcbf109f45dd0c15d100996ee41b9b 0ea92759a953e9e176617cf22b4050ce2fed0bef Sebastian DiLorenzo <dilorenzo.sebastian at gmail.com> 1346421578 +0200	commit: updated changelog and description

Modified: .git/logs/refs/remotes/origin/master
===================================================================
--- .git/logs/refs/remotes/origin/master	2012-07-10 08:38:08 UTC (rev 146)
+++ .git/logs/refs/remotes/origin/master	2012-08-31 14:06:07 UTC (rev 147)
@@ -2,3 +2,17 @@
 6980fef84a3043d074fe5e46a935b84815d90e03 693c0c176e7aaf19c80e78373ef88877e785cd91 Sebastian DiLorenzo <dilorenzo.sebastian at gmail.com> 1340970693 +0200	update by push
 693c0c176e7aaf19c80e78373ef88877e785cd91 598eb7173584784980db9537d26490901a99827d Sebastian DiLorenzo <dilorenzo.sebastian at gmail.com> 1341908930 +0200	update by push
 598eb7173584784980db9537d26490901a99827d f33a41d4b92635e2b52ac0bb8a49d6990ed7089c Sebastian DiLorenzo <dilorenzo.sebastian at gmail.com> 1341909278 +0200	update by push
+f33a41d4b92635e2b52ac0bb8a49d6990ed7089c 43b7aa7a22e01b59c2df83ba5f31397d14da5776 Sebastian DiLorenzo <dilorenzo.sebastian at gmail.com> 1342704696 +0200	update by push
+43b7aa7a22e01b59c2df83ba5f31397d14da5776 371c5760912b78ab024065568d5345a48eb9b9ec Sebastian DiLorenzo <dilorenzo.sebastian at gmail.com> 1343055233 +0200	update by push
+371c5760912b78ab024065568d5345a48eb9b9ec e6c3a237cfa5fa54811afb1890ef826c120f427e Sebastian DiLorenzo <dilorenzo.sebastian at gmail.com> 1343199889 +0200	update by push
+e6c3a237cfa5fa54811afb1890ef826c120f427e 3f9661bba372409a8ee35496472dd90554751e97 Sebastian DiLorenzo <dilorenzo.sebastian at gmail.com> 1343222528 +0200	update by push
+3f9661bba372409a8ee35496472dd90554751e97 a1e1ad2eec2208f03abfc56a426c03d3ea7971fd Sebastian DiLorenzo <dilorenzo.sebastian at gmail.com> 1343292952 +0200	update by push
+a1e1ad2eec2208f03abfc56a426c03d3ea7971fd 47e355dc3c2c8f2572996b6a6862eecdbaf84cfb Sebastian DiLorenzo <S_D at p227-208.akkis.uu.se> 1343296008 +0200	pull : fast-forward
+47e355dc3c2c8f2572996b6a6862eecdbaf84cfb bdec9f453741b1bd726b962081c3cb23a55b5850 Sebastian DiLorenzo <dilorenzo.sebastian at gmail.com> 1343304075 +0200	update by push
+bdec9f453741b1bd726b962081c3cb23a55b5850 34f65c8adcc4f05d5cc22b12a45fe39e478fb22d Sebastian DiLorenzo <dilorenzo.sebastian at gmail.com> 1343380225 +0200	update by push
+34f65c8adcc4f05d5cc22b12a45fe39e478fb22d 10df9fbfcca0bf63efe178dfedaaa088ef576cfc Sebastian DiLorenzo <dilorenzo.sebastian at gmail.com> 1343640307 +0200	update by push
+10df9fbfcca0bf63efe178dfedaaa088ef576cfc 17891c7c194410b1747a94e33f9c2648f432d8c2 Sebastian DiLorenzo <dilorenzo.sebastian at gmail.com> 1343647399 +0200	update by push
+17891c7c194410b1747a94e33f9c2648f432d8c2 35f1886365a9d8657fba40e6e1e535b07a8d3968 Sebastian DiLorenzo <dilorenzo.sebastian at gmail.com> 1343647856 +0200	update by push
+35f1886365a9d8657fba40e6e1e535b07a8d3968 dce9edf1dd01665c7e266395f3ad217738315c02 Sebastian DiLorenzo <dilorenzo.sebastian at gmail.com> 1346418153 +0200	update by push
+dce9edf1dd01665c7e266395f3ad217738315c02 d5df007a35dcbf109f45dd0c15d100996ee41b9b Sebastian DiLorenzo <dilorenzo.sebastian at gmail.com> 1346421012 +0200	update by push
+d5df007a35dcbf109f45dd0c15d100996ee41b9b 0ea92759a953e9e176617cf22b4050ce2fed0bef Sebastian DiLorenzo <dilorenzo.sebastian at gmail.com> 1346421591 +0200	update by push

Modified: .git/refs/heads/master
===================================================================
--- .git/refs/heads/master	2012-07-10 08:38:08 UTC (rev 146)
+++ .git/refs/heads/master	2012-08-31 14:06:07 UTC (rev 147)
@@ -1 +1 @@
-f33a41d4b92635e2b52ac0bb8a49d6990ed7089c
+0ea92759a953e9e176617cf22b4050ce2fed0bef

Modified: .git/refs/remotes/origin/master
===================================================================
--- .git/refs/remotes/origin/master	2012-07-10 08:38:08 UTC (rev 146)
+++ .git/refs/remotes/origin/master	2012-08-31 14:06:07 UTC (rev 147)
@@ -1 +1 @@
-f33a41d4b92635e2b52ac0bb8a49d6990ed7089c
+0ea92759a953e9e176617cf22b4050ce2fed0bef

Modified: .gitignore
===================================================================
--- .gitignore	2012-07-10 08:38:08 UTC (rev 146)
+++ .gitignore	2012-08-31 14:06:07 UTC (rev 147)
@@ -1,2 +1,3 @@
 .DS_Store
 .svn/
+._.DS_Store

Modified: pkg/patchwork/DESCRIPTION
===================================================================
--- pkg/patchwork/DESCRIPTION	2012-07-10 08:38:08 UTC (rev 146)
+++ pkg/patchwork/DESCRIPTION	2012-08-31 14:06:07 UTC (rev 147)
@@ -1,8 +1,8 @@
 Package: patchwork
 Type: Package
 Title: Allele-specific Copy Number Analysis of whole genome data
-Version: 2.1
-Date: 2012-17-04
+Version: 2.2
+Date: 2012-30-08
 Author: Markus Rasmussen, Sebastian DiLorenzo
 Maintainer: Markus Rasmussen <Markus.Mayrhofer at medsci.uu.se>
 Description: Performs a copy number analysis of whole genome data.

Modified: pkg/patchwork/R/karyotype.r
===================================================================
--- pkg/patchwork/R/karyotype.r	2012-07-10 08:38:08 UTC (rev 146)
+++ pkg/patchwork/R/karyotype.r	2012-08-31 14:06:07 UTC (rev 147)
@@ -46,6 +46,34 @@
 
             col[ix_p] = paste(loc_p[ceiling(pos[ix_p]/100)],'70',sep='')
             col[ix_q] = paste(loc_q[ceiling((pos[ix_q]-this$end)/100)],'70',sep='')
+
+            #In some cases, it seems HG18, we get an out of bounds for the segments colors.
+            #This results in a NA which calls the color NA70 which obviously does not exists.
+            #To solve this i catch these extremes and simply give them the most extreme color.
+            #It should only possibly happen at the ends as loc_Q/loc_p start at 1.
+
+            #End of loc_p failed
+            p = length(col[ix_p])
+            if(p >= 1)
+                {
+                while(col[ix_p][p]=="NA70")
+                    {
+                    col[ix_p][p] = paste(loc_p[length(loc_p)],'70',sep='')
+                    p = p - 1
+                    }
+                }
+
+            #End of loc_q failed
+            q = length(col[ix_q])
+            if(q >= 1)
+                {
+                while(col[ix_q][q]=="NA70")
+                    {
+                    col[ix_q][q] = paste(loc_q[length(loc_q)],'70',sep='')
+                    q = q - 1
+                    }
+                }
+
  
         	plot(c(int[!ix],int[ix]),c(ai[!ix],ai[ix]),
         		pch=16,

Modified: pkg/patchwork/R/karyotype_chroms.r
===================================================================
--- pkg/patchwork/R/karyotype_chroms.r	2012-07-10 08:38:08 UTC (rev 146)
+++ pkg/patchwork/R/karyotype_chroms.r	2012-08-31 14:06:07 UTC (rev 147)
@@ -49,6 +49,33 @@
 
             col[ix_p] = paste(loc_p[ceiling(pos[ix_p]/100)],'70',sep='')
             col[ix_q] = paste(loc_q[ceiling((pos[ix_q]-this$end)/100)],'70',sep='')
+
+            #In some cases, it seems HG18, we get an out of bounds for the segments colors.
+            #This results in a NA which calls the color NA70 which obviously does not exists.
+            #To solve this i catch these extremes and simply give them the most extreme color.
+            #It should only possibly happen at the ends as loc_Q/loc_p start at 1.
+
+            #End of loc_p failed
+            p = length(col[ix_p])
+            if(p >= 1)
+                {
+                while(col[ix_p][p]=="NA70")
+                    {
+                    col[ix_p][p] = paste(loc_p[length(loc_p)],'70',sep='')
+                    p = p - 1
+                    }
+                }
+
+            #End of loc_q failed
+            q = length(col[ix_q])
+            if(q >= 1)
+                {
+                while(col[ix_q][q]=="NA70")
+                    {
+                    col[ix_q][q] = paste(loc_q[length(loc_q)],'70',sep='')
+                    q = q - 1
+                    }
+                }
         
         	plot(c(int[!ix],int[ix]),c(ai[!ix],ai[ix]),
             	pch=16,

Modified: pkg/patchwork/R/karyotype_chromsCN.r
===================================================================
--- pkg/patchwork/R/karyotype_chromsCN.r	2012-07-10 08:38:08 UTC (rev 146)
+++ pkg/patchwork/R/karyotype_chromsCN.r	2012-08-31 14:06:07 UTC (rev 147)
@@ -50,6 +50,33 @@
 
             col[ix_p] = paste(loc_p[ceiling(pos[ix_p]/100)],'70',sep='')
             col[ix_q] = paste(loc_q[ceiling((pos[ix_q]-this$end)/100)],'70',sep='')
+
+            #In some cases, it seems HG18, we get an out of bounds for the segments colors.
+            #This results in a NA which calls the color NA70 which obviously does not exists.
+            #To solve this i catch these extremes and simply give them the most extreme color.
+            #It should only possibly happen at the ends as loc_Q/loc_p start at 1.
+
+            #End of loc_p failed
+            p = length(col[ix_p])
+            if(p >= 1)
+                {
+                while(col[ix_p][p]=="NA70")
+                    {
+                    col[ix_p][p] = paste(loc_p[length(loc_p)],'70',sep='')
+                    p = p - 1
+                    }
+                }
+
+            #End of loc_q failed
+            q = length(col[ix_q])
+            if(q >= 1)
+                {
+                while(col[ix_q][q]=="NA70")
+                    {
+                    col[ix_q][q] = paste(loc_q[length(loc_q)],'70',sep='')
+                    q = q - 1
+                    }
+                }
         
         	plot(c(int[!ix],int[ix]),c(ai[!ix],ai[ix]),
             	pch=16,

Modified: pkg/patchwork/R/patchwork.GCNorm.r
===================================================================
--- pkg/patchwork/R/patchwork.GCNorm.r	2012-07-10 08:38:08 UTC (rev 146)
+++ pkg/patchwork/R/patchwork.GCNorm.r	2012-08-31 14:06:07 UTC (rev 147)
@@ -7,6 +7,11 @@
 
 	## GC content normalization
 	info = data.frame(from=c(0,seq(10,90,2)),to=c(seq(10,90,2),100),mean=NA,median=NA,np=NA)
+
+	#Remove NA's from gc and gck. I have only ever seen NA's in gck for HG18 genome.
+	data = data[!is.na(data$gc),]
+	data = data[!is.na(data$gck),]
+	
 	xnorm = data$counts
 	
 	#1st round
@@ -18,15 +23,7 @@
 		info$sd[i] = sd(data$counts[ix])
 		info$np[i] = sum(ix)
 		xnorm[ix] = 1 * ( data$counts[ix] / info$mean[i] )
-		}
-	
-	#xnorm = data$counts
-	
-	#for (i in 1:nrow(info))
-	#	{
-	#	ix = (data$gc >= info$from[i]) & (data$gc <= info$to[i])
-	#	xnorm[ix] = 1 * ( data$counts[ix] / info$mean[i] )
-	#	}
+		}	
 		
 	xnorm = round(xnorm,2)
 		
@@ -43,14 +40,7 @@
 		info2$np[i] = sum(ix)
 		xnorm2[ix] = 1 * ( xnorm[ix] / info2$mean[i] )
 		}
-		
-	#xnorm2 = xnorm
-	#for (i in 1:nrow(info2))
-	#	{
-	#	ix = (data$gck >= info2$from[i]) & (data$gck <= info2$to[i])
-	#	xnorm2[ix] = 1 * ( xnorm[ix] / info2$mean[i] )
-	#	}
-		
+
 	xnorm2 = round(xnorm2,2)
 	data$norm=xnorm2
 	return(data)

Modified: pkg/patchwork/R/patchwork.alleledata.r
===================================================================
--- pkg/patchwork/R/patchwork.alleledata.r	2012-07-10 08:38:08 UTC (rev 146)
+++ pkg/patchwork/R/patchwork.alleledata.r	2012-08-31 14:06:07 UTC (rev 147)
@@ -1,4 +1,4 @@
-patchwork.alleledata <- function(Pileup, normalalf=NULL)
+patchwork.alleledata <- function(Pileup, normalalf=NULL, vcf)
 	{
 	
 	#Load data included in package
@@ -15,16 +15,31 @@
 	#	setwd("..")
 	#	system("rm -r .perl")
 	#	}
-	
+
+	#Copy perl information from package install location
 	system(paste("cp -r ",packagepath,"/perl .perl",sep=""))
-	system(paste("cat ",Pileup," | perl .perl/pile2alleles.pl > ",getwd(),"/pile.alleles",sep=""))
-	system("rm -r .perl")
-	alf = read.csv('pile.alleles', sep='\t',header=F)[,1:6]
-	#system("rm pile.alleles")
+
+	if (is.null(vcf)==F)
+		{
+		#mpileup and bcftools used. read the pileup and vcf.
+		system(paste("perl .perl/mpile2alleles.pl ",Pileup," ",vcf," >",getwd(),"/pile.alleles",sep=""))
+		}
+		else 
+		{
+		#old samtools pileup -vcf used.
+		system(paste("cat ",Pileup," | perl .perl/pile2alleles.pl > ",getwd(),"/pile.alleles",sep=""))
+		}
+
+		#Cleanup
+		system("rm -r .perl")
+
+		#Read the generated pile.alleles
+		alf = read.csv('pile.alleles', sep='\t',header=F)[,1:6]
+		#system("rm pile.alleles")
 	
 	colnames(alf) = c('achr','apos','atype','aqual','atot','amut')
 	alf$aref = alf$atot - alf$amut
-	alf = alf [alf$amut >= 1 & alf$aref >= 1,]
+	#alf = alf [alf$amut >= 1 & alf$aref >= 1,]
 	alf$amax = apply(alf[,6:7],1,max)
 	alf$amin = alf$atot-alf$amax
 	#alf=alf[alf$atot<100,] # outlierz
@@ -52,6 +67,7 @@
 	#Check if HG18 or HG19 should be applied
 	con = file(Pileup,"rt")
 	firstline = readLines(con,1)
+	close(con)
 	hgcheck = strsplit(firstline,"\t")
 
 
@@ -64,13 +80,13 @@
 		data(commonSnps132,package="patchworkData")
 		}
 
-	alf=merge(alf,dbSnp[,c(1,3)], all=F, by=1:2)
+	alf=merge(alf,dbSnp[,c(1,3)], all.x=T, all.y=F, by=1:2)
 
 	#Finally, if a matched normal was available, remove SNPs that were not (somewhat) heterozygous there.
-	if (!is.null(normalalf)) {
-		normalalf <- normalalf[normalalf$amin/normalalf$atot > 0.1,]
-		alf <- merge(normalalf[,1:2],alf,by=1:2,all=F)
-	}
+	#if (!is.null(normalalf)) {
+	#	normalalf <- normalalf[normalalf$amin/normalalf$atot > 0.1,]
+	#	alf <- merge(normalalf[,1:2],alf,by=1:2,all=F)
+	#}
 	
 	return(alf)
 	}

Modified: pkg/patchwork/R/patchwork.copynumbers.r
===================================================================
--- pkg/patchwork/R/patchwork.copynumbers.r	2012-07-10 08:38:08 UTC (rev 146)
+++ pkg/patchwork/R/patchwork.copynumbers.r	2012-08-31 14:06:07 UTC (rev 147)
@@ -275,11 +275,16 @@
     regions$mCn <- mCn
     regions$fullCN <- fullCN
 	
+    temp <- temp[!is.na(temp$Cn),]
     temp <- regions[is.autosome(regions$chr),]
-	meanCn <- weightedMean(temp$Cn,temp$np)
+	
+ 
+    meanCn <- weightedMean(temp$Cn,temp$np)
 	ix1 <- temp$Cn==trunc(meanCn)
 	ix2 <- temp$Cn==ceiling(meanCn)
 	xdelta <- weightedMean(temp$median[ix2],temp$np[ix2]) - weightedMean(temp$median[ix1],temp$np[ix1])
+    xdelta <- xdelta / weightedMean(temp$median,temp$np)
+
 	expected_delta <- 1/meanCn
 	
 	tumor_percentDNA <- xdelta / expected_delta
@@ -319,11 +324,11 @@
     write.csv(regions,file=paste(name,'_Copynumbers.csv',sep=""))
 
 
-	karyotype_check(regions$chr,regions$start,regions$end,regions$mean,regions$ai,
+	karyotype_check(regions$chr,regions$start,regions$end,regions$median,regions$ai,
 					regions$Cn,regions$mCn,list(int=int,ai=ai),name=name,
 					xlim=c(0,2.4),ylim=c(0.1,1))
 					
-	karyotype_chromsCN(regions$chr,regions$start,regions$end,regions$mean,regions$ai,
+	karyotype_chromsCN(regions$chr,regions$start,regions$end,regions$median,regions$ai,
 						regions$Cn,regions$mCn,kbsegs$chr,
 						kbsegs$pos,kbsegs$ratio,alf$achr,alf$apos,
 						(1-alf$amin/alf$amax),name=name,xlim=c(0,2.4),

Modified: pkg/patchwork/R/patchwork.plot.r
===================================================================
--- pkg/patchwork/R/patchwork.plot.r	2012-07-10 08:38:08 UTC (rev 146)
+++ pkg/patchwork/R/patchwork.plot.r	2012-08-31 14:06:07 UTC (rev 147)
@@ -1,122 +1,148 @@
-patchwork.plot <- function(BamFile,Pileup,Reference=NULL,Normal.bam=NULL,Normal.pileup=NULL,Alpha=0.0001,SD=1)
+patchwork.plot <- function(Tumor.bam,Tumor.pileup,Tumor.vcf=NULL,Normal.bam=NULL,Normal.pileup=NULL,Normal.vcf=NULL,
+							Reference=NULL,Alpha=0.0001,SD=1)
 	{
 
-	name = strsplit(tolower(BamFile),".bam")
+	#Extract the name from tumor.bam
 
+	name = strsplit(tolower(Tumor.bam),".bam")
+
 	name = strsplit(name[[1]],"/")
 
 	name = name[[1]][length(name[[1]])]
 
-	#Attempt to read file pile.alleles, incase its already been created.
 	alf <- normalalf <- NULL
-	try( load(paste(name,"_pile.alleles.Rdata",sep="")), silent=TRUE )
-	
-	#If it wasnt created, create it using the perl script pile2alleles.pl
-	#which is included in the package. Creates pile.alleles in whichever folder
-	#you are running R from. (getwd())
+
+	#Main check function. If this passes, and name_copynumbers.Rdata exists
+	#it will jump straight to plotting.
+	try( load(paste(name,"_copynumbers.Rdata",sep="")),silent=TRUE)
+
 	if(is.null(alf))
 		{
-		cat("Initiating Allele Data Generation \n")
-		if (!is.null(Normal.pileup)) normalalf <- patchwork.alleledata(Normal.pileup)
-		alf = patchwork.alleledata(Pileup, normalalf=normalalf)
-		cat("Allele Data Generation Complete \n")
-		save(alf,file=paste(name,"_pile.alleles.Rdata",sep=""))
-		}
+		#Attempt to read file pile.alleles, incase its already been created.
+		try( load(paste(name,"_pile.alleles.Rdata",sep="")), silent=TRUE )
 	
-	#Generate chroms object depending on the naming in pileup (alf).
-	#either chr1...chr22,chrX,chrY or 1...22,X,Y
-	data(ideogram,package="patchworkData")
+		#If it wasnt created, create it using the perl script pile2alleles.pl
+		#which is included in the package. Creates pile.alleles in whichever folder
+		#you are running R from. (getwd())
+		if(is.null(alf))
+			{
+			cat("Initiating Allele Data Generation \n")
+			if (!is.null(Normal.pileup)) normalalf <- patchwork.alleledata(Normal.pileup, vcf=Normal.vcf)
+			alf = patchwork.alleledata(Tumor.pileup, normalalf=normalalf,Tumor.vcf)
+			cat("Allele Data Generation Complete \n")
+			save(alf, normalalf,file=paste(name,"_pile.alleles.Rdata",sep=""))
+			}
 	
-	chroms = as.character(unique(ideogram$chr))	
+		if (!is.null(normalalf)) 
+			{
+			normalalf <- normalalf[normalalf$amin/normalalf$atot > 0.2,]
+			alf <- merge(normalalf[,1:2],alf,by=1:2,all=F)
+			}
+
+
+
+
+		#Generate chroms object depending on the naming in pileup (alf).
+		#either chr1...chr22,chrX,chrY or 1...22,X,Y
+		data(ideogram,package="patchworkData")
 	
-	## Read coverage data. If already done, will load "data.Rdata" instead.
-	data <- normaldata <- NULL
-	try ( load(paste(name,"_data.Rdata",sep="")), silent=TRUE )
+		chroms = as.character(unique(ideogram$chr))	
 	
-	#If data object does not exist, IE it was not loaded in the previous line
-	#perform the function on the chromosomes to create the object.
-	if(is.null(data)) {
-		cat("Initiating Read Chromosomal Coverage \n")
-		data = patchwork.readChroms(BamFile,chroms)
-		cat("Read Chromosomal Coverage Complete \n")
-		save(data,file=paste(name,"_data.Rdata",sep=""))
-	}
+		## Read coverage data. If already done, will load "data.Rdata" instead.
+		data <- normaldata <- NULL
+		try ( load(paste(name,"_data.Rdata",sep="")), silent=TRUE )
 	
-	#Perform GC normalization if the amount of columns indicate that gc normalization
-	#has not already been performed.
-	if(length(data) < 7) {
-		cat("Initiating GC Content Normalization \n")
-		data = patchwork.GCNorm(data)
-		cat("GC Content Normalization Complete \n")
-		save(data,file=paste(name,"_data.Rdata",sep=""))
-	}
-	#after this, no further normalization was done on reference sequences.
+		#If data object does not exist, IE it was not loaded in the previous line
+		#perform the function on the chromosomes to create the object.
+		if(is.null(data)) 
+			{
+			cat("Initiating Read Chromosomal Coverage \n")
+			data = patchwork.readChroms(Tumor.bam,chroms)
+			cat("Read Chromosomal Coverage Complete \n")
+			save(data,file=paste(name,"_data.Rdata",sep=""))
+			}
+	
+		#Perform GC normalization if the amount of columns indicate that gc normalization
+		#has not already been performed.
+		if(length(data) < 7) 
+			{
+			cat("Initiating GC Content Normalization \n")
+			data = patchwork.GCNorm(data)
+			cat("GC Content Normalization Complete \n")
+			save(data,file=paste(name,"_data.Rdata",sep=""))
+			}
+		#after this, no further normalization was done on reference sequences.
 
-	#If matched normal bam file was defined, load and normalize it the same way.
-	if (!is.null(Normal.bam) & is.null(Reference)) {
-		normaldata=NULL
-		try ( load(paste(name,"_normaldata.Rdata",sep="")), silent=TRUE )
-		if(is.null(normaldata)) {
-			cat("Initiating Read Chromosomal Coverage (matched normal) \n")
-			normaldata = patchwork.readChroms(Normal.bam,chroms)
-			cat("Read Chromosomal Coverage Complete (matched normal) \n")
-		}	
-		if(length(normaldata) != 3) {
-			cat("Initiating GC Content Normalization (matched normal) \n")
-			normaldata = patchwork.GCNorm(normaldata[,1:6])
-			cat("GC Content Normalization Complete (matched normal) \n")
-			normaldata <- data.frame(chr=normaldata$chr,pos=normaldata$pos,normal=normaldata$norm)
-			save(normaldata,file=paste(name,"_normaldata.Rdata",sep=""))
-		}
-		#save(normaldata,file='normaldata.Rdata')
-	} 
+		#If matched normal bam file was defined, load and normalize it the same way.
+		if (!is.null(Normal.bam) & is.null(Reference)) 
+			{
+			normaldata=NULL
+			try ( load(paste(name,"_normaldata.Rdata",sep="")), silent=TRUE )
+			if(is.null(normaldata)) 
+				{
+				cat("Initiating Read Chromosomal Coverage (matched normal) \n")
+				normaldata = patchwork.readChroms(Normal.bam,chroms)
+				cat("Read Chromosomal Coverage Complete (matched normal) \n")
+				}	
+			if(length(normaldata) != 3) 
+				{
+				cat("Initiating GC Content Normalization (matched normal) \n")
+				normaldata = patchwork.GCNorm(normaldata[,1:6])
+				cat("GC Content Normalization Complete (matched normal) \n")
+				normaldata <- data.frame(chr=normaldata$chr,pos=normaldata$pos,normal=normaldata$norm)
+				save(normaldata,file=paste(name,"_normaldata.Rdata",sep=""))
+				}
+			#save(normaldata,file='normaldata.Rdata')
+			} 
 
 	
-	# Smooth the data.
-	kbsegs = NULL
-	try( load(paste(name,"_smoothed.Rdata",sep="")), silent=TRUE )	
-	if(length(kbsegs) == 0)
-		{
-		cat("Initiating Smoothing \n")
-		kbsegs = patchwork.smoothing(data,normaldata,Reference,chroms)
-		save(kbsegs,file=paste(name,"_smoothed.Rdata",sep=""))
-		cat("Smoothing Complete \n")
-		}
+		# Smooth the data.
+		kbsegs = NULL
+		try( load(paste(name,"_smoothed.Rdata",sep="")), silent=TRUE )
+
+		if(length(kbsegs) == 0) 
+			{
+			cat("Initiating Smoothing \n")
+			kbsegs = patchwork.smoothing(data,normaldata,Reference,chroms)
+			save(kbsegs,file=paste(name,"_smoothed.Rdata",sep=""))
+			cat("Smoothing Complete \n")
+			}
 	
-	#Segment the data.
-	library(DNAcopy)
-	segs = NULL
-	try( load(paste(name,"_Segments.Rdata",sep="")), silent=TRUE )
-	if(length(segs) == 0)
-		{
-		cat("Initiating Segmentation \n")
-		cat("Note: If segmentation fails to initiate the probable reason is that you have not ")
-		cat("installed the R package DNAcopy. See the homepage, http://patchwork.r-forge.r-project.org/ ,
-			or ?patchwork.readme for installation instructions. \n")
-		segs = patchwork.segment(kbsegs,chroms,Alpha,SD)
-		save(segs,file=paste(name,"_Segments.Rdata",sep=""))
-		cat("Segmentation Complete \n")
-		}
+		#Segment the data.
+		library(DNAcopy)
+		segs = NULL
+		try( load(paste(name,"_Segments.Rdata",sep="")), silent=TRUE )
+		if(length(segs) == 0)
+			{
+			cat("Initiating Segmentation \n")
+			cat("Note: If segmentation fails to initiate the probable reason is that you have not ")
+			cat("installed the R package DNAcopy. See the homepage, http://patchwork.r-forge.r-project.org/ ,
+				or ?patchwork.readme for installation instructions. \n")
+			segs = patchwork.segment(kbsegs,chroms,Alpha,SD)
+			save(segs,file=paste(name,"_Segments.Rdata",sep=""))
+			cat("Segmentation Complete \n")
+			}
 
-#Assign AI to kbsegs. (not in use atm)
-object = assignAI(alf$achr,alf$apos,alf$amin,alf$amax,
-	kbsegs$chr,(kbsegs$pos-5000),(kbsegs$pos+5000))
+		#Assign AI to kbsegs. (not in use atm)
+		object = assignAI(alf$achr,alf$apos,alf$amin,alf$amax,
+		kbsegs$chr,(kbsegs$pos-5000),(kbsegs$pos+5000))
 
-kbsegs = cbind(kbsegs[,1:5],object[,4])
-colnames(kbsegs)=c("chr","pos","coverage","refcoverage","ratio","ai")
+		kbsegs = cbind(kbsegs[,1:5],object[,4])
+		colnames(kbsegs)=c("chr","pos","coverage","refcoverage","ratio","ai")
 		
-	if(length(segs) == 6)
-		{
-		#Get medians and AI for the segments.
-		cat("Initiating Segment data extraction (Medians and AI) \n")
-		segs = patchwork.Medians_n_AI(segs,kbsegs,alf)
-		save(segs,file=paste(name,"_Segments.Rdata",sep=""))
-		cat("Segment data extraction Complete \n \n \n")
+		if(length(segs) == 6)
+			{
+			#Get medians and AI for the segments.
+			cat("Initiating Segment data extraction (Medians and AI) \n")
+			segs = patchwork.Medians_n_AI(segs,kbsegs,alf)
+			save(segs,file=paste(name,"_Segments.Rdata",sep=""))
+			cat("Segment data extraction Complete \n \n \n")
+			}
+	
+		cat(paste("Saving information objects needed for patchwork.copynumbers() in ",name,"_copynumbers.Rdata \n \n \n",sep=""))
+		save(segs,alf,kbsegs,file=paste(name,"_copynumbers.Rdata",sep=""))
 		}
 	
-	cat(paste("Saving information objects needed for patchwork.copynumbers() in ",name,"_copynumbers.Rdata \n \n \n",sep=""))
-	save(segs,alf,kbsegs,file=paste(name,"_copynumbers.Rdata",sep=""))
-	
 	#Plot it
 	cat("Initiating Plotting \n")
 	karyotype(segs$chr,segs$start,segs$end,segs$median,segs$ai,

Modified: pkg/patchwork/R/patchwork.readChroms.r
===================================================================
--- pkg/patchwork/R/patchwork.readChroms.r	2012-07-10 08:38:08 UTC (rev 146)
+++ pkg/patchwork/R/patchwork.readChroms.r	2012-08-31 14:06:07 UTC (rev 147)
@@ -79,6 +79,8 @@
 			gc = readRDS(paste(datapath,"/extdata/",c,".mark.rds",sep=""))
 			}
 
+		gc = gc[!is.na(gc$pos) & !is.na(gc$gc250),]
+		gc = gc[order(gc$pos),]
 		xpos=gc[,1]
 		xgc=gc[,2]
 		xgck=gc[,3]

Modified: pkg/patchwork/R/patchwork.segment.r
===================================================================
--- pkg/patchwork/R/patchwork.segment.r	2012-07-10 08:38:08 UTC (rev 146)
[TRUNCATED]

To get the complete diff run:
    svnlook diff /svnroot/patchwork -r 147


More information about the Patchwork-commits mailing list