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

Next revision
Previous revision
Next revisionBoth sides next revision
mkatari-bioinformatics-august-2013-deseq [2013/08/23 14:18] – created mkatarimkatari-bioinformatics-august-2013-deseq [2013/08/23 15:23] mkatari
Line 1: Line 1:
-[[mkatari-bioinformatics-august-2013|Manny's Bioinformatics Workshop]]+[[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 R script in an analysis pipeline. The code that reads arguments from the command line are:+Now for our script we will use a function (commandArgs) that allows the R to read in arguments from command line automatically. We will use a command Rscript to run one of our R scripts (DESeq.R). This will be helpful when we are using an R script in an analysis pipeline. The code that reads arguments from the command line are:
  
 <code> <code>
Line 33: Line 33:
 </code> </code>
  
 +All the arguments provided in command line will be saved as a character vector in userargs. The value TRUE in the commandArgs argument make sure only the trailing arguments are saved (which is what we will be providing. If the value is FALSE you will see additional R arguments when the command Rscript is executed.
  
 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]] 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]]
  
-#counts = read.table("NextGenRaw.txt", header=T, row.names=1)+You have to first load the file into your workspace. 
 + 
 +If you are running it locally 
 +<code> 
 +counts = read.table("NextGenRaw.txt", header=T, row.names=1) 
 +</code> 
 +If you are writing a script 
 +<code>
 counts = read.table(pathToCountsData, header=T, row.names=1) counts = read.table(pathToCountsData, header=T, row.names=1)
 +</code>
  
 #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