From noreply at r-forge.r-project.org Fri Feb 3 13:39:13 2017 From: noreply at r-forge.r-project.org (noreply at r-forge.r-project.org) Date: Fri, 3 Feb 2017 13:39:13 +0100 (CET) Subject: [Patchwork-commits] r220 - / .git .git/logs .git/logs/refs/heads .git/logs/refs/remotes/origin .git/refs/heads .git/refs/remotes/origin pkg/patchwork/R Message-ID: <20170203123913.33BDB187B12@r-forge.r-project.org> Author: sebastian_d Date: 2017-02-03 13:39:12 +0100 (Fri, 03 Feb 2017) New Revision: 220 Modified: .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 README pkg/patchwork/R/patchwork.plot.r Log: adding info that either reference or normal should be given, but not both Modified: .git/index =================================================================== (Binary files differ) Modified: .git/logs/HEAD =================================================================== --- .git/logs/HEAD 2015-11-23 09:54:36 UTC (rev 219) +++ .git/logs/HEAD 2017-02-03 12:39:12 UTC (rev 220) @@ -102,3 +102,4 @@ 52402622419759bc3642b6f49dd0f4abd2003d38 4bbde19cc8582ba3fb6caf01b1b01165c5db15d6 Sebastian DiLorenzo 1435303966 +0200 pull: Fast-forward 4bbde19cc8582ba3fb6caf01b1b01165c5db15d6 0a1de5c432ad323bbac1093425e9a939f351b50b Sebastian DiLorenzo 1445255649 +0200 pull: Fast-forward 0a1de5c432ad323bbac1093425e9a939f351b50b 0b2b81a68a67ce90b6f3c8d65b3cbab6636348b7 Sebastian DiLorenzo 1448272403 +0100 pull: Fast-forward +0b2b81a68a67ce90b6f3c8d65b3cbab6636348b7 905b1a114fbfb770dc9aa4674cb60f9c3e95c68a Sebastian DiLorenzo 1486124938 +0100 pull: Fast-forward Modified: .git/logs/refs/heads/master =================================================================== --- .git/logs/refs/heads/master 2015-11-23 09:54:36 UTC (rev 219) +++ .git/logs/refs/heads/master 2017-02-03 12:39:12 UTC (rev 220) @@ -102,3 +102,4 @@ 52402622419759bc3642b6f49dd0f4abd2003d38 4bbde19cc8582ba3fb6caf01b1b01165c5db15d6 Sebastian DiLorenzo 1435303966 +0200 pull: Fast-forward 4bbde19cc8582ba3fb6caf01b1b01165c5db15d6 0a1de5c432ad323bbac1093425e9a939f351b50b Sebastian DiLorenzo 1445255649 +0200 pull: Fast-forward 0a1de5c432ad323bbac1093425e9a939f351b50b 0b2b81a68a67ce90b6f3c8d65b3cbab6636348b7 Sebastian DiLorenzo 1448272403 +0100 pull: Fast-forward +0b2b81a68a67ce90b6f3c8d65b3cbab6636348b7 905b1a114fbfb770dc9aa4674cb60f9c3e95c68a Sebastian DiLorenzo 1486124938 +0100 pull: Fast-forward Modified: .git/logs/refs/remotes/origin/master =================================================================== --- .git/logs/refs/remotes/origin/master 2015-11-23 09:54:36 UTC (rev 219) +++ .git/logs/refs/remotes/origin/master 2017-02-03 12:39:12 UTC (rev 220) @@ -99,3 +99,4 @@ 52402622419759bc3642b6f49dd0f4abd2003d38 4bbde19cc8582ba3fb6caf01b1b01165c5db15d6 Sebastian DiLorenzo 1435303966 +0200 pull: fast-forward 4bbde19cc8582ba3fb6caf01b1b01165c5db15d6 0a1de5c432ad323bbac1093425e9a939f351b50b Sebastian DiLorenzo 1445255649 +0200 pull: fast-forward 0a1de5c432ad323bbac1093425e9a939f351b50b 0b2b81a68a67ce90b6f3c8d65b3cbab6636348b7 Sebastian DiLorenzo 1448272403 +0100 pull: fast-forward +0b2b81a68a67ce90b6f3c8d65b3cbab6636348b7 905b1a114fbfb770dc9aa4674cb60f9c3e95c68a Sebastian DiLorenzo 1486124937 +0100 pull: fast-forward Modified: .git/refs/heads/master =================================================================== --- .git/refs/heads/master 2015-11-23 09:54:36 UTC (rev 219) +++ .git/refs/heads/master 2017-02-03 12:39:12 UTC (rev 220) @@ -1 +1 @@ -0b2b81a68a67ce90b6f3c8d65b3cbab6636348b7 +905b1a114fbfb770dc9aa4674cb60f9c3e95c68a Modified: .git/refs/remotes/origin/master =================================================================== --- .git/refs/remotes/origin/master 2015-11-23 09:54:36 UTC (rev 219) +++ .git/refs/remotes/origin/master 2017-02-03 12:39:12 UTC (rev 220) @@ -1 +1 @@ -0b2b81a68a67ce90b6f3c8d65b3cbab6636348b7 +905b1a114fbfb770dc9aa4674cb60f9c3e95c68a Modified: README =================================================================== --- README 2015-11-23 09:54:36 UTC (rev 219) +++ README 2017-02-03 12:39:12 UTC (rev 220) @@ -1,3 +1,5 @@ +Documentation and manual: http://patchwork.r-forge.r-project.org/ + Patchwork is a bioinformatic tool for analyzing and visualizing allele-specific copy numbers and loss-of-heterozygosity in cancer genomes. The data input is in the format of whole-genome sequencing data which enables characterization of genomic alterations ranging in size from point mutations to entire chromosomes. High quality results are obtained even if samples have low coverage, ~4x, low tumor cell content or are aneuploid. Modified: pkg/patchwork/R/patchwork.plot.r =================================================================== --- pkg/patchwork/R/patchwork.plot.r 2015-11-23 09:54:36 UTC (rev 219) +++ pkg/patchwork/R/patchwork.plot.r 2017-02-03 12:39:12 UTC (rev 220) @@ -7,7 +7,7 @@ { stop("Usage: patchwork.plot(Tumor.bam,Tumor.pileup,Tumor.vcf=NULL,Normal.bam=NULL,Normal.pileup=NULL,Normal.vcf=NULL,Reference=NULL,Alpha=0.0001,SD=1) \n") } - + if(is.null(Normal.bam) & is.null(Reference)) { stop("You must supply either a normal bam or a reference file for patchwork to run properly! \n") @@ -20,8 +20,12 @@ if(!is.null(Tumor.bam) & is.null(Tumor.pileup)) { - stop("You must supply a pileup of the tumor sample (and if later version of samtools its VCF). See http://patchwork.r-forge.r-project.org/ -> Patchwork -> Requirements ") + stop("You must supply a pileup of the tumor sample (and if later version of samtools its VCF). See http://patchwork.r-forge.r-project.org/ -> Patchwork -> Requirements \n") } + if(!is.null(Normal.bam) & !is.null(Reference)) + { + stop("If you have a normal sample you do not need to supply a reference sample. See http://patchwork.r-forge.r-project.org/ -> Patchwork -> Requirements \n") + } #Extract the name from tumor.bam @@ -41,17 +45,17 @@ { #Attempt to read file pile.alleles, incase its already been created. 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()) if(is.null(alf)) { - #If Normal.pileup exists, use with normal.vcf (if mpileup) or without (if pileup) to + #If Normal.pileup exists, use with normal.vcf (if mpileup) or without (if pileup) to #create normalalf in patchwork.alleledata() #Create normalalf - + if (!is.null(Normal.pileup)) { normal.pileup.name = strsplit(Normal.pileup,"/") @@ -59,7 +63,7 @@ normal.pileup.name = normal.pileup.name[[1]][length(normal.pileup.name[[1]])] cat(paste("Initiating Normal Allele Data Generation (",normal.pileup.name,") \n",sep="")) normalalf <- patchwork.alleledata(Normal.pileup, vcf=Normal.vcf) - } + } tumor.pileup.name = strsplit(Tumor.pileup,"/") @@ -87,9 +91,9 @@ cat("Allele Data Generation Complete \n") save(alf, normalalf,file=paste(name,"_pile.alleles.Rdata",sep="")) } - + ## If there is a pileup for matched normal - if (!is.null(normalalf)) + if (!is.null(normalalf)) { ## Extract somatic variants normaltemp=data.frame(achr=normalalf$achr,apos=normalalf$apos,normal=T) @@ -100,7 +104,7 @@ ## Remove all but the heterozygous SNPs normalalf <- normalalf[normalalf$amin/normalalf$atot > 0.2,] alf <- merge(normalalf[,1:2],alf,by=1:2,all=F) - } else + } else { ## If there was NO pileup for matched normal alf <- alf[alf$dbSnp==T,] alf <- alf[alf$amin>1 & alf$aref>2,] @@ -112,26 +116,26 @@ #Generate chroms object depending on the naming in pileup (alf). #either chr1...chr22,chrX,chrY or 1...22,X,Y data(ideogram,package="patchworkData") - - chroms = as.character(unique(ideogram$chr)) - + + chroms = as.character(unique(ideogram$chr)) + ## Read coverage data. If already done, will load "data.Rdata" instead. data <- normaldata <- NULL try ( load(paste(name,"_data.Rdata",sep="")), silent=TRUE ) - + #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)) + 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) + if(length(data) < 7) { cat("Initiating GC Content Normalization \n") data = patchwork.GCNorm(data) @@ -141,17 +145,17 @@ #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)) + if (!is.null(Normal.bam) & is.null(Reference)) { normaldata=NULL try ( load(paste(name,"_normaldata.Rdata",sep="")), silent=TRUE ) - if(is.null(normaldata)) + 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) + } + if(length(normaldata) != 3) { cat("Initiating GC Content Normalization (matched normal) \n") normaldata = patchwork.GCNorm(normaldata[,1:6]) @@ -160,21 +164,21 @@ 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) + 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 @@ -184,7 +188,7 @@ 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") + 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") @@ -196,7 +200,7 @@ #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. @@ -205,11 +209,11 @@ 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="")) } - + #Plot it cat("Initiating Plotting \n") # karyotype(segs$chr,segs$start,segs$end,segs$median,segs$ai, @@ -231,5 +235,3 @@ cat("patchwork.plot Complete.\n") cat("Below you may see some warning messages, you can read about these on our homepage. They are either nothing to be worried about (\"Tried to load file, it didn't exist.\") or something you should send us an email about. \n") } - - \ No newline at end of file