Install required Bioconductor libraries

Copy the following in the opened R console, it should install all the packages under your own directory.

source("http://bioconductor.org/biocLite.R")
biocLite("GenomicFeatures")
source("http://bioconductor.org/biocLite.R")
biocLite("GenomicAlignments")
source("http://bioconductor.org/biocLite.R")
biocLite("DESeq2")

If you encountered any problems, try to module load R before you open R console in the terminal.

srun -p class --pty bash #open a pseudo bash, -p: specify the partition 
module load R #load the R module
R #open R console

RNA-seq Differential Expression Analysis in Two Steps

##### get raw read count on gene features
source("lib/readcount.R")
rc <- ReadCount(bamfile = "largedata/bamfiles.txt", 
                featureDB = "largedata/Osativa_204_v7.0.sqlite")

bamfile: a txt file, each line indicates the location of your bam file.
featureDB: annotation database generated by GenomicFeatures

######## CBF and WT under nonstress
source("lib/DEG.R")
deg <- Run_DESeq2(rcdata=as.matrix(rc), colfile = "largedata/design.txt", designModel = formula(~ rep + tissue))

rcdata: raw read count data generated from previous step.

colfile: for matrix input: a txt with at least a single column. Rows of colfile correspond to columns of countData. The design file must contains header. see below as an example. Note in columns fq1 and fq2, absolute or relative file locations should be specified.

fq1 fq2  rep tissue
leaf.rep1_1.fastq leaf/leaf.rep1_2.fastq rep1   leaf
leaf.rep2_1.fastq leaf/leaf.rep2_2.fastq rep2   leaf
leaf.rep3_1.fastq leaf/leaf.rep3_2.fastq rep3   leaf
root.rep1_1.fastq root/root.rep1_2.fastq rep1   root
root.rep2_1.fastq root/root.rep2_2.fastq rep2   root
root.rep3_1.fastq root/root.rep3_2.fastq rep3   root

designModel: A formula which specifies the design of the experiment, taking the form formula(~ rep + tissue). Note, the variables must match the header in colfile! By default, the functions in this package will use the last variable in the formula (e.g. tissue) for presenting results (fold changes, etc.) and plotting.