args
length(args)
for(i in 1:length(args)){
eval(parse(text=args[[i]]))
}
infile <- "/Users/jvanheld/Documents/theses_et_memoires/Jaime_Castro/motif_clustering_scripts"
infile
compare.matrices.table
test.Ncor
score
outfile <- "/Users/jvanheld/Documents/theses_et_memoires/Jaime_Castro/motif_clustering_scripts/peak-motifs_7nt_merged_oligos_positions_tree.json"
score.dist
score
score.values
score.dist
test.Ncor
names(test.Ncor)
dist.values
compare.matrices.table
dist.matrix
im(dist.matrix)
dim(dist.matrix)
test.Ncor
test.Ncor - score.dist
compare.matrices.table
matrix.names
matrix.dist
compare.matrices.table[,2]
matrix.id1
j
j <- 2
i <- 1
)
matches
curent.sco
current.score
compare.matrices.table
compare.matrices.table[matches,°
compare.matrices.table[matches,score]
compare.matrices.table[matches,]
i
j
j <- 2
matches
compare.matrices.table[matches,]
compare.matrices.table[matches,score]
current.score
sum(matches)
which.mat
which(matches)
matches
length(matches)
which(matches)
matches[15]
current.score
matrix.dist
length(matches)
dim(compare.matrices.table)
dim(matches)
matches
xtabs(2 ~1, compare.matrices.table)
compare.matrices.table
xtabs(X.name1 ~ name2, compare.matrices.table)
xtabs(X.name1 ~ name2, as.matrix(compare.matrices.table))
xtabs(strand ~ name2, as.matrix(compare.matrices.table))
xtabs("strand" ~ "name2", as.matrix(compare.matrices.table))
matrix.nb
matrix.nb^2
matrix.nb*matrix.nb
matrix.nb*(matrix.nb+1)/2
quit()
n
list(infile)
ls(infile)
infile
list.files(infile)
list.files()
infile
description.file
system(paste("ls -ltr", description.file))
score.dist
dist.matrix
getwd
getwd()
dev.off()
head(description.table)
attribtues(tree)
attributes(tree)
tee$order
tree$order
tree$merge
tree$order
tree$labels
tree$order
tree$merge
names(description.table)
tree$labels
matrix.labels
description.file
description.table
tree$labels
tree$merge
child1
child2
head(compare.matrices.table)
names(description.table)
head(description.table)
names(compare.matrices.table)
names(description.table)
id1
child1
n1
id1
n1
n2
id1
id2
id1
compa.row
names(compare.matrices.table)
strand
names(description.table)
compare.matrices.table)com
compa.nb
comp.nb
compa.nb
compare.matrices.table
compare.matrices.table[compa.nb,]
consensus
consensus1
consensus2
rep(x="H", n=10)
rep(x="H",times=10)
paste(rep(x="H",times=10))
paste(sep="",rep(x="H",times=10)))
paste(sep="",rep(x="H",times=10))
c(sep="",rep(x="H",times=10))
(sep="",rep(x="H",times=10))
paste(sep="",rep(x="H",times=10))
paste(collapse="",rep(x="H",times=10))
quit()
n
direct.interaction.table[, c("provider", "type", "detectionMethod")]
getwd()
dir.results
system(paste("open", dir.results))
stats.per.provider
quit()
n
infile
demo.nb <- 1
How to chance this path to make it general?
rsat.dir <- Sys.getenv("RSAT")
source(file.path(rsat.dir, "R-scripts", "cluster_motifs_lib.R"))
dir.demo <- file.path(rsat.dir, "public_html", "demo_files")
rsat.dir <- Sys.getenv("RSAT")
rsat.dir
rsat.dir <- Sys.getenv("RSAT")
rsat.dir
-20=-20
-20==-20
-()==-20
16-36 == 25 - 45
(2+2)^2 - (2+2)*9  == 5^2-5*9
(2+2)^2 - 2*(2+2)*9/2  == 5^2-2*5*9/2
(2+2)^2 - 2*(2+2)*9/2 + (9/2)^2  == 5^2-2*5*9/2 + (9/2)^2
(2+2- 9/2)^2  == 5^2-2*5*9/2 + (9/2)^2
(2+2- 9/2)^2  == (5-9/2)^2
(2+2- 9/2) == (5-9/2)
(2+2- 9/2)^2  == (5-9/2)^2
1994-18
2014-(1994-18)
60*2*15
60+2*15
(60+2*15)*30
60*30
required.packages = c("RJSONIO",
"dendextend",
"Rcpp",
"Rclusterpp",
"gplots",
"devtools")
required.bioconductor.packages=c("ctc")
Sys.getenv("RCRAN_REPOS")
if (Sys.getenv("CRAN_REPOS" == "")) {
rcran.repos <- "http://cran.rstudio.com/"
} else {
rcran.repos <- Sys.getenv("CRAN_REPOS")
}
if (Sys.getenv("CRAN_REPOS") == "") {
rcran.repos <- "http://cran.rstudio.com/"
} else {
rcran.repos <- Sys.getenv("CRAN_REPOS")
}
rcran.repos
required.packages = c("RJSONIO",
"dendextend",
"Rcpp",
"Rclusterpp",
"gplots",
"devtools")
dir.rsat <- Sys.getenv("RSAT")
if (dir.rsat == "") {
stop("The environment variable RSAT is not defined.")
}
## Define the local directory for R librairies
dir.rsat <- Sys.getenv("RSAT")
if (dir.rsat == "") {
stop("The environment variable RSAT is not defined.")
}
dir.rsat.rlib <- file.path(dir.rsat, "R-scripts", "Rpackages")
# dir.create(dir.rsat.rlib, recursive=TRUE,showWarnings=FALSE)
if(!require("TFBMclust", lib.loc=dir.rsat.rlib)){
stop("The TFBM R library is not properly installed.")
# print(paste("Installing TFBMclust package in directory", dir.rsat.rlib))
# install.packages(file.path(dir.rsat, 'R-scripts/TFBMclust'),
#                  repos=NULL, type="source",
#                  dependencies=TRUE,
#                  lib=dir.rsat.rlib)
}
?install.packages
required.packages <- c("gplots",
"RJSONIO",
"dendextend",
"devtools",
"Rclusterpp")
required.packages = c("RJSONIO",
"dendextend",
"Rcpp",
"Rclusterpp",
"gplots",
"devtools")
dir.rsat <- Sys.getenv("RSAT")
if (dir.rsat == "") {
stop("The environment variable RSAT is not defined.")
}
dir.rsat.rlib <- file.path(dir.rsat, "R-scripts", "Rpackages")
## Install R packages from the CRAN
for (pkg in required.packages) {
if(!suppressPackageStartupMessages(require(pkg, quietly=TRUE, character.only = TRUE))) {
install.packages(pkg, repos="http://cran.rstudio.com/", dependencies=TRUE, lib=dir.rsat.rlib)
library(pkg, quietly=TRUE, character.only = TRUE)
}
}
required.packages.bioconductor <- c("ctc")
## Define the local directory for R librairies
dir.rsat <- Sys.getenv("RSAT")
if (dir.rsat == "") {
stop("The environment variable RSAT is not defined.")
}
dir.rsat.rlib <- file.path(dir.rsat, "R-scripts", "Rpackages")
## Install R packages from the CRAN
for (pkg in required.packages) {
if(!suppressPackageStartupMessages(require(pkg, quietly=TRUE, character.only = TRUE))) {
install.packages(pkg, repos="http://cran.rstudio.com/", dependencies=TRUE, lib=dir.rsat.rlib)
library(pkg, quietly=TRUE, character.only = TRUE)
}
}
?biocLite
source("http://bioconductor.org/biocLite.R")
?biocLite
if (!suppressPackageStartupMessages(require(pkg, quietly=TRUE, character.only = TRUE))) {
source("http://bioconductor.org/biocLite.R")
biocLite(lib=dir.rsat.rlib);
biocLite(pkg, lib=dir.rsat.rlib)
#  library("ctc", quietly=TRUE, character.only = TRUE)
}
}
for (pkg in required.packages.bioconductor) {
if (!suppressPackageStartupMessages(require(pkg, quietly=TRUE, character.only = TRUE))) {
source("http://bioconductor.org/biocLite.R")
biocLite(lib=dir.rsat.rlib);
biocLite(pkg, lib=dir.rsat.rlib)
#  library("ctc", quietly=TRUE, character.only = TRUE)
}
}
## Load required libraries
for (pkg in c(required.packages, bioconductor.packages)) {
suppressPackageStartupMessages(library(pkg, warn.conflicts=FALSE, character.only = TRUE))
}
for (pkg in c(required.packages, required.packages.bioconductor)) {
suppressPackageStartupMessages(library(pkg, warn.conflicts=FALSE, character.only = TRUE))
}
print("Installing RSAT TFBM package")
system(paste("R CMD INSTALL --no-multiarch --with-keep.source  \"", file.path(dir.rsat, "R-scripts/TFBMclust"), "\"", sep =""))
?install.package
?install.packages
?heatmap.2
?heatmap2
library(gplots)
?heatmap2
?heatmap.2
?heatmap
lbrary(gplot)
library(gplot)
library(gplots)
?heatmap.2
library(RColorBrewer)
in.file <- "/Users/jvanheld/.rsat_tmp_dir/2016/02/24/XYgraph_for_Rplot_infile_2016-02-24.073231_wJrBbv"
options(bitmapType='cairo')
input.table <-  read.table(file=in.file, sep="\t", comment.char=";", header=TRUE, na.strings = "<NULL>")
input.table
header_vector <- c("[min","max[","center","n","n_cum","n_dcum","f","f_cum","f_dcum")
colnames(input.table)<- header_vector
outfile<-"results/peak-motifs_demo/Oct4_Chen2008_sites_from_Jaspar_quick_test/data/sequences/peak-motifs_test_seqlen_distrib.png"
png(file= outfile)
par(mar=c(5.1, 4.1, 5.1, 5.1), xpd=TRUE)
x.values <- input.table[,3]
y.values <- input.table[, c(4)]
xlimits <- range( na.omit(x.values))
ylimits <-range(sort(as.vector(as.matrix(y.values))))
colors<- colorRampPalette(brewer.pal(12,"Paired"))(dim(y.values)[2])
plot(x=NULL, y=NULL, , main="Sequence lengths; Oct4_Chen2008_sites_from_Jaspar" , xlab="Peak length", ylab="Number of peaks", xlim=xlimits , ylim=ylimits )
for(l in c(1:dim(y.values)[2]) ) {
input.table2 <- na.omit(cbind( x.values,  y.values[,l] ))
lines(na.omit(input.table2), col=colors[l], , lwd=2 ,type="l"  ) }
legend("bottomleft", legend = names(input.table)[c(4)], cex=.6,pt.cex=.6, pch="o", bg="white", bty="o", col=colors)
dev.off()
par(mar=c(5.1, 4.1, 5.1, 5.1), xpd=TRUE)
x.values <- input.table[,3]
y.values <- input.table[, c(4)]
xlimits <- range( na.omit(x.values))
ylimits <-range(sort(as.vector(as.matrix(y.values))))
colors<- colorRampPalette(brewer.pal(12,"Paired"))(dim(y.values)[2])
plot(x=NULL, y=NULL, , main="Sequence lengths; Oct4_Chen2008_sites_from_Jaspar" , xlab="Peak length", ylab="Number of peaks", xlim=xlimits , ylim=ylimits )
y.values
dim(y.values)[2]
y.values <- as.data.frame(input.table[, c(4)])
y.values
xlimits <- range( na.omit(x.values))
ylimits <-range(sort(as.vector(as.matrix(y.values))))
colors<- colorRampPalette(brewer.pal(12,"Paired"))(dim(y.values)[2])
plot(x=NULL, y=NULL, , main="Sequence lengths; Oct4_Chen2008_sites_from_Jaspar" , xlab="Peak length", ylab="Number of peaks", xlim=xlimits , ylim=ylimits )
for(l in c(1:dim(y.values)[2]) ) {
input.table2 <- na.omit(cbind( x.values,  y.values[,l] ))
lines(na.omit(input.table2), col=colors[l], , lwd=2 ,type="l"  ) }
legend("bottomleft", legend = names(input.table)[c(4)], cex=.6,pt.cex=.6, pch="o", bg="white", bty="o", col=colors)
dev.off()
?png
?pdf
400/72
?text
knitr::opts_chunk$set(echo = TRUE)
dir.rsat <- Sys.getenv("RSAT")
dir.rsat
Sys.getenv("RSAT")
dir.rsat <- Sys.getenv(names="RSAT")
dir.rsat
Sys.getenv(names="RSAT")
Sys.getenv()
dir.rsat <- Sys.getenv("RSAT")
dir.rsat
Sys.getenv("RSAT")
?fread
library(knitr)
knitr::opts_chunk$set(echo = FALSE, eval = TRUE, cache = TRUE, message = FALSE, warning = FALSE, comment = "")
library(data.table)
Sys.setenv("RSAT"="~/rsat")
dir.rsat <- Sys.getenv("RSAT")
dir.logs <- file.path(dir.rsat, "public_html/logs")
years <- c(2016)
## Read log files
log.files <- list.files(path=dir.logs, pattern="log-file.*2016", full.names = TRUE)
log.files <- grep(pattern="_neat_", x=log.files, invert=TRUE, value = TRUE)
log.files <- grep(pattern="_WS_", x=log.files, invert=TRUE, value = TRUE)
#length(log.files)
file <- log.files[1]
nb.files <- length(log.files)
for (f in 1:length(log.files)) {
file <- log.files[f]
message("Reading log file ", f, "/", nb.files, " ", file)
new.logs <- read.delim(file=file, header = FALSE, row.names = NULL, as.is = FALSE)
if (f==1) {
logs <- new.logs
} else {
logs <- rbind(logs, new.logs)
}
logs <- rbind(logs, new.logs)
#  dim(new.logs)
#  dim(logs)
#  print(head(new.logs))
}
names(logs) <- c("date.time", "instance", "IP", "tool", "email", "na")
logs <- logs[,c("date.time", "instance", "IP", "tool", "email")]
head(logs)
message("Read log files: ", nrow(logs), " lines")
