diff --git a/inst/rmarkdown/templates/reportbis/resources/template.tex b/inst/rmarkdown/templates/reportbis/resources/template.tex new file mode 100644 index 0000000000000000000000000000000000000000..bb4e2aa0fa3b3f387ec8cf11225f2b2ad820ef6f --- /dev/null +++ b/inst/rmarkdown/templates/reportbis/resources/template.tex @@ -0,0 +1,6 @@ +% !TeX root = wrapper.tex +\title{$title$} +\author{by $for(author)$$author.name$$sep$, $endfor$} + +\maketitle + diff --git a/inst/rmarkdown/templates/reportbis/resources/wrapper.tex b/inst/rmarkdown/templates/reportbis/resources/wrapper.tex new file mode 100644 index 0000000000000000000000000000000000000000..cf979f9b26fdf5762974646aa5344afe5a0bd708 --- /dev/null +++ b/inst/rmarkdown/templates/reportbis/resources/wrapper.tex @@ -0,0 +1,27 @@ +\documentclass[a4paper]{report} +\usepackage[utf8]{inputenc} +\usepackage[T1]{fontenc} +\usepackage{nips_2017} +\usepackage{amsmath,amssymb,array} +\usepackage{booktabs} + +\providecommand{\tightlist}{% + \setlength{\itemsep}{0pt}\setlength{\parskip}{0pt}} + +%% load any required packages here +$preamble$ + +\begin{document} + +%% do not edit, for illustration only +\sectionhead{Contributed research article} +\volume{XX} +\volnumber{YY} +\year{20ZZ} +\month{AAAA} + +\begin{article} + \input{$filename$} +\end{article} + +\end{document} \ No newline at end of file diff --git a/inst/rmarkdown/templates/reportbis/skeleton/.Rhistory b/inst/rmarkdown/templates/reportbis/skeleton/.Rhistory new file mode 100644 index 0000000000000000000000000000000000000000..c489c74f3cdee26478271cc4dba144e958d16b3c --- /dev/null +++ b/inst/rmarkdown/templates/reportbis/skeleton/.Rhistory @@ -0,0 +1,512 @@ +# BIGZ[grep("reg09", rsid),1:3] <- NA +# BIGZ[grep("reg10", rsid),4:6] <- NA +rownames(BIGZ) <- rsid +# What does it look like ? +require(pheatmap) +png("zscores.png", res = 100) +pheatmap(BIGZ, cluster_rows = FALSE, cluster_cols = FALSE, cellwidth = 10, cellheight = 10) +dev.off() +# Create regions +# Create Z scores +# Write covariance matrix +write.table(data.frame(ID=ids, COV), file="COV.txt", row.names = F, quote=F, sep="\t") +# Write region file +regions <- data.frame(chr=sprintf("chr%i", rep(1:5,e=2)), +start=rep(c(1,4),5), +stop=rep(c(3,6),5)) +write.table(regions, file="regions.txt", row.names = F, quote=F, sep="\t") +# Write all the Z files +k <- 1 +for (j in 1:6) { +for (chrnum in 1:5) { +ind <- grep(sprintf("chr%i", chrnum), rsid) +tmp <- data.frame(rsid = rsid[ind], +position = pos[ind], +refAllele=ref, +altAllele=alt, +Z=unname(BIGZ[ind, j])) +write.table(na.omit(tmp), file = filenames[k], quote=FALSE, row.names = FALSE, sep="\t") +k <- k+1 +} +} +# Compute the summary statistic +setwd("~/tmpdatatest/test2/") +## There 6 phenotypes +sumtab <- read.table("summary.txt", sep="\t", header=TRUE, stringsAsFactors = FALSE) +## Zscore ID: z_CONSORITUM_PHENOTYPE_chr#chr.txt +ids <- sprintf("z_%s_%s",sumtab$Consortium, sumtab$Outcome) +## The covariance is set to 1 and the variance to 2 +COV <- toeplitz(c(2,1,1,1,1,1)) +rownames(COV) <- colnames(COV) <- ids +## Structure: +# - 5 chromosomes, 2 regions per chromosomes +# - 10 regions, 2 regions per chromosome +# - 30 SNPs, 3 SNPs per region +## Structure of missing values region per region ; +## ".." means no missing values +## "XX" means the whole region is missing +# +# Z1 Z2 Z3 Z4 Z5 Z6 +# R1 .. .. .. .. .. .. +# R2 .. .. .. .. .. .. +# R3 XX .. .. .. .. .. +# R4 .. XX .. .. .. .. +# R5 .. .. XX .. .. .. +# R6 .. .. .. XX .. .. +# R7 .. .. .. .. XX .. +# R8 .. .. .. .. .. XX +# R9 XX XX XX .. .. .. +# R10 .. .. .. XX XX XX +filenames <- paste0("~/tmpdatatest/test2/zfiles/", rep(ids,e=5), "_chr", rep(1:5, 6), ".txt") +## rsid : rs_#chr_#region_#snp +rsid <- paste0("rs", "_chr", rep(1:5, e=6), # chr +"_reg", sprintf("%02i", rep(1:10, e=3)), # region +"_", sprintf("%02i", 1:30)) # snp +pos <- rep(1:6, 5) +chr <- rep(1:5, e=6) +reg <- rep(1:10, e=3) +ref <- "A" +alt <- "G" +BIGZ <- matrix(1:(30*6), 30, 6) +BIGZ[grep("reg03", rsid),1] <- NA +BIGZ[grep("reg04", rsid),2] <- NA +BIGZ[grep("reg05", rsid),3] <- NA +BIGZ[grep("reg06", rsid),4] <- NA +BIGZ[grep("reg07", rsid),5] <- NA +BIGZ[grep("reg08", rsid),6] <- NA +BIGZ[grep("reg09", rsid),1:3] <- NA +BIGZ[grep("reg10", rsid),4:6] <- NA +rownames(BIGZ) <- rsid +# What does it look like ? +require(pheatmap) +png("zscores.png", res = 100) +pheatmap(BIGZ, cluster_rows = FALSE, cluster_cols = FALSE, cellwidth = 10, cellheight = 10) +dev.off() +# Create regions +# Create Z scores +# Write covariance matrix +write.table(data.frame(ID=ids, COV), file="COV.txt", row.names = F, quote=F, sep="\t") +# Write region file +regions <- data.frame(chr=sprintf("chr%i", rep(1:5,e=2)), +start=rep(c(1,4),5), +stop=rep(c(3,6),5)) +write.table(regions, file="regions.txt", row.names = F, quote=F, sep="\t") +# Write all the Z files +k <- 1 +for (j in 1:6) { +for (chrnum in 1:5) { +ind <- grep(sprintf("chr%i", chrnum), rsid) +tmp <- data.frame(rsid = rsid[ind], +position = pos[ind], +refAllele=ref, +altAllele=alt, +Z=unname(BIGZ[ind, j])) +write.table(na.omit(tmp), file = filenames[k], quote=FALSE, row.names = FALSE, sep="\t") +k <- k+1 +} +} +# Compute the summary statistic +write.table(matrix(1:4,2,2)) +write.table(round(matrix(1:4,2,2),2) +) +setwd("~/tmpdatatest/test2/") +## There 6 phenotypes +sumtab <- read.table("summary.txt", sep="\t", header=TRUE, stringsAsFactors = FALSE) +## Zscore ID: z_CONSORITUM_PHENOTYPE_chr#chr.txt +ids <- sprintf("z_%s_%s",sumtab$Consortium, sumtab$Outcome) +## The covariance is set to 1 and the variance to 2 +COV <- toeplitz(c(2,1,1,1,1,1)) +rownames(COV) <- colnames(COV) <- ids +## Structure: +# - 5 chromosomes, 2 regions per chromosomes +# - 10 regions, 2 regions per chromosome +# - 30 SNPs, 3 SNPs per region +## Structure of missing values region per region ; +## ".." means no missing values +## "XX" means the whole region is missing +# +# Z1 Z2 Z3 Z4 Z5 Z6 +# R1 .. .. .. .. .. .. +# R2 .. .. .. .. .. .. +# R3 XX .. .. .. .. .. +# R4 .. XX .. .. .. .. +# R5 .. .. XX .. .. .. +# R6 .. .. .. XX .. .. +# R7 .. .. .. .. XX .. +# R8 .. .. .. .. .. XX +# R9 XX XX XX .. .. .. +# R10 .. .. .. XX XX XX +filenames <- paste0("~/tmpdatatest/test2/zfiles/", rep(ids,e=5), "_chr", rep(1:5, 6), ".txt") +## rsid : rs_#chr_#region_#snp +rsid <- paste0("rs", "_chr", rep(1:5, e=6), # chr +"_reg", sprintf("%02i", rep(1:10, e=3)), # region +"_", sprintf("%02i", 1:30)) # snp +pos <- rep(1:6, 5) +chr <- rep(1:5, e=6) +reg <- rep(1:10, e=3) +ref <- "A" +alt <- "G" +BIGZ <- matrix(1:(30*6), 30, 6) + 0.001 +BIGZ[grep("reg03", rsid),1] <- NA +BIGZ[grep("reg04", rsid),2] <- NA +BIGZ[grep("reg05", rsid),3] <- NA +BIGZ[grep("reg06", rsid),4] <- NA +BIGZ[grep("reg07", rsid),5] <- NA +BIGZ[grep("reg08", rsid),6] <- NA +BIGZ[grep("reg09", rsid),1:3] <- NA +BIGZ[grep("reg10", rsid),4:6] <- NA +rownames(BIGZ) <- rsid +# What does it look like ? +require(pheatmap) +png("zscores.png", res = 100) +pheatmap(BIGZ, cluster_rows = FALSE, cluster_cols = FALSE, cellwidth = 10, cellheight = 10) +dev.off() +# Create regions +# Create Z scores +# Write covariance matrix +write.table(data.frame(ID=ids, COV), file="COV.txt", row.names = F, quote=F, sep="\t") +# Write region file +regions <- data.frame(chr=sprintf("chr%i", rep(1:5,e=2)), +start=rep(c(1,4),5), +stop=rep(c(3,6),5)) +write.table(regions, file="regions.txt", row.names = F, quote=F, sep="\t") +# Write all the Z files +k <- 1 +for (j in 1:6) { +for (chrnum in 1:5) { +ind <- grep(sprintf("chr%i", chrnum), rsid) +tmp <- data.frame(rsid = rsid[ind], +position = pos[ind], +refAllele=ref, +altAllele=alt, +Z=unname(BIGZ[ind, j])) +write.table(na.omit(tmp), file = filenames[k], quote=FALSE, row.names = FALSE, sep="\t") +k <- k+1 +} +} +# Compute the summary statistic +rm(list=ls()) +gc() +data(sleep) +sleep +a = data(sleep) +a +source('http://www.bioconductor.org/biocLite.R') +biocLite("pathview") +# Chargement de la library pathview +library(pathview) +# Lecture du tableau +genesTable <- read.table("data_ps1/genes.txt", sep="\t", header=TRUE) +# Lecture du tableau +genesTable <- read.table("data_ps1/genes.txt", sep="\t", header=TRUE) +setwd("/Volumes/@hubbioit-1/Enseignement/CoursPhD/2018-1-Winter/Practical Session 1") +# Chargement de la library pathview +library(pathview) +# Lecture du tableau +genesTable <- read.table("data_ps1/genes.txt", sep="\t", header=TRUE) +genesTable +# extraire uniquement les noms de genes +genes <- genes[,1] +# vérifier la classe de l'objet gene +class(genes) +# Lecture du tableau +genesTable <- read.table("data_ps1/genes.txt", sep="\t", header=TRUE) +# extraire uniquement les noms de genes +genes <- genesTable[,1] +genes +# vérifier la classe de l'objet gene +class(genes) +# la doc de la fonction pathview indique que l'objet genes doit etre un VECTEUR +genes = as.vector(genes) +# Choisir son pathway et le type d'annotation de gene +pathwayID = "hsa04110" +geneIDTYPE = "SYMBOL" +# pathview prend en entrée un vecteur ou une matrice gene.data +pathview(gene.data=genes, pathway.id=pathwayID, gene.idtype=geneIDTYPE, plot.col.key=FALSE) +genesTable <- read.table("data_ps1/myGenes.csv", sep=";", header=TRUE) +print(genesTable) +class(genesTable) +dim(genesTable) +genes <- as.vector(genesTable[,2]) +pathwayID <- "hsa04012" +geneIDTYPE <- "SYMBOL" +pathview(genes, pathway.id = pathwayID, gene.idtype = geneIDTYPE, plot.col.key= FALSE) +genesTable <- read.table("data_ps1/myGenes.csv", sep=";", header=TRUE) +print(genesTable) +class(genesTable) +dim(genesTable) +genes <- as.vector(genesTable[,2]) +pathwayID <- "hsa04012" +geneIDTYPE <- "SYMBOL" +pathview(genes, pathway.id = pathwayID, gene.idtype = geneIDTYPE, plot.col.key= FALSE) +variants <- read.table("data_ps1/VariantsTable.csv", sep="\t", header=TRUE) +vec1 <- which(variants$ExonicFunc.refGene == "nonsynonymous SNV" | +variants$ExonicFunc.refGene == "stopgain" | +variants$ExonicFunc.refGene == "stoploss") +vec2 <- which(variants$CADD_phred > 12.37) +vec3 <- intersect(vec1, vec2) +tab <- variants[vec3,] +write.table(tab, file="outputTable.txt", sep="t", quote=FALSE, row.names=FALSE) +View(tab) +write.table(tab, file="outputTable.txt", sep="\t", quote=FALSE, row.names=FALSE) +seqs = c('ATGGATTTTATTTAG', 'ATGGATTTTCGC', 'CTACATGGATTTTGAAT', 'aaTGCTAAACtAA', 'TCGATTAA') +nchar(seqs) +grep('ATG', seqs, ignore.case = T) +grep('TGA|TAA|TAG', seqs, ignore.case = T) +grep('ATG.*TGA|ATG.*TAA|ATG.*TAG', seqs, ignore.case = T) +require(microbenchmark) +M <- matrix(1, 10, 10) +require(microbenchmark) +M <- matrix(1, 10, 10) +f1 <- function(M) { +res <- rep(NA, nrow(M)) +for (i in 1:nrow(M)) res[i] <- sum(M[,i]) +return(sum(res)) +} +f2 <- function(M) { +N <- nrow(M) +res <- rep(NA, N) +for (i in 1:N) res[i] <- sum(M[,i]) +return(sum(res)) +} +f3 <- function(M) sum(apply(M, 1, sum))) +f4 <- function(M) sum(rowSums(M))) +f3 <- function(M) sum(apply(M, 1, sum)) +f4 <- function(M) sum(rowSums(M)) +?microbenchmark +res <- microbenchmark(f1(M), f2(M), f3(M), f4(M)) +res <- microbenchmark(f1(M), f2(M), f3(M), f4(M), times=1000000L) +res <- microbenchmark(f1(M), f2(M), f3(M), f4(M), times=100000L) +res <- microbenchmark(f1(M), f2(M), f3(M), f4(M), times=1000L) +plot(res) +res <- microbenchmark(f1(M), f2(M), f4(M), times=1000L) +plot(res) +res <- microbenchmark(f1(M), f2(M), times=1000L) +plot(res) +require(ggplot2) +M <- matrix(1, 10, 10) +f1 <- function(M) { +res <- rep(NA, nrow(M)) +for (i in 1:nrow(M)) res[i] <- sum(M[,i]) +return(sum(res)) +} +f2 <- function(M) { +N <- nrow(M) +res <- rep(NA, N) +for (i in 1:N) res[i] <- sum(M[,i]) +return(sum(res)) +} +f3 <- function(M) sum(apply(M, 1, sum)) +f4 <- function(M) sum(rowSums(M)) +res <- microbenchmark(f1(M), f2(M), times=1000L) +plot(res) +res <- microbenchmark(f1(M), f2(M), times=1000L) +plot(res) +M <- matrix(1, 1000, 1000) +f1 <- function(M) { +res <- rep(NA, nrow(M)) +for (i in 1:nrow(M)) res[i] <- sum(M[,i]) +return(sum(res)) +} +f2 <- function(M) { +N <- nrow(M) +res <- rep(NA, N) +for (i in 1:N) res[i] <- sum(M[,i]) +return(sum(res)) +} +f3 <- function(M) sum(apply(M, 1, sum)) +f4 <- function(M) sum(rowSums(M)) +res <- microbenchmark(f1(M), f2(M), times=1000L) +M <- matrix(1, 100, 100) +f1 <- function(M) { +res <- rep(NA, nrow(M)) +for (i in 1:nrow(M)) res[i] <- sum(M[,i]) +return(sum(res)) +} +f2 <- function(M) { +N <- nrow(M) +res <- rep(NA, N) +for (i in 1:N) res[i] <- sum(M[,i]) +return(sum(res)) +} +f3 <- function(M) sum(apply(M, 1, sum)) +f4 <- function(M) sum(rowSums(M)) +res <- microbenchmark(f1(M), f2(M), f3(M), times=1000L) +plot(res) +res <- microbenchmark(f1(M), f2(M), f3(M), f4(M), times=1000L) +plot(res) +res <- microbenchmark(f1(M), f2(M), f3(M), f4(M), times=1000L) +plot(res) +Melanoma +require(MASS) +Melanoma +ChickWeight +180/5 +"Bonjour" +plot(1:10) +plot(1:10, main="c'est trop cool !") +combin <- function(n=2, k=1){ +maxi <- max(k, n-k) +mini <- min(k, n-k) +res <- prod((maxi+1):n) / factorial(mini) +} +combin(4, 2) +combin(4, 2) +(combin(4, 2)) +(combin(7, 5)) +(combin(7, 3)) +Y <- c(13.86,16.82,13.65,16.53,15.66,16.16,18.05,14.93,16.57,16.54,14.22,14.44,16.95,15.62,15.68,13.62,16.02,17.55, +13.16,15.75,16.20,14.53,16.84,15.82,16.22,16.79,12.21,16.82,12.22,15.77,15.60,15.87,17.12,15.63,14.92,11.84, +11.03,12.29,12.35,12.19,12.76,11.83,13.78,14.95,11.25,14.75,15.40,14.54,13.87,14.60,12.40,14.42,14.00,15.91, +15.83,13.15,15.33,16.55,13.44,14.01,14.80,16.36,15.50,14.30,16.79,16.65,13.86,16.05,16.35,14.05,16.63,14.85, +13.90,16.70,16.35,16.25,13.89,17.20,14.25,15.69,17.30,17.00,16.85,17.61,16.93,17.20,16.84,17.33,16.68,17.13, +16.61,16.85,16.23,17.10,17.72,15.65,16.85,16.33,16.95) +X1 <- c(14.8,31.7,13.7,29.2,19.8,27.2,40.8,24.2,28.3,32.6,16.6,15.7,34.5,21.8,22.2,13.6,24.7,37.0,11.3,23.3,27.3,18.4, +31.9,23.1,27.8,31.6,18.3,30.0,13.7,23.1,21.8,27.1,33.8,22.0,17.8,11.7,8.9 ,14.2,17.1,22.9,17.3,10.9,20.2,24.0, +9.0 ,23.3,25.0,18.7,23.1,18.0,11.1,15.1,13.6,25.7,28.2,12.0,23.0,28.3,12.7,15.6,19.0,28.7,21.5,17.5,28.6,33.0, +14.8,27.0,33.0,16.0,30.5,19.0,15.0,29.8,32.0,32.0,14.2,34.8,17.0,23.8,35.0,33.0,32.0,38.7,35.0,35.0,29.9,35.2, +31.0,34.0,29.9,32.0,28.0,33.3,37.8,25.0,37.0,29.5,35.0) +X2 <- c(2.0,0.7,1.0,1.6,1.2,0.7,0.1,1.7,1.2,0.5,0.7,4.3,0.5,1.5,2.0,1.1,1.3,0.4,1.7,0.7,0.3,1.4,0.7,1.9,1.0,0.5,3.9,0.6, +5.2,1.1,2.0,1.3,0.4,0.6,1.5,5.9,5.7,5.7,4.9,4.4,4.1,4.1,3.7,3.0,2.8,2.8,2.7,2.7,2.5,2.5,2.3,2.0,1.9,1.7,1.4,1.3, +1.2,1.2,1.2,1.0,1.0,0.9,0.9,0.9,0.9,0.9,0.9,0.8,0.8,0.8,0.8,0.7,0.7,0.6,0.6,0.6,0.6,0.5,0.5,0.5,0.5,0.5,0.4,0.4, +0.4,0.4,0.4,0.4,0.4,0.4,0.3,0.3,0.3,0.3,0.3,0.3,0.2,0.2,0.1) +dataset <- data.frame(Y, X1, X2) +#dataset +regmodel_1=lm(Y~ X1 + X2) +b1_hat = summary(regmodel_1)$coefficients[2] +paste0("b1_hat : ", b1_hat) +# ------------------------ +regmodel_2=lm(X1 ~ X2) +ui=regmodel_2$residuals +regmodel_3=lm(Y~ui) +g1_hat = summary(regmodel_3)$coefficients[2] +paste0("g1_hat : ", g1_hat) +# -------------------------- +regmodel_4=lm(Y ~ X2) +wi=regmodel_4$residuals +regmodel_5=lm(wi~ui) +d1_hat = summary(regmodel_5)$coefficients[2] +paste0("d1_hat : ", d1_hat) +# -------------------------- +new_set = subset(dataset, X2 > 2.2) +regmodel_6=lm(Y~X1 + X2, data=new_set) +summary(regmodel_6) +??golub +table(golub.cl) +data(golub) +require(multtest) +table(golub.cl) +data(golub) +table(golub.cl) +read.table("http://bit.ly/2BIEgiY +") +read.table("http://bit.ly/2BIEgiY") +read.delim("http://bit.ly/2BIEgiY") +data_exemple = matrix(rnorm(100),ncol=5) +data_exemple2 = matrix(rnorm(50),ncol=5) +heatmap.2(data_exemple, +cexRow=0.5, +symm=F,symkey=F,symbreaks=T, +notecol="black", # change font color of cell labels to blacklegend +margins =c(12,9), # widens margins around plot +denscol=1, +tracecol=1, +density.info="none", # turns off density plot inside color legend +trace="none", # turns off trace lines inside the heat map +Colv=FALSE, +dendrogram ="none" +) +library(heatmap.2) +??heatmap.2 +require(gplots) +data_exemple = matrix(rnorm(100),ncol=5) +data_exemple2 = matrix(rnorm(50),ncol=5) +heatmap.2(data_exemple, +cexRow=0.5, +symm=F,symkey=F,symbreaks=T, +notecol="black", # change font color of cell labels to blacklegend +margins =c(12,9), # widens margins around plot +denscol=1, +tracecol=1, +density.info="none", # turns off density plot inside color legend +trace="none", # turns off trace lines inside the heat map +Colv=FALSE, +dendrogram ="none" +) +heatmap.2(data_exemple2, +cexRow=0.5, +symm=F,symkey=F,symbreaks=T, +notecol="black", # change font color of cell labels to blacklegend +margins =c(12,9), # widens margins around plot +denscol=1, +tracecol=1, +density.info="none", # turns off density plot inside color legend +trace="none", # turns off trace lines inside the heat map +Colv=FALSE, +dendrogram ="none" +) +heatmap.2(data_exemple, +cexRow=0.5, +symm=F,symkey=F,symbreaks=T, +notecol="black", # change font color of cell labels to blacklegend +margins =c(12,9), # widens margins around plot +denscol=1, +tracecol=1, +density.info="none", # turns off density plot inside color legend +trace="none", # turns off trace lines inside the heat map +Colv=FALSE, +dendrogram ="none" +) +heatmap.2(data_exemple, +cexRow=0.5, +symm=F,symkey=F,symbreaks=T, +notecol="black", # change font color of cell labels to blacklegend +margins =c(12,9), # widens margins around plot +denscol=1, +tracecol=1, +density.info="none", # turns off density plot inside color legend +trace="none", # turns off trace lines inside the heat map +Colv=FALSE, +dendrogram ="none" +) +heatmap.2(data_exemple2, +cexRow=0.5, +symm=F,symkey=F,symbreaks=T, +notecol="black", # change font color of cell labels to blacklegend +margins =c(12,9), # widens margins around plot +denscol=1, +tracecol=1, +density.info="none", # turns off density plot inside color legend +trace="none", # turns off trace lines inside the heat map +Colv=FALSE, +dendrogram ="none" +) +pheatmap(data_exemple, cluster_rows = FALSE, cluster_cols = FALSE, cellwidth = 5, cellheight = 5) +require(pheatmap) +pheatmap(data_exemple, cluster_rows = FALSE, cluster_cols = FALSE, cellwidth = 5, cellheight = 5) +pheatmap(data_exemple, cluster_rows = FALSE, cluster_cols = FALSE, cellwidth = 5, cellheight = 5) +pheatmap(data_exemple2, cluster_rows = FALSE, cluster_cols = FALSE, cellwidth = 5, cellheight = 5) +devtools::install_git("https://gitlab.pasteur.fr/vguillem/saber_report_html.git/template1") +devtools::install_git("https://gitlab.pasteur.fr/vguillem/saber_report_html.git/template1") +devtools::install_git("https://gitlab.pasteur.fr/vguillem/saber_report_html.git/template1") +install_git("https://gitlab.pasteur.fr/vguillem/saber_report_html.git/template1", credentials = git2r::cred_user_pass("vguillem", getPass::getPass())) +library(devtools) +install_git("https://gitlab.pasteur.fr/vguillem/saber_report_html.git/template1", credentials = git2r::cred_user_pass("vguillem", getPass::getPass())) +install_git("git@gitlab.pasteur.fr:vguillem/saber_report_html.git/template1", credentials = git2r::cred_user_pass("vguillem", getPass::getPass())) +install_git("git@gitlab.pasteur.fr:vguillem/saber_report_html.git/template1", credentials = git2r::cred_user_pass("vguillem@pasteur.fr", getPass::getPass())) +install_git("git@gitlab.pasteur.fr:vguillem/saber_report_html.git/template1") +install_git("git@gitlab.pasteur.fr:vguillem/saber_report_html.git") +install_git("git@gitlab.pasteur.fr:vguillem/saber_report_html.git", credentials = git2r::cred_user_pass("vguillem", getPass::getPass())) +install_git("https://gitlab.pasteur.fr/vguillem/saber_report_html.git", credentials = git2r::cred_user_pass("vguillem", getPass::getPass())) +install_git("https://gitlab.pasteur.fr/vguillem/template1.git", credentials = git2r::cred_user_pass("vguillem", getPass::getPass())) +install_git("https://gitlab.pasteur.fr/vguillem/template1.git") +df <- data.frame(x= runif(100, 0, 4*pi)) +df$y <- with(df, x**2 + 10 * sin(x) + rnorm(100)) +ggplot(df, aes(x=x, y=y)) + geom_point() + geom_smooth() +library(ggplot2) +ggplot(df, aes(x=x, y=y)) + geom_point() + geom_smooth() +df <- data.frame(x= runif(100, 0, 4*pi)) +df$y <- with(df, x**2 + 10 * sin(x) + 5 * rnorm(100)) +ggplot(df, aes(x=x, y=y)) + geom_point() + geom_smooth() +setwd("~/git/template1/inst/rmarkdown/templates/reportbis/skeleton") +devtools::install("../../../../../../template1/") diff --git a/inst/rmarkdown/templates/reportbis/skeleton/nips_2017.sty b/inst/rmarkdown/templates/reportbis/skeleton/nips_2017.sty new file mode 100644 index 0000000000000000000000000000000000000000..506bf23f1ba22d23f9d1280652187f0a40a14eda --- /dev/null +++ b/inst/rmarkdown/templates/reportbis/skeleton/nips_2017.sty @@ -0,0 +1,338 @@ +% partial rewrite of the LaTeX2e package for submissions to the +% Conference on Neural Information Processing Systems (NIPS): +% +% - uses more LaTeX conventions +% - line numbers at submission time replaced with aligned numbers from +% lineno package +% - \nipsfinalcopy replaced with [final] package option +% - automatically loads times package for authors +% - loads natbib automatically; this can be suppressed with the +% [nonatbib] package option +% - adds foot line to first page identifying the conference +% +% Roman Garnett (garnett@wustl.edu) and the many authors of +% nips15submit_e.sty, including MK and drstrip@sandia +% +% last revision: March 2017 + +\NeedsTeXFormat{LaTeX2e} +\ProvidesPackage{nips_2017}[2017/03/20 NIPS 2017 submission/camera-ready style file] + +% declare final option, which creates camera-ready copy +\newif\if@nipsfinal\@nipsfinalfalse +\DeclareOption{final}{ + \@nipsfinaltrue +} + +% declare nonatbib option, which does not load natbib in case of +% package clash (users can pass options to natbib via +% \PassOptionsToPackage) +\newif\if@natbib\@natbibtrue +\DeclareOption{nonatbib}{ + \@natbibfalse +} + +\ProcessOptions\relax + +% fonts +\renewcommand{\rmdefault}{ptm} +\renewcommand{\sfdefault}{phv} + +% change this every year for notice string at bottom +\newcommand{\@nipsordinal}{31st} +\newcommand{\@nipsyear}{2017} +\newcommand{\@nipslocation}{Long Beach, CA, USA} + +% handle tweaks for camera-ready copy vs. submission copy +\if@nipsfinal + \newcommand{\@noticestring}{% + \@nipsordinal\/ Conference on Neural Information Processing Systems + (NIPS \@nipsyear), \@nipslocation.% + } +\else + \newcommand{\@noticestring}{% + Submitted to \@nipsordinal\/ Conference on Neural Information + Processing Systems (NIPS \@nipsyear). Do not distribute.% + } + + % line numbers for submission + \RequirePackage{lineno} + \linenumbers + + % fix incompatibilities between lineno and amsmath, if required, by + % transparently wrapping linenomath environments around amsmath + % environments + \AtBeginDocument{% + \@ifpackageloaded{amsmath}{% + \newcommand*\patchAmsMathEnvironmentForLineno[1]{% + \expandafter\let\csname old#1\expandafter\endcsname\csname #1\endcsname + \expandafter\let\csname oldend#1\expandafter\endcsname\csname end#1\endcsname + \renewenvironment{#1}% + {\linenomath\csname old#1\endcsname}% + {\csname oldend#1\endcsname\endlinenomath}% + }% + \newcommand*\patchBothAmsMathEnvironmentsForLineno[1]{% + \patchAmsMathEnvironmentForLineno{#1}% + \patchAmsMathEnvironmentForLineno{#1*}% + }% + \patchBothAmsMathEnvironmentsForLineno{equation}% + \patchBothAmsMathEnvironmentsForLineno{align}% + \patchBothAmsMathEnvironmentsForLineno{flalign}% + \patchBothAmsMathEnvironmentsForLineno{alignat}% + \patchBothAmsMathEnvironmentsForLineno{gather}% + \patchBothAmsMathEnvironmentsForLineno{multline}% + }{} + } +\fi + +% load natbib unless told otherwise +\if@natbib + \RequirePackage{natbib} +\fi + +% set page geometry +\usepackage[verbose=true,letterpaper]{geometry} +\AtBeginDocument{ + \newgeometry{ + textheight=9in, + textwidth=5.5in, + top=1in, + headheight=12pt, + headsep=25pt, + footskip=30pt + } + \@ifpackageloaded{fullpage} + {\PackageWarning{nips_2016}{fullpage package not allowed! Overwriting formatting.}} + {} +} + +\widowpenalty=10000 +\clubpenalty=10000 +\flushbottom +\sloppy + +% font sizes with reduced leading +\renewcommand{\normalsize}{% + \@setfontsize\normalsize\@xpt\@xipt + \abovedisplayskip 7\p@ \@plus 2\p@ \@minus 5\p@ + \abovedisplayshortskip \z@ \@plus 3\p@ + \belowdisplayskip \abovedisplayskip + \belowdisplayshortskip 4\p@ \@plus 3\p@ \@minus 3\p@ +} +\normalsize +\renewcommand{\small}{% + \@setfontsize\small\@ixpt\@xpt + \abovedisplayskip 6\p@ \@plus 1.5\p@ \@minus 4\p@ + \abovedisplayshortskip \z@ \@plus 2\p@ + \belowdisplayskip \abovedisplayskip + \belowdisplayshortskip 3\p@ \@plus 2\p@ \@minus 2\p@ +} +\renewcommand{\footnotesize}{\@setfontsize\footnotesize\@ixpt\@xpt} +\renewcommand{\scriptsize}{\@setfontsize\scriptsize\@viipt\@viiipt} +\renewcommand{\tiny}{\@setfontsize\tiny\@vipt\@viipt} +\renewcommand{\large}{\@setfontsize\large\@xiipt{14}} +\renewcommand{\Large}{\@setfontsize\Large\@xivpt{16}} +\renewcommand{\LARGE}{\@setfontsize\LARGE\@xviipt{20}} +\renewcommand{\huge}{\@setfontsize\huge\@xxpt{23}} +\renewcommand{\Huge}{\@setfontsize\Huge\@xxvpt{28}} + +% sections with less space +\providecommand{\section}{} +\renewcommand{\section}{% + \@startsection{section}{1}{\z@}% + {-2.0ex \@plus -0.5ex \@minus -0.2ex}% + { 1.5ex \@plus 0.3ex \@minus 0.2ex}% + {\large\bf\raggedright}% +} +\providecommand{\subsection}{} +\renewcommand{\subsection}{% + \@startsection{subsection}{2}{\z@}% + {-1.8ex \@plus -0.5ex \@minus -0.2ex}% + { 0.8ex \@plus 0.2ex}% + {\normalsize\bf\raggedright}% +} +\providecommand{\subsubsection}{} +\renewcommand{\subsubsection}{% + \@startsection{subsubsection}{3}{\z@}% + {-1.5ex \@plus -0.5ex \@minus -0.2ex}% + { 0.5ex \@plus 0.2ex}% + {\normalsize\bf\raggedright}% +} +\providecommand{\paragraph}{} +\renewcommand{\paragraph}{% + \@startsection{paragraph}{4}{\z@}% + {1.5ex \@plus 0.5ex \@minus 0.2ex}% + {-1em}% + {\normalsize\bf}% +} +\providecommand{\subparagraph}{} +\renewcommand{\subparagraph}{% + \@startsection{subparagraph}{5}{\z@}% + {1.5ex \@plus 0.5ex \@minus 0.2ex}% + {-1em}% + {\normalsize\bf}% +} +\providecommand{\subsubsubsection}{} +\renewcommand{\subsubsubsection}{% + \vskip5pt{\noindent\normalsize\rm\raggedright}% +} + +% float placement +\renewcommand{\topfraction }{0.85} +\renewcommand{\bottomfraction }{0.4} +\renewcommand{\textfraction }{0.1} +\renewcommand{\floatpagefraction}{0.7} + +\newlength{\@nipsabovecaptionskip}\setlength{\@nipsabovecaptionskip}{7\p@} +\newlength{\@nipsbelowcaptionskip}\setlength{\@nipsbelowcaptionskip}{\z@} + +\setlength{\abovecaptionskip}{\@nipsabovecaptionskip} +\setlength{\belowcaptionskip}{\@nipsbelowcaptionskip} + +% swap above/belowcaptionskip lengths for tables +\renewenvironment{table} + {\setlength{\abovecaptionskip}{\@nipsbelowcaptionskip}% + \setlength{\belowcaptionskip}{\@nipsabovecaptionskip}% + \@float{table}} + {\end@float} + +% footnote formatting +\setlength{\footnotesep }{6.65\p@} +\setlength{\skip\footins}{9\p@ \@plus 4\p@ \@minus 2\p@} +\renewcommand{\footnoterule}{\kern-3\p@ \hrule width 12pc \kern 2.6\p@} +\setcounter{footnote}{0} + +% paragraph formatting +\setlength{\parindent}{\z@} +\setlength{\parskip }{5.5\p@} + +% list formatting +\setlength{\topsep }{4\p@ \@plus 1\p@ \@minus 2\p@} +\setlength{\partopsep }{1\p@ \@plus 0.5\p@ \@minus 0.5\p@} +\setlength{\itemsep }{2\p@ \@plus 1\p@ \@minus 0.5\p@} +\setlength{\parsep }{2\p@ \@plus 1\p@ \@minus 0.5\p@} +\setlength{\leftmargin }{3pc} +\setlength{\leftmargini }{\leftmargin} +\setlength{\leftmarginii }{2em} +\setlength{\leftmarginiii}{1.5em} +\setlength{\leftmarginiv }{1.0em} +\setlength{\leftmarginv }{0.5em} +\def\@listi {\leftmargin\leftmargini} +\def\@listii {\leftmargin\leftmarginii + \labelwidth\leftmarginii + \advance\labelwidth-\labelsep + \topsep 2\p@ \@plus 1\p@ \@minus 0.5\p@ + \parsep 1\p@ \@plus 0.5\p@ \@minus 0.5\p@ + \itemsep \parsep} +\def\@listiii{\leftmargin\leftmarginiii + \labelwidth\leftmarginiii + \advance\labelwidth-\labelsep + \topsep 1\p@ \@plus 0.5\p@ \@minus 0.5\p@ + \parsep \z@ + \partopsep 0.5\p@ \@plus 0\p@ \@minus 0.5\p@ + \itemsep \topsep} +\def\@listiv {\leftmargin\leftmarginiv + \labelwidth\leftmarginiv + \advance\labelwidth-\labelsep} +\def\@listv {\leftmargin\leftmarginv + \labelwidth\leftmarginv + \advance\labelwidth-\labelsep} +\def\@listvi {\leftmargin\leftmarginvi + \labelwidth\leftmarginvi + \advance\labelwidth-\labelsep} + +% create title +\providecommand{\maketitle}{} +\renewcommand{\maketitle}{% + \par + \begingroup + \renewcommand{\thefootnote}{\fnsymbol{footnote}} + % for perfect author name centering + \renewcommand{\@makefnmark}{\hbox to \z@{$^{\@thefnmark}$\hss}} + % The footnote-mark was overlapping the footnote-text, + % added the following to fix this problem (MK) + \long\def\@makefntext##1{% + \parindent 1em\noindent + \hbox to 1.8em{\hss $\m@th ^{\@thefnmark}$}##1 + } + \thispagestyle{empty} + \@maketitle + \@thanks + \@notice + \endgroup + \let\maketitle\relax + \let\thanks\relax +} + +% rules for title box at top of first page +\newcommand{\@toptitlebar}{ + \hrule height 4\p@ + \vskip 0.25in + \vskip -\parskip% +} +\newcommand{\@bottomtitlebar}{ + \vskip 0.29in + \vskip -\parskip + \hrule height 1\p@ + \vskip 0.09in% +} + +% create title (includes both anonymized and non-anonymized versions) +\providecommand{\@maketitle}{} +\renewcommand{\@maketitle}{% + \vbox{% + \hsize\textwidth + \linewidth\hsize + \vskip 0.1in + \@toptitlebar + \centering + {\LARGE\bf \@title\par} + \@bottomtitlebar + \if@nipsfinal + \def\And{% + \end{tabular}\hfil\linebreak[0]\hfil% + \begin{tabular}[t]{c}\bf\rule{\z@}{24\p@}\ignorespaces% + } + \def\AND{% + \end{tabular}\hfil\linebreak[4]\hfil% + \begin{tabular}[t]{c}\bf\rule{\z@}{24\p@}\ignorespaces% + } + \begin{tabular}[t]{c}\bf\rule{\z@}{24\p@}\@author\end{tabular}% + \else + \begin{tabular}[t]{c}\bf\rule{\z@}{24\p@} + Anonymous Author(s) \\ + Affiliation \\ + Address \\ + \texttt{email} \\ + \end{tabular}% + \fi + \vskip 0.3in \@minus 0.1in + } +} + +% add conference notice to bottom of first page +\newcommand{\ftype@noticebox}{8} +\newcommand{\@notice}{% + % give a bit of extra room back to authors on first page + \enlargethispage{2\baselineskip}% + \@float{noticebox}[b]% + \footnotesize\@noticestring% + \end@float% +} + +% abstract styling +\renewenvironment{abstract}% +{% + \vskip 0.075in% + \centerline% + {\large\bf Abstract}% + \vspace{0.5ex}% + \begin{quote}% +} +{ + \par% + \end{quote}% + \vskip 1ex% +} + +\endinput diff --git a/inst/rmarkdown/templates/reportbis/skeleton/skeleton.Rmd b/inst/rmarkdown/templates/reportbis/skeleton/skeleton.Rmd new file mode 100644 index 0000000000000000000000000000000000000000..1ec6cdb0cebe80ea9c84f78aab96456450be4325 --- /dev/null +++ b/inst/rmarkdown/templates/reportbis/skeleton/skeleton.Rmd @@ -0,0 +1,39 @@ +--- +title: 'This the title' +author: 'Jean Bon' +date: '' +output: pdf_document +subtitle: '' +--- + +```{r setup, include=FALSE, message=FALSE, warning=FALSE} +knitr::opts_chunk$set(echo = FALSE) +library(ggplot2) +``` + +# 1. Data + +# 2. Analysis + +Here is how to include the beautiful Fig. \ref{fig:simul} in the report. + +```{r simul, fig.cap="The caption", fig.align='center', fig.pos="!h"} +df <- data.frame(x= runif(100, 0, 4*pi)) +df$y <- with(df, x**2 + 10 * sin(x) + 5 * rnorm(100)) +ggplot(df, aes(x=x, y=y)) + geom_point() + geom_smooth() +``` + + +# 3. Results + +\newpage + +# Appendix A: R session information + +In the reproducible research framework, an important step is to save all the versions of the softwares used to perform the statistical analysis. They must be provided when submitting a paper. + +```{r sessionInfo} +print(sessionInfo(), locale=FALSE) +``` + +# Appendix B: References diff --git a/inst/rmarkdown/templates/reportbis/template.yaml b/inst/rmarkdown/templates/reportbis/template.yaml new file mode 100644 index 0000000000000000000000000000000000000000..d01441f22150b03aa132116fe254665ff8e5d7c2 --- /dev/null +++ b/inst/rmarkdown/templates/reportbis/template.yaml @@ -0,0 +1,4 @@ +name: SABER report PDF +description: > + SABER pdf template for reports +create_dir: true \ No newline at end of file