Mercurial > repos > lecorguille > xcms_xcmsset
comparison lib.r @ 20:41cf6f56d1b6 draft
planemo upload for repository https://github.com/workflow4metabolomics/xcms commit 37b0a6a7686f701e4bf00db97ae2c1b82cd6e989
author | lecorguille |
---|---|
date | Fri, 09 Nov 2018 15:10:13 -0500 |
parents | 517d4375db53 |
children | 87df3692c68d |
comparison
equal
deleted
inserted
replaced
19:57fcba888b00 | 20:41cf6f56d1b6 |
---|---|
196 | 196 |
197 variableMetadata <- RTSecondToMinute(variableMetadata, convertRTMinute) | 197 variableMetadata <- RTSecondToMinute(variableMetadata, convertRTMinute) |
198 variableMetadata <- formatIonIdentifiers(variableMetadata, numDigitsRT=numDigitsRT, numDigitsMZ=numDigitsMZ) | 198 variableMetadata <- formatIonIdentifiers(variableMetadata, numDigitsRT=numDigitsRT, numDigitsMZ=numDigitsMZ) |
199 dataMatrix <- naTOzeroDataMatrix(dataMatrix, naTOzero) | 199 dataMatrix <- naTOzeroDataMatrix(dataMatrix, naTOzero) |
200 | 200 |
201 # FIX: issue when the vector at peakidx is too long and is written in a new line during the export | |
202 variableMetadata[,"peakidx"] <- vapply(variableMetadata[,"peakidx"], FUN = paste, FUN.VALUE = character(1), collapse = ",") | |
203 | |
201 write.table(variableMetadata, file=variableMetadataOutput,sep="\t",quote=F,row.names=F) | 204 write.table(variableMetadata, file=variableMetadataOutput,sep="\t",quote=F,row.names=F) |
202 write.table(dataMatrix, file=dataMatrixOutput,sep="\t",quote=F,row.names=F) | 205 write.table(dataMatrix, file=dataMatrixOutput,sep="\t",quote=F,row.names=F) |
203 | 206 |
204 } | 207 } |
205 | 208 |
258 cat("Creating the sampleMetadata file...\n") | 261 cat("Creating the sampleMetadata file...\n") |
259 | 262 |
260 #Create the sampleMetada dataframe | 263 #Create the sampleMetada dataframe |
261 sampleMetadata <- xdata@phenoData@data | 264 sampleMetadata <- xdata@phenoData@data |
262 rownames(sampleMetadata) <- NULL | 265 rownames(sampleMetadata) <- NULL |
263 colnames(sampleMetadata) <- c("sampleMetadata", "class") | 266 colnames(sampleMetadata) <- c("sample_name", "class") |
264 | 267 |
265 sampleNamesOrigin <- sampleMetadata$sampleMetadata | 268 sampleNamesOrigin <- sampleMetadata$sample_name |
266 sampleNamesMakeNames <- make.names(sampleNamesOrigin) | 269 sampleNamesMakeNames <- make.names(sampleNamesOrigin) |
267 | 270 |
268 if (any(duplicated(sampleNamesMakeNames))) { | 271 if (any(duplicated(sampleNamesMakeNames))) { |
269 write("\n\nERROR: Usually, R has trouble to deal with special characters in its column names, so it rename them using make.names().\nIn your case, at least two columns after the renaming obtain the same name, thus XCMS will collapse those columns per name.", stderr()) | 272 write("\n\nERROR: Usually, R has trouble to deal with special characters in its column names, so it rename them using make.names().\nIn your case, at least two columns after the renaming obtain the same name, thus XCMS will collapse those columns per name.", stderr()) |
270 for (sampleName in sampleNamesOrigin) { | 273 for (sampleName in sampleNamesOrigin) { |
278 for (sampleName in sampleNamesOrigin) { | 281 for (sampleName in sampleNamesOrigin) { |
279 cat(paste(sampleName,"\t->\t",make.names(sampleName),"\n")) | 282 cat(paste(sampleName,"\t->\t",make.names(sampleName),"\n")) |
280 } | 283 } |
281 } | 284 } |
282 | 285 |
283 sampleMetadata$sampleMetadata <- sampleNamesMakeNames | 286 sampleMetadata$sample_name <- sampleNamesMakeNames |
284 | 287 |
285 | 288 |
286 #For each sample file, the following actions are done | 289 #For each sample file, the following actions are done |
287 for (fileIdx in 1:length(fileNames(xdata))) { | 290 for (fileIdx in 1:length(fileNames(xdata))) { |
288 #Check if the file is in the CDF format | 291 #Check if the file is in the CDF format |