Mercurial > repos > pieterlukasse > prims_metabolomics
comparison xcms_differential_analysis.r @ 49:f772a5caa86a
Added more options and better documentation.
Added MsClust support for parsing XCMS alignment results.
Improved output reports for XCMS wrappers.
New tools.
author | pieter.lukasse@wur.nl |
---|---|
date | Wed, 10 Dec 2014 22:03:27 +0100 |
parents | e67149fbff20 |
children | 10f3cb998c4e |
comparison
equal
deleted
inserted
replaced
48:26b93438f30e | 49:f772a5caa86a |
---|---|
12 | 12 |
13 args.topcount <- strtoi(args[4]) | 13 args.topcount <- strtoi(args[4]) |
14 #cat(paste("args.topcount <- ", args[4], "\n", sep="")) | 14 #cat(paste("args.topcount <- ", args[4], "\n", sep="")) |
15 | 15 |
16 args.outTable <- args[5] | 16 args.outTable <- args[5] |
17 args.outLogFile <- args[6] | |
18 #cat(paste("args.outLogFile <- \"", args[6], "\"\n", sep="")) | |
19 | 17 |
20 ## report files | 18 ## report files |
21 args.htmlReportFile <- args[7] | 19 args.htmlReportFile <- args[6] |
22 args.htmlReportFile.files_path <- args[8] | 20 args.htmlReportFile.files_path <- args[7] |
23 #cat(paste("args.htmlReportFile <- \"", args[7], "\"\n", sep="")) | 21 #cat(paste("args.htmlReportFile <- \"", args[6], "\"\n", sep="")) |
24 #cat(paste("args.htmlReportFile.files_path <- \"", args[8], "\"\n", sep="")) | 22 #cat(paste("args.htmlReportFile.files_path <- \"", args[7], "\"\n", sep="")) |
25 | 23 |
26 # Send all STDERR to STDOUT using sink() see http://mazamascience.com/WorkingWithData/?p=888 | 24 |
27 msg <- file(args.outLogFile, open="wt") | 25 if (length(args) == 8) |
28 sink(msg, type="message") | 26 { |
29 sink(msg, type="output") | 27 args.outLogFile <- args[8] |
28 # suppress messages: | |
29 # Send all STDERR to STDOUT using sink() see http://mazamascience.com/WorkingWithData/?p=888 | |
30 msg <- file(args.outLogFile, open="wt") | |
31 sink(msg, type="message") | |
32 sink(msg, type="output") | |
33 } | |
30 | 34 |
31 tryCatch( | 35 tryCatch( |
32 { | 36 { |
33 library(metaMS) | 37 library(metaMS) |
34 library(xcms) | 38 library(xcms) |
35 #library("R2HTML") | 39 #library("R2HTML") |
36 | 40 |
37 ## load the constructed DB : | 41 # load the xset data : |
38 xcmsSet <- readRDS(args.xsetData) | 42 xsetData <- readRDS(args.xsetData) |
43 # if here to support both scenarios: | |
44 if ("xcmsSet" %in% slotNames(xsetData) ) | |
45 { | |
46 xsetData <- xsetData@xcmsSet | |
47 } | |
48 | |
39 | 49 |
40 # info: levels(xcmsSet@phenoData$class) also gives access to the class names | 50 # info: levels(xcmsSet@phenoData$class) also gives access to the class names |
41 dir.create(file.path(args.htmlReportFile.files_path), showWarnings = FALSE) | 51 dir.create(file.path(args.htmlReportFile.files_path), showWarnings = FALSE, recursive = TRUE) |
42 reporttab <- diffreport(xcmsSet, args.class1, args.class2, paste(args.htmlReportFile.files_path,"/fig", sep=""), args.topcount, metlin = 0.15, h=480, w=640) | 52 reporttab <- diffreport(xsetData, args.class1, args.class2, paste(args.htmlReportFile.files_path,"/fig", sep=""), args.topcount, metlin = 0.15, h=480, w=640) |
43 | 53 |
44 # write out tsv table: | 54 # write out tsv table: |
45 write.table(reporttab, args.outTable, sep="\t", row.names=FALSE) | 55 write.table(reporttab, args.outTable, sep="\t", row.names=FALSE) |
46 | 56 |
47 message("\nGenerating report.........") | 57 message("\nGenerating report.........") |