Mercurial > repos > tomnl > create_sqlite_db
diff anticipated_purity_dims.R @ 13:4acad02faf32 draft
planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit e6935a8c6a3da23f47a753ab5a8159fa9d165535
author | tomnl |
---|---|
date | Fri, 11 May 2018 06:08:10 -0400 |
parents | cf82f99f3638 |
children |
line wrap: on
line diff
--- a/anticipated_purity_dims.R Tue May 08 05:37:10 2018 -0400 +++ b/anticipated_purity_dims.R Fri May 11 06:08:10 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) +