Mercurial > repos > modencode-dcc > idr_package
comparison batch-consistency-analysis.r @ 17:46f86cea5a47 draft
Uploaded
author | modencode-dcc |
---|---|
date | Mon, 21 Jan 2013 11:22:00 -0500 |
parents | 161cdd2396f7 |
children | bd2ff5799c1a |
comparison
equal
deleted
inserted
replaced
16:24055dbb63b2 | 17:46f86cea5a47 |
---|---|
37 args <- commandArgs(trailingOnly=T) | 37 args <- commandArgs(trailingOnly=T) |
38 | 38 |
39 # consistency between peakfile1 and peakfile2 | 39 # consistency between peakfile1 and peakfile2 |
40 #input1.dir <- args[1] | 40 #input1.dir <- args[1] |
41 #input2.dir <- args[2] # directories of the two input files | 41 #input2.dir <- args[2] # directories of the two input files |
42 peakfile1 <- args[1] | 42 script_path <- args[1] |
43 peakfile2 <- args[2] | 43 peakfile1 <- args[2] |
44 peakfile2 <- args[3] | |
44 | 45 |
45 if(as.numeric(args[3])==-1){ # enter -1 when using the reported length | 46 if(as.numeric(args[4])==-1){ # enter -1 when using the reported length |
46 half.width <- NULL | 47 half.width <- NULL |
47 }else{ | 48 }else{ |
48 half.width <- as.numeric(args[3]) | 49 half.width <- as.numeric(args[4]) |
49 } | 50 } |
50 | 51 |
51 overlap.ratio <- args[4] | 52 overlap.ratio <- args[5] |
52 | 53 |
53 if(args[5] == "T"){ | 54 if(args[6] == "T"){ |
54 is.broadpeak <- T | 55 is.broadpeak <- T |
55 }else{ | 56 }else{ |
56 is.broadpeak <- F | 57 is.broadpeak <- F |
57 } | 58 } |
58 | 59 |
59 sig.value <- args[6] | 60 sig.value <- args[7] |
60 script_path <- args[13] | |
61 | 61 |
62 #dir1 <- "~/ENCODE/anshul/data/" | 62 #dir1 <- "~/ENCODE/anshul/data/" |
63 #dir2 <- dir1 | 63 #dir2 <- dir1 |
64 #peakfile1 <- "../data/SPP.YaleRep1Gm12878Cfos.VS.Gm12878Input.PointPeak.narrowPeak" | 64 #peakfile1 <- "../data/SPP.YaleRep1Gm12878Cfos.VS.Gm12878Input.PointPeak.narrowPeak" |
65 #peakfile2 <- "../data/SPP.YaleRep3Gm12878Cfos.VS.Gm12878Input.PointPeak.narrowPeak" | 65 #peakfile2 <- "../data/SPP.YaleRep3Gm12878Cfos.VS.Gm12878Input.PointPeak.narrowPeak" |
70 | 70 |
71 source(paste(script_path, "/functions-all-clayton-12-13.r", sep="")) | 71 source(paste(script_path, "/functions-all-clayton-12-13.r", sep="")) |
72 | 72 |
73 # read the length of the chromosomes, which will be used to concatenate chr's | 73 # read the length of the chromosomes, which will be used to concatenate chr's |
74 # chr.file <- "genome_table.txt" | 74 # chr.file <- "genome_table.txt" |
75 # args[7] is the gtable | 75 # args[8] is the gtable |
76 chr.file <- args[7] | 76 chr.file <- args[8] |
77 | 77 |
78 chr.size <- read.table(chr.file) | 78 chr.size <- read.table(chr.file) |
79 | 79 |
80 # setting output files | 80 # setting output files |
81 r.output <- args[8] | 81 r.output <- args[9] |
82 overlap.output <- args[9] | 82 overlap.output <- args[10] |
83 npeaks.output <- args[10] | 83 npeaks.output <- args[11] |
84 em.sav.output <- args[11] | 84 em.sav.output <- args[12] |
85 uri.sav.output <- args[12] | 85 uri.sav.output <- args[13] |
86 | 86 |
87 # sink(paste(output.prefix, "-Rout.txt", sep="")) | 87 # sink(paste(output.prefix, "-Rout.txt", sep="")) |
88 sink(r.output) | 88 sink(r.output) |
89 | 89 |
90 ############# process the data | 90 ############# process the data |
93 rep1 <- process.narrowpeak(paste(peakfile1, sep=""), chr.size, half.width=half.width, summit="offset", broadpeak=is.broadpeak) | 93 rep1 <- process.narrowpeak(paste(peakfile1, sep=""), chr.size, half.width=half.width, summit="offset", broadpeak=is.broadpeak) |
94 rep2 <- process.narrowpeak(paste(peakfile2, sep=""), chr.size, half.width=half.width, summit="offset", broadpeak=is.broadpeak) | 94 rep2 <- process.narrowpeak(paste(peakfile2, sep=""), chr.size, half.width=half.width, summit="offset", broadpeak=is.broadpeak) |
95 | 95 |
96 cat(paste("read", peakfile1, ": ", nrow(rep1$data.ori), "peaks\n", nrow(rep1$data.cleaned), "peaks are left after cleaning\n", peakfile2, ": ", nrow(rep2$data.ori), "peaks\n", nrow(rep2$data.cleaned), " peaks are left after cleaning")) | 96 cat(paste("read", peakfile1, ": ", nrow(rep1$data.ori), "peaks\n", nrow(rep1$data.cleaned), "peaks are left after cleaning\n", peakfile2, ": ", nrow(rep2$data.ori), "peaks\n", nrow(rep2$data.cleaned), " peaks are left after cleaning")) |
97 | 97 |
98 if(args[3]==-1){ | 98 if(args[4]==-1){ |
99 cat(paste("half.width=", "reported", "\n")) | 99 cat(paste("half.width=", "reported", "\n")) |
100 }else{ | 100 }else{ |
101 cat(paste("half.width=", half.width, "\n")) | 101 cat(paste("half.width=", half.width, "\n")) |
102 } | 102 } |
103 cat(paste("significant measure=", sig.value, "\n")) | 103 cat(paste("significant measure=", sig.value, "\n")) |