Mercurial > repos > petr-novak > re_utils
comparison ChipSeqRatioAnalysis.R @ 8:99569eccc583 draft
Uploaded
author | petr-novak |
---|---|
date | Mon, 09 Dec 2019 04:14:48 -0500 |
parents | f224513123a1 |
children |
comparison
equal
deleted
inserted
replaced
7:89c5ba120b21 | 8:99569eccc583 |
---|---|
29 | 29 |
30 #arguments | 30 #arguments |
31 args <- commandArgs(trailingOnly = TRUE) | 31 args <- commandArgs(trailingOnly = TRUE) |
32 input <- args[1] | 32 input <- args[1] |
33 HTMLfile <- args[2] | 33 HTMLfile <- args[2] |
34 threshld <- 2/(2+1) | 34 thr = 5 |
35 threshld <- thr/(thr+1) | |
36 | |
35 inputN=as.numeric(args[3]) | 37 inputN=as.numeric(args[3]) |
36 chipN=as.numeric(args[4]) | 38 chipN=as.numeric(args[4]) |
37 #dataframe preprocessing and table creation | 39 #dataframe preprocessing and table creation |
38 df <- read.delim(input, comment.char="#") | 40 df <- read.delim(input, comment.char="#") |
39 | 41 |
53 png(pngfile, width = 1000, height = 1200, pointsize=20) | 55 png(pngfile, width = 1000, height = 1200, pointsize=20) |
54 par(mfrow=c(2,1)) | 56 par(mfrow=c(2,1)) |
55 lims=range(df$"Normalized ratio Chip/Input"[df$"Normalized ratio Chip/Input">0], finite = TRUE) | 57 lims=range(df$"Normalized ratio Chip/Input"[df$"Normalized ratio Chip/Input">0], finite = TRUE) |
56 suppressWarnings(plot(df$Cluster,df$"Normalized ratio Chip/Input", log="y", xlab="Cluster Nr.", ylab="Normalized ChiP/Input ratio", pch=20, ylim=lims)) | 58 suppressWarnings(plot(df$Cluster,df$"Normalized ratio Chip/Input", log="y", xlab="Cluster Nr.", ylab="Normalized ChiP/Input ratio", pch=20, ylim=lims)) |
57 abline(h=1,col='#00000080', lwd = 2) | 59 abline(h=1,col='#00000080', lwd = 2) |
58 abline(h=2,col='#FF000080', lwd = 2) | 60 abline(h=thr,col='#FF000080', lwd = 2) |
59 | 61 |
60 | 62 |
61 suppressWarnings(plot(df$Cluster,df$"Normalized ratio Chip/(Chip+Input)", xlab="Cluster Nr.", ylab="Normalized Chip/(Chip+Input)", pch=20)) | 63 suppressWarnings(plot(df$Cluster,df$"Normalized ratio Chip/(Chip+Input)", xlab="Cluster Nr.", ylab="Normalized Chip/(Chip+Input)", pch=20)) |
62 abline(h=0.5,col='#00000080', lwd = 2) | 64 abline(h=0.5,col='#00000080', lwd = 2) |
63 abline(h=threshld,col='#FF000080', lwd = 2) | 65 abline(h=threshld,col='#FF000080', lwd = 2) |
77 | 79 |
78 | 80 |
79 HTML(graph, file=filename) | 81 HTML(graph, file=filename) |
80 if (nrow(outputTable)>0){ | 82 if (nrow(outputTable)>0){ |
81 HTML(outputTable, file=filename, classtable = "dataframe", | 83 HTML(outputTable, file=filename, classtable = "dataframe", |
82 row.names=FALSE, align='left', caption="Clusters with Normalized ChIP/Input ratio > 2", captionalign="top") | 84 row.names=FALSE, align='left', caption=paste("Clusters with Normalized ChIP/Input ratio >", thr), captionalign="top") |
83 } | 85 } |
84 HTMLEndFile(filename) | 86 HTMLEndFile(filename) |
85 # file.rename(from=filename, to=HTMLfile) | 87 # file.rename(from=filename, to=HTMLfile) |
86 system(sprintf("cp -r ./%s %s", filename, HTMLfile)) | 88 system(sprintf("cp -r ./%s %s", filename, HTMLfile)) |
87 write.table(df, file=input, sep="\t", row.names = FALSE) | 89 write.table(df, file=input, sep="\t", row.names = FALSE) |