User Tools

Site Tools


mkatari-bioinformatics-august-2013-deseq

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
Next revisionBoth sides next revision
mkatari-bioinformatics-august-2013-deseq [2013/08/23 14:41] mkatarimkatari-bioinformatics-august-2013-deseq [2013/08/23 15:46] mkatari
Line 1: Line 1:
 [[mkatari-bioinformatics-august-2013|Back to Manny's Bioinformatics Workshop HOME]] [[mkatari-bioinformatics-august-2013|Back to Manny's Bioinformatics Workshop HOME]]
  
-Here we will discuss how to create an R script that can be executed on HPC. Majority of the script is the same except for the first few commands that read the arguments from command line.+Here we will discuss how to create an R script (DESeq.R) that can be executed on HPC. Majority of the script is the same as if you were running it interactively except paths to the files are replaced with variables.
  
 If you are going to run DESeq in R on your desktop you will have to make sure DESeq is already installed. If you are going to run DESeq in R on your desktop you will have to make sure DESeq is already installed.
- In order to install DESeq type the following:+In order to install DESeq type the following:
  
 <code> <code>
Line 11: Line 11:
 </code> </code>
  
-However for the script that is available on HPC the script will automatically find DESeq. R uses variables to store locations where it should look for packages. Here we can simply add path to where a specific module is located. This will prevent the need for others to have to install the module themselves. This is done int he following lines of the code+However to make the script easy to run for anyone on the server, we will tell the R script where exactly to look for DESeq. R uses a variable (.libPaths) to store locations where it should look for packages. We will simply add the path to this variable. This way the person running the script does not need to have DESeq installed in their local R libraries. The other option is to tell the system administrator to add the packages. This is done in the following lines of the code
  
 <code> <code>
Line 24: Line 24:
 </code> </code>
  
-Now for our script we will use a command that allows the R to read in arguments from command line automatically. This will be helpful when we are using an script in an analysis pipeline. The code that reads arguments from the command line are:+Now in our script we will use a function (commandArgs) that will allow us to read in arguments from command line automatically. We will use the command Rscript followed by our code (DESeq.R) and the arguments will follow. The code will read one word at a time and save it as a character vector:
  
 <code> <code>
Line 33: Line 33:
 </code> </code>
  
 +This will save all the words as a character vector in userargs. The value TRUE in the commandArgs argument make sure only the trailing arguments are saved. If the value is FALSE you will see additional R arguments when the command Rscript is executed. Notice the order of arguments is important. First we will provide the path to the count data file, then the path to the file containing the experimental design and finally the path to the directory where to save the results.
  
-The input for DESeq is a matrix/data.frame containing read counts. An example is provided [[https://docs.google.com/file/d/0B172nc4dAaaOMG44Zk1BT2NFdkU/edit?usp=sharing|here]]+An example of the count data file is provided [[https://docs.google.com/file/d/0B172nc4dAaaOMG44Zk1BT2NFdkU/edit?usp=sharing|here]]
  
-You have to first load the file into your workspace. +First we will load the count data file.
- +
-If you are running it locally+
 <code> <code>
-counts = read.table("NextGenRaw.txt", header=T, row.names=1)+counts = read.table(pathToCountsData, header=T, row.names=1)
 </code> </code>
-If you are writing a script 
-counts = read.table(pathToCountsData, header=T, row.names=1) 
  
 #This is simply meta-data to store information about the samples. #This is simply meta-data to store information about the samples.
mkatari-bioinformatics-august-2013-deseq.txt · Last modified: 2015/08/21 14:13 by mkatari