% -*- TeX:Rnw:UTF-8 -*- % ---------------------------------------------------------------- % .R knitr file ************************************************ % ---------------------------------------------------------------- %% % \VignetteIndexEntry{} % \VignetteDepends{} % \VignettePackage{} \documentclass[a4paper,12pt]{article} %\usepackage[slovene]{babel} \usepackage[utf8]{inputenc} %% must be here for Sweave encoding check \input{abpkg} \input{abcmd} \input{abpage} \usepackage{pgf,pgfarrows,pgfnodes,pgfautomata,pgfheaps,pgfshade} \usepackage{amsmath,amssymb} \usepackage{colortbl} \input{mysweave} <>= require(knitr) render_sweave() opts_knit$set( concordance=TRUE , root.dir = getwd() , unnamed.chunk.label = "ch" , width = 60 ) opts_knit$get("root.dir") @ <>= addArgs <- NULL addArgs[1] <- c("")[1] @ <>= .pISAloc <- gsub("/_p_.*","",getwd()) @ <>= require(knitr) if(interactive()) knit(file.path(.pISAloc,"pISA-initialize.Rnw")) @ <>= @ <>= my.summary <- function(x,...){ dims <- dimnames(x) x <- as.data.frame((lapply(x, factor))) dimnames(x) <- dims summary(x) } #my.summary(phdata) # if(!exists("addObject")) { addObject <- function(name=NULL,desc="",x=my.objects){ if(is.null(name)) x <- data.frame(name="",description="",class="", lenght=NA,ncol=NA) else { nc <- ncol(name) if(is.null(nc)) nc <- NA x <- rbind(x,c(deparse(substitute(name)), desc, class(name), length(name), nc)) x <- x[x$name!="",] } rownames(x) <- x[,1] return(x) } } if(FALSE){ (my.objects <- addObject()) (my.objects <- addObject(t18,"Transcripts for 2018")) } @ <>= # Argumenti # 1. Ime izvorne datoteke za analizo # 2. Izbira genov (ime stolpca v featuredata) # .callName <- args[1] .vzorci <- args[2] #getwd() #args @ \setkeys{Gin}{width=0.8\textwidth} % set graphicx parameter \usepackage{lmodern} \input{abfont} % ---------------------------------------------------------------- \begin{document} %% Sweave settings for includegraphics default plot size (Sweave default is 0.8) %% notice this must be after begin{document} %%% \setkeys{Gin}{width=0.9\textwidth} % ---------------------------------------------------------------- \title{Expression analysis - linear model} \author{A. Blejec} %\address{}% %\email{}% % %\thanks{}% %\subjclass{}% %\keywords{}% %\date{}% %\dedicatory{}% %\commby{}% \maketitle % ---------------------------------------------------------------- %\begin{abstract} % %\end{abstract} % ---------------------------------------------------------------- \clearpage \tableofcontents <>= ############################################### ## ## ## (c) Andrej Blejec (andrej.blejec@nib.si) ## ## ## ############################################### @ <>= options(width=60) library(Hmisc) library(amisc) library(Biobase) #library(xlsReadWrite) library(xtable) #library(MASS) library(lattice) @ \clearpage \section{Task} Final document in folder \file{/reports}: <<>>= fileName(outputFile) @ \clearpage \section{Information from pISA} Data directory <<>>= .inroot @ Results directory <<>>= .oroot @ <>= catln("project:\t", .pName) catln("Investigation: ",.iName) catln("Study: ",.sName) catln("Assay: ",.aName) @ \clearpage \section{Data} Priporočljivo je najprej prebrati phenodata in feature-data, potem pa podatke. To omogoča izbor spremenljivk in vzorcev takoj za tem, ko podatke preberemo. %% <>= %% out <- "From: 10a-ReadData.Rnw\n" %% out <- paste(out,knit_child(file.path(".","10a-ReadData.Rnw"),quiet=TRUE)) %% @ % %\Sexpr{out} <>= cat(knit_child(file.path(".","10a_Read-Data.Rnw"),quiet=TRUE)) @ List of data objects: <<>>= my.objects @ \section{Expression analysis} \section{Linear models 2018} <<>>= library(limma) @ <<>>= exprs <- t18 pd <- pdata18 @ Zanimivi: <<>>= izbor <- c( "Vitvi14g01639", "Vitvi07g02767" ) @ <>= cat(knit_child(file.path(".","20a_limma-fit.Rnw"),quiet=TRUE)) @ \section{Linear models 2019} <<>>= library(limma) @ <<>>= exprs <- t19 pd <- pdata19 @ <>= cat(knit_child(file.path(".","20a_limma-fit.Rnw"),quiet=TRUE)) @ <<>>= @ <<>>= @ %% knitr child handling %% %<>= %@ %<>= %out <- "" %for ( linija in levels(phenodata$Celicna.linija)) %out <- paste(out,knit_child("child_file.rnw",quiet=TRUE)) %@ %\Sexpr{out} %% % ---------------------------------------------------------------- %\bibliographystyle{chicago} %\addcontentsline{toc}{section}{\refname} %\bibliography{ab-general} %-------------------------------------------------------------- \clearpage \appendix \phantomsection\addcontentsline{toc}{section}{\appendixname} %\section{\R\ funkcije} %\input{} \section{Metadata files} \subsection{Project metadata} <>= latex(.pdesc , file = "" , where = "!htbp" , col.just = c("p{2.5in}", "p{3in}") , collabel.just = rep("l",2) , colnamesTexCmd = "ttfamily" , rowname = NULL , caption = "Project metadata" , label = "tbl:pdesc" , cellTexCmds = matrix("ttfamily",nrow(.pdesc),ncol(.pdesc)) ) @ \afterpage{\clearpage \subsection{Investigation metadata} <>= latex(.idesc , file = "" , where = "!htbp" , col.just = c("p{2.5in}", "p{3in}") , collabel.just = rep("l",2) , colnamesTexCmd = "ttfamily" , rowname = NULL , caption = "Investigation metadata" , label = "tbl:idesc" , cellTexCmds = matrix("ttfamily",nrow(.idesc),ncol(.idesc)) ) @ } {\clearpage \subsection{Study metadata} <>= latex(.sdesc , file = "" , where = "!htbp" , col.just = c("p{2.5in}", "p{3in}") , collabel.just = rep("l",2) , colnamesTexCmd = "ttfamily" , rowname = NULL , caption = "Study metadata" , label = "tbl:sdesc" , cellTexCmds = matrix("ttfamily",nrow(.sdesc),ncol(.sdesc)) ) @ } {\clearpage \subsection{Assay metadata} <>= latex(.adesc , file = "" , where = "!htbp" , col.just = c("p{2.5in}", "p{3in}") , collabel.just = rep("l",2) , colnamesTexCmd = "ttfamily" , rowname = NULL , caption = "Assay metadata" , label = "tbl:adesc" , cellTexCmds = matrix("ttfamily",nrow(.adesc),ncol(.adesc)) ) @ } \clearpage \thispagestyle{empty} \section{SessionInfo} {\tiny <>= cat("{\\ttfamily\n") cat(win.version(),"\n") toLatex(sessionInfo()) cat("{\n") @ } <>= sdir <- gsub("/","/\\\\\\\\\n ",dirname(getwd())) #cat("Project path:\n\\verb'",sdir,"'\\\\\n") args <- commandArgs(trailingOnly = TRUE) mainFile <- basename(args[1]) # mainFilePath <- file.path("../doc", mainFile) mainFilePath <- gsub("/./","/",mainFilePath) projectName <- rev((strsplit(dirname(getwd()), "/"))[[1]])[1] # @ <>= sdir <- dirname(getwd()) sdir <- strsplit(sdir,split="/")[[1]] cdir <- sapply(1:length(sdir),function(x) paste(sdir[1:x],collapse="/")) odir <- sdir omike <- as.logical(grep("OMIKE",dirname(getwd()))) if(omike) { odir[1] <- "O:" .files <- paste("../doc",list.files("../doc","^.*\\.R"),sep="/") .files <- file.copy(.files, file.path(.aroot,"scripts")) } ldir <- sapply(1:length(odir),function(x) paste(odir[1:x],collapse="/")) #mc <- max(sapply(sdir,nchar)) #sdir <- sdir <- substr(paste0(sdir,"/ #"),1,mc+3) #odir <- odir <- substr(paste0(odir,"/ #"),1,mc+3) # cat("\\normalsize Analysis project path: [\\href{run:", dirname(getwd()), "}{link}]\\\\\n",sep="") cat("\\texttt{") cat("\\begin{tabbing}\n") cat("....\\=...............................\\=................................\\kill\n") cat("\\>Local \\>Network\\\\") for(i in 1:length(sdir)) { cat("\\>\\href{run:",cdir[i],"}{",sdir[i],"} \\> ",sep="") if(omike) cat("\\href{run:",ldir[i],"}{",odir[i],"}",sep="") cat("\\\\\n") } cat(" \\> \n") cat("\\end{tabbing}\n") cat("} ") @ <>= cat("Main file : \\href{run:", mainFilePath, "}{", mainFilePath ,"}\n\n", sep="") mainFile <- strsplit(mainFile,'.',fixed=TRUE)[[1]][1] cat("Main file : \\href{run:../scripts/", mainFile, ".Rnw} {../scripts/", mainFile ,".Rnw}\n\n", sep="") projectName <- rev((strsplit(dirname(getwd()), "/"))[[1]])[1] cat("Project file: [\\href{run:", file.path(dirname(getwd()),paste0(projectName,".prj")), "}{link}]\n",sep="") # @ \subsection*{View as vignette} {\footnotesize Source files can be viewed by pasting this code to \R\ console:\\} \tiny{ %\begin{Schunk} %\begin{Sinput} \begin{verbatim} <>= cat(' projectName <-"',projectName,'"\n',sep="") cat(' mainFile <-"',mainFile,'"',sep="") # @ <>= cat( ' commandArgs()\n', 'library(tkWidgets)\n', 'openPDF(file.path(dirname(getwd()),"doc",\n', 'paste(mainFile,"PDF",sep=".")))\n', 'viewVignette("viewVignette", projectName,\n', 'file.path("../doc",paste(mainFile,"Rnw",sep=".")))\n' ) # @ \end{verbatim} %\end{Sinput} %\end{Schunk} } \vfill \hrule \vspace{3pt} \footnotesize{ %Revision \SVNId\hfill (c) A. Blejec%\input{../_COPYRIGHT.} %\SVNRevision ~/~ \SVNDate \noindent \texttt{Git Revision: \gitCommitterUnixDate \gitAbbrevHash{} (\gitCommitterDate)} \hfill \copyright~A. Blejec\\ \texttt{ \gitReferences} \hfill \verb'\Sexpr{mainFilePath}'\\ } <>= # getrootpath <- function() { # fp <- (strsplit(getwd(), "/"))[[1]] # file <- file.path(paste(fp[-length(fp)], collapse = "/")) # return(file) # } # fileName <- function(name="bla",ext="PDF") paste(name,ext,sep=".") @ \end{document} % ----------------------------------------------------------------