Mercurial > repos > tomnl > create_sqlite_db
comparison anticipated_purity_dims.R @ 8:f6996ad60d8f draft
planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 0aa10df0ec1ed71601f932cfb11d7d4d4f620d80-dirty
| author | tomnl |
|---|---|
| date | Wed, 02 May 2018 14:17:22 -0400 |
| parents | d7f4696a1f86 |
| children | cc4464eb380f |
comparison
equal
deleted
inserted
replaced
| 7:d7f4696a1f86 | 8:f6996ad60d8f |
|---|---|
| 30 df <- read.table(opt$peaks_file, header = TRUE, sep='\t') | 30 df <- read.table(opt$peaks_file, header = TRUE, sep='\t') |
| 31 filename = NA | 31 filename = NA |
| 32 }else{ | 32 }else{ |
| 33 indf <- read.table(opt$peaks_file, | 33 indf <- read.table(opt$peaks_file, |
| 34 header = TRUE, sep='\t', stringsAsFactors = FALSE) | 34 header = TRUE, sep='\t', stringsAsFactors = FALSE) |
| 35 | 35 |
| 36 filename = colnames(indf)[8:ncol(indf)][opt$file_num_dimspy] | 36 filename = colnames(indf)[8:ncol(indf)][opt$file_num_dimspy] |
| 37 print(filename) | |
| 37 # check if the data file is mzML or RAW (can only use mzML currently) so | 38 # check if the data file is mzML or RAW (can only use mzML currently) so |
| 38 # we expect an mzML file of the same name in the same folder | 39 # we expect an mzML file of the same name in the same folder |
| 39 indf$i <- indf[,colnames(indf)==filename] | 40 indf$i <- indf[,colnames(indf)==filename] |
| 40 indf[,colnames(indf)==filename] <- as.numeric(indf[,colnames(indf)==filename]) | 41 indf[,colnames(indf)==filename] <- as.numeric(indf[,colnames(indf)==filename]) |
| 41 | 42 |
| 42 filename = sub("raw", "mzML", filename, ignore.case = TRUE) | 43 filename = sub("raw", "mzML", filename, ignore.case = TRUE) |
| 43 | 44 print(filename) |
| 44 df <- indf[4:nrow(indf),] | 45 df <- indf[3:nrow(indf),] |
| 45 if ('blank_flag' %in% colnames(df)){ | 46 if ('blank_flag' %in% colnames(df)){ |
| 46 df <- df[df$blank_flag==1,] | 47 df <- df[df$blank_flag==1,] |
| 47 } | 48 } |
| 48 | 49 |
| 49 colnames(df)[colnames(df)=='m.z'] <- 'mz' | 50 colnames(df)[colnames(df)=='m.z'] <- 'mz' |
| 82 if (is.na(filename)){ | 83 if (is.na(filename)){ |
| 83 print('ERROR: If a directory is provided then a filename needs to be entered | 84 print('ERROR: If a directory is provided then a filename needs to be entered |
| 84 directory or automatically obtained by using a dimspy output') | 85 directory or automatically obtained by using a dimspy output') |
| 85 quit() | 86 quit() |
| 86 }else{ | 87 }else{ |
| 88 print('filename derived from dimspy') | |
| 87 mzml_file <- file.path(opt$mzML_file, filename) | 89 mzml_file <- file.path(opt$mzML_file, filename) |
| 88 } | 90 } |
| 89 }else{ | 91 }else{ |
| 90 mzml_file <- opt$mzML_file | 92 mzml_file <- opt$mzML_file |
| 91 } | 93 } |
| 115 iwNormFun = msPurity::iwNormQE.5() | 117 iwNormFun = msPurity::iwNormQE.5() |
| 116 } | 118 } |
| 117 | 119 |
| 118 print('FIRST ROWS OF PEAK FILE') | 120 print('FIRST ROWS OF PEAK FILE') |
| 119 print(head(df)) | 121 print(head(df)) |
| 120 | 122 print(mzml_file) |
| 121 predicted <- msPurity::dimsPredictPuritySingle(df$mz, | 123 predicted <- msPurity::dimsPredictPuritySingle(df$mz, |
| 122 filepth=mzml_file, | 124 filepth=mzml_file, |
| 123 minOffset=minOffset, | 125 minOffset=minOffset, |
| 124 maxOffset=maxOffset, | 126 maxOffset=maxOffset, |
| 125 ppm=opt$ppm, | 127 ppm=opt$ppm, |
