Mercurial > repos > tomnl > anticipated_purity_lcms
diff anticipated_purity_dims.R @ 14:e05068fe15a1 draft
planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit e6935a8c6a3da23f47a753ab5a8159fa9d165535
| author | tomnl |
|---|---|
| date | Fri, 11 May 2018 06:04:46 -0400 |
| parents | 2ccfae7470b3 |
| children |
line wrap: on
line diff
--- a/anticipated_purity_dims.R Tue May 08 05:33:47 2018 -0400 +++ b/anticipated_purity_dims.R Fri May 11 06:04:46 2018 -0400 @@ -29,31 +29,41 @@ df <- read.table(opt$peaks_file, header = TRUE, sep='\t') filename = NA + mzml_file <- opt$mzML_file }else{ indf <- read.table(opt$peaks_file, header = TRUE, sep='\t', stringsAsFactors = FALSE) - - filename = colnames(indf)[8:ncol(indf)][opt$file_num_dimspy] - print(filename) - # check if the data file is mzML or RAW (can only use mzML currently) so - # we expect an mzML file of the same name in the same folder - indf$i <- indf[,colnames(indf)==filename] - indf[,colnames(indf)==filename] <- as.numeric(indf[,colnames(indf)==filename]) + - filename = sub("raw", "mzML", filename, ignore.case = TRUE) - print(filename) + if (file.exists(opt$mzML_file)){ + mzml_file <- opt$mzML_file + }else{ + + filename = colnames(indf)[8:ncol(indf)][opt$file_num_dimspy] + print(filename) + # check if the data file is mzML or RAW (can only use mzML currently) so + # we expect an mzML file of the same name in the same folder + indf$i <- indf[,colnames(indf)==filename] + indf[,colnames(indf)==filename] <- as.numeric(indf[,colnames(indf)==filename]) + + filename = sub("raw", "mzML", filename, ignore.case = TRUE) + print(filename) + + mzml_file <- file.path(opt$mzML_file, filename) + + } + df <- indf[4:nrow(indf),] if ('blank_flag' %in% colnames(df)){ - df <- df[df$blank_flag==1,] + df <- df[df$blank_flag==1,] } - colnames(df)[colnames(df)=='m.z'] <- 'mz' if ('nan' %in% df$mz){ df[df$mz=='nan',]$mz <- NA } df$mz <- as.numeric(df$mz) - mzml_file <- file.path(opt$mzML_file, filename) +
