Mercurial > repos > tomnl > create_msp
comparison anticipated_purity_dims.R @ 2:ac8738f96e53 draft
planemo upload for repository https://github.com/computational-metabolomics/mspurity-galaxy commit 0aa10df0ec1ed71601f932cfb11d7d4d4f620d80-dirty
author | tomnl |
---|---|
date | Wed, 02 May 2018 14:25:04 -0400 |
parents | 3f1f2d545f3a |
children | 3ecba7815437 |
comparison
equal
deleted
inserted
replaced
1:3f1f2d545f3a | 2:ac8738f96e53 |
---|---|
40 indf$i <- indf[,colnames(indf)==filename] | 40 indf$i <- indf[,colnames(indf)==filename] |
41 indf[,colnames(indf)==filename] <- as.numeric(indf[,colnames(indf)==filename]) | 41 indf[,colnames(indf)==filename] <- as.numeric(indf[,colnames(indf)==filename]) |
42 | 42 |
43 filename = sub("raw", "mzML", filename, ignore.case = TRUE) | 43 filename = sub("raw", "mzML", filename, ignore.case = TRUE) |
44 print(filename) | 44 print(filename) |
45 df <- indf[4:nrow(indf),] | 45 df <- indf[3:nrow(indf),] |
46 if ('blank_flag' %in% colnames(df)){ | 46 if ('blank_flag' %in% colnames(df)){ |
47 df <- df[df$blank_flag==1,] | 47 df <- df[df$blank_flag==1,] |
48 } | 48 } |
49 | 49 |
50 colnames(df)[colnames(df)=='m.z'] <- 'mz' | 50 colnames(df)[colnames(df)=='m.z'] <- 'mz' |
51 | 51 |
52 if ('nan' %in% df$mz){ | 52 if ('nan' %in% df$mz){ |
53 df[df$mz=='nan',]$mz <- NA | 53 df[df$mz=='nan',]$mz <- NA |
54 } | 54 } |
55 df$mz <- as.numeric(df$mz) | 55 df$mz <- as.numeric(df$mz) |
56 | 56 mzml_file <- file.path(opt$mzML_file, filename) |
57 | 57 |
58 | 58 |
59 | 59 |
60 } | 60 } |
61 | 61 |
75 }else{ | 75 }else{ |
76 isotopes <- TRUE | 76 isotopes <- TRUE |
77 } | 77 } |
78 | 78 |
79 | 79 |
80 if (dir.exists(opt$mzML_file)){ | |
81 # if directory then we need to add a file name | |
82 print(filename) | |
83 if (is.na(filename)){ | |
84 print('ERROR: If a directory is provided then a filename needs to be entered | |
85 directory or automatically obtained by using a dimspy output') | |
86 quit() | |
87 }else{ | |
88 mzml_file <- file.path(opt$mzML_file, filename) | |
89 } | |
90 }else{ | |
91 mzml_file <- opt$mzML_file | |
92 } | |
93 | 80 |
94 if (is.null(opt$sim)){ | 81 if (is.null(opt$sim)){ |
95 sim=FALSE | 82 sim=FALSE |
96 }else{ | 83 }else{ |
97 sim=TRUE | 84 sim=TRUE |
116 iwNormFun = msPurity::iwNormQE.5() | 103 iwNormFun = msPurity::iwNormQE.5() |
117 } | 104 } |
118 | 105 |
119 print('FIRST ROWS OF PEAK FILE') | 106 print('FIRST ROWS OF PEAK FILE') |
120 print(head(df)) | 107 print(head(df)) |
121 | 108 print(mzml_file) |
122 predicted <- msPurity::dimsPredictPuritySingle(df$mz, | 109 predicted <- msPurity::dimsPredictPuritySingle(df$mz, |
123 filepth=mzml_file, | 110 filepth=mzml_file, |
124 minOffset=minOffset, | 111 minOffset=minOffset, |
125 maxOffset=maxOffset, | 112 maxOffset=maxOffset, |
126 ppm=opt$ppm, | 113 ppm=opt$ppm, |