library("DESeq2")
options(echo=TRUE)

args <- commandArgs(trailingOnly = TRUE)

PATH <- as.character(args[1])

cts <- as.matrix(read.csv(paste(PATH,"\\deseq2data.csv", sep=""), row.names = "Taxon"))
coldata <- as.matrix(read.csv(paste(PATH,"\\deseq2coldata.csv", sep="")))
dds <- DESeqDataSetFromMatrix(countData = cts, colData = coldata,design = ~ additive)
dds
dds <- DESeq(dds)
res <- results(dds)
resOrdered <- res[order(res$pvalue),]
write.csv(as.data.frame(resOrdered), 
          file=paste(PATH,"\\deseq2results.csv", sep=""))
summary(resOrdered)
resOrdered
