Mercurial > repos > workflow4metabolomics > intensity_check
annotate wrapper_intensity_check.R @ 0:860907bf0e0f draft default tip
planemo upload for repository https://github.com/your_org_or_user/tools-metabolomics commit 3dd90b60510fa72eb8351464ec5d5883b0b6222a
| author | workflow4metabolomics | 
|---|---|
| date | Fri, 04 Jul 2025 16:31:19 +0000 | 
| parents | |
| children | 
| rev | line source | 
|---|---|
| 0 
860907bf0e0f
planemo upload for repository https://github.com/your_org_or_user/tools-metabolomics commit 3dd90b60510fa72eb8351464ec5d5883b0b6222a
 workflow4metabolomics parents: diff
changeset | 1 suppressPackageStartupMessages(library(argparse)) | 
| 
860907bf0e0f
planemo upload for repository https://github.com/your_org_or_user/tools-metabolomics commit 3dd90b60510fa72eb8351464ec5d5883b0b6222a
 workflow4metabolomics parents: diff
changeset | 2 | 
| 
860907bf0e0f
planemo upload for repository https://github.com/your_org_or_user/tools-metabolomics commit 3dd90b60510fa72eb8351464ec5d5883b0b6222a
 workflow4metabolomics parents: diff
changeset | 3 check.err <- function(err.stock) { | 
| 
860907bf0e0f
planemo upload for repository https://github.com/your_org_or_user/tools-metabolomics commit 3dd90b60510fa72eb8351464ec5d5883b0b6222a
 workflow4metabolomics parents: diff
changeset | 4 # err.stock = vector of results returned by check functions | 
| 
860907bf0e0f
planemo upload for repository https://github.com/your_org_or_user/tools-metabolomics commit 3dd90b60510fa72eb8351464ec5d5883b0b6222a
 workflow4metabolomics parents: diff
changeset | 5 if (length(err.stock) != 0) { | 
| 
860907bf0e0f
planemo upload for repository https://github.com/your_org_or_user/tools-metabolomics commit 3dd90b60510fa72eb8351464ec5d5883b0b6222a
 workflow4metabolomics parents: diff
changeset | 6 stop("\n- - - - - - - - -\n", err.stock, "\n- - - - - - - - -\n") | 
| 
860907bf0e0f
planemo upload for repository https://github.com/your_org_or_user/tools-metabolomics commit 3dd90b60510fa72eb8351464ec5d5883b0b6222a
 workflow4metabolomics parents: diff
changeset | 7 } | 
| 
860907bf0e0f
planemo upload for repository https://github.com/your_org_or_user/tools-metabolomics commit 3dd90b60510fa72eb8351464ec5d5883b0b6222a
 workflow4metabolomics parents: diff
changeset | 8 } | 
| 
860907bf0e0f
planemo upload for repository https://github.com/your_org_or_user/tools-metabolomics commit 3dd90b60510fa72eb8351464ec5d5883b0b6222a
 workflow4metabolomics parents: diff
changeset | 9 | 
| 
860907bf0e0f
planemo upload for repository https://github.com/your_org_or_user/tools-metabolomics commit 3dd90b60510fa72eb8351464ec5d5883b0b6222a
 workflow4metabolomics parents: diff
changeset | 10 | 
| 
860907bf0e0f
planemo upload for repository https://github.com/your_org_or_user/tools-metabolomics commit 3dd90b60510fa72eb8351464ec5d5883b0b6222a
 workflow4metabolomics parents: diff
changeset | 11 # To check if the 3 standard tables match regarding identifiers | 
| 
860907bf0e0f
planemo upload for repository https://github.com/your_org_or_user/tools-metabolomics commit 3dd90b60510fa72eb8351464ec5d5883b0b6222a
 workflow4metabolomics parents: diff
changeset | 12 table_match <- function(dataMatrix, sampleMetadata, variableMetadata) { | 
| 
860907bf0e0f
planemo upload for repository https://github.com/your_org_or_user/tools-metabolomics commit 3dd90b60510fa72eb8351464ec5d5883b0b6222a
 workflow4metabolomics parents: diff
changeset | 13 err.stock <- character() | 
| 
860907bf0e0f
planemo upload for repository https://github.com/your_org_or_user/tools-metabolomics commit 3dd90b60510fa72eb8351464ec5d5883b0b6222a
 workflow4metabolomics parents: diff
changeset | 14 | 
| 
860907bf0e0f
planemo upload for repository https://github.com/your_org_or_user/tools-metabolomics commit 3dd90b60510fa72eb8351464ec5d5883b0b6222a
 workflow4metabolomics parents: diff
changeset | 15 # Sample identifiers | 
| 
860907bf0e0f
planemo upload for repository https://github.com/your_org_or_user/tools-metabolomics commit 3dd90b60510fa72eb8351464ec5d5883b0b6222a
 workflow4metabolomics parents: diff
changeset | 16 dm_samples <- colnames(dataMatrix)[-1] | 
| 
860907bf0e0f
planemo upload for repository https://github.com/your_org_or_user/tools-metabolomics commit 3dd90b60510fa72eb8351464ec5d5883b0b6222a
 workflow4metabolomics parents: diff
changeset | 17 sm_samples <- as.character(sampleMetadata[[1]]) | 
| 
860907bf0e0f
planemo upload for repository https://github.com/your_org_or_user/tools-metabolomics commit 3dd90b60510fa72eb8351464ec5d5883b0b6222a
 workflow4metabolomics parents: diff
changeset | 18 # Variable identifiers | 
| 
860907bf0e0f
planemo upload for repository https://github.com/your_org_or_user/tools-metabolomics commit 3dd90b60510fa72eb8351464ec5d5883b0b6222a
 workflow4metabolomics parents: diff
changeset | 19 dm_vars <- as.character(dataMatrix[[1]]) | 
| 
860907bf0e0f
planemo upload for repository https://github.com/your_org_or_user/tools-metabolomics commit 3dd90b60510fa72eb8351464ec5d5883b0b6222a
 workflow4metabolomics parents: diff
changeset | 20 vm_vars <- as.character(variableMetadata[[1]]) | 
| 
860907bf0e0f
planemo upload for repository https://github.com/your_org_or_user/tools-metabolomics commit 3dd90b60510fa72eb8351464ec5d5883b0b6222a
 workflow4metabolomics parents: diff
changeset | 21 | 
| 
860907bf0e0f
planemo upload for repository https://github.com/your_org_or_user/tools-metabolomics commit 3dd90b60510fa72eb8351464ec5d5883b0b6222a
 workflow4metabolomics parents: diff
changeset | 22 # Check sample IDs | 
| 
860907bf0e0f
planemo upload for repository https://github.com/your_org_or_user/tools-metabolomics commit 3dd90b60510fa72eb8351464ec5d5883b0b6222a
 workflow4metabolomics parents: diff
changeset | 23 missing_in_sm <- setdiff(dm_samples, sm_samples) | 
| 
860907bf0e0f
planemo upload for repository https://github.com/your_org_or_user/tools-metabolomics commit 3dd90b60510fa72eb8351464ec5d5883b0b6222a
 workflow4metabolomics parents: diff
changeset | 24 missing_in_dm <- setdiff(sm_samples, dm_samples) | 
| 
860907bf0e0f
planemo upload for repository https://github.com/your_org_or_user/tools-metabolomics commit 3dd90b60510fa72eb8351464ec5d5883b0b6222a
 workflow4metabolomics parents: diff
changeset | 25 if (length(missing_in_sm) > 0 || length(missing_in_dm) > 0) { | 
| 
860907bf0e0f
planemo upload for repository https://github.com/your_org_or_user/tools-metabolomics commit 3dd90b60510fa72eb8351464ec5d5883b0b6222a
 workflow4metabolomics parents: diff
changeset | 26 err.stock <- c( | 
| 
860907bf0e0f
planemo upload for repository https://github.com/your_org_or_user/tools-metabolomics commit 3dd90b60510fa72eb8351464ec5d5883b0b6222a
 workflow4metabolomics parents: diff
changeset | 27 err.stock, | 
| 
860907bf0e0f
planemo upload for repository https://github.com/your_org_or_user/tools-metabolomics commit 3dd90b60510fa72eb8351464ec5d5883b0b6222a
 workflow4metabolomics parents: diff
changeset | 28 "\nData matrix and sample metadata do not match regarding sample identifiers." | 
| 
860907bf0e0f
planemo upload for repository https://github.com/your_org_or_user/tools-metabolomics commit 3dd90b60510fa72eb8351464ec5d5883b0b6222a
 workflow4metabolomics parents: diff
changeset | 29 ) | 
| 
860907bf0e0f
planemo upload for repository https://github.com/your_org_or_user/tools-metabolomics commit 3dd90b60510fa72eb8351464ec5d5883b0b6222a
 workflow4metabolomics parents: diff
changeset | 30 if (length(missing_in_sm) > 0) { | 
| 
860907bf0e0f
planemo upload for repository https://github.com/your_org_or_user/tools-metabolomics commit 3dd90b60510fa72eb8351464ec5d5883b0b6222a
 workflow4metabolomics parents: diff
changeset | 31 prefix <- if (length(missing_in_sm) < 4) { | 
| 
860907bf0e0f
planemo upload for repository https://github.com/your_org_or_user/tools-metabolomics commit 3dd90b60510fa72eb8351464ec5d5883b0b6222a
 workflow4metabolomics parents: diff
changeset | 32 "\n The " | 
| 
860907bf0e0f
planemo upload for repository https://github.com/your_org_or_user/tools-metabolomics commit 3dd90b60510fa72eb8351464ec5d5883b0b6222a
 workflow4metabolomics parents: diff
changeset | 33 } else { | 
| 
860907bf0e0f
planemo upload for repository https://github.com/your_org_or_user/tools-metabolomics commit 3dd90b60510fa72eb8351464ec5d5883b0b6222a
 workflow4metabolomics parents: diff
changeset | 34 "\n For example, the " | 
| 
860907bf0e0f
planemo upload for repository https://github.com/your_org_or_user/tools-metabolomics commit 3dd90b60510fa72eb8351464ec5d5883b0b6222a
 workflow4metabolomics parents: diff
changeset | 35 } | 
| 
860907bf0e0f
planemo upload for repository https://github.com/your_org_or_user/tools-metabolomics commit 3dd90b60510fa72eb8351464ec5d5883b0b6222a
 workflow4metabolomics parents: diff
changeset | 36 err.stock <- c( | 
| 
860907bf0e0f
planemo upload for repository https://github.com/your_org_or_user/tools-metabolomics commit 3dd90b60510fa72eb8351464ec5d5883b0b6222a
 workflow4metabolomics parents: diff
changeset | 37 err.stock, | 
| 
860907bf0e0f
planemo upload for repository https://github.com/your_org_or_user/tools-metabolomics commit 3dd90b60510fa72eb8351464ec5d5883b0b6222a
 workflow4metabolomics parents: diff
changeset | 38 prefix, | 
| 
860907bf0e0f
planemo upload for repository https://github.com/your_org_or_user/tools-metabolomics commit 3dd90b60510fa72eb8351464ec5d5883b0b6222a
 workflow4metabolomics parents: diff
changeset | 39 "following identifiers found in the data matrix\n", | 
| 
860907bf0e0f
planemo upload for repository https://github.com/your_org_or_user/tools-metabolomics commit 3dd90b60510fa72eb8351464ec5d5883b0b6222a
 workflow4metabolomics parents: diff
changeset | 40 " do not appear in the sample metadata file:\n", | 
| 
860907bf0e0f
planemo upload for repository https://github.com/your_org_or_user/tools-metabolomics commit 3dd90b60510fa72eb8351464ec5d5883b0b6222a
 workflow4metabolomics parents: diff
changeset | 41 " ", | 
| 
860907bf0e0f
planemo upload for repository https://github.com/your_org_or_user/tools-metabolomics commit 3dd90b60510fa72eb8351464ec5d5883b0b6222a
 workflow4metabolomics parents: diff
changeset | 42 paste(head(missing_in_sm, 3), collapse = "\n "), | 
| 
860907bf0e0f
planemo upload for repository https://github.com/your_org_or_user/tools-metabolomics commit 3dd90b60510fa72eb8351464ec5d5883b0b6222a
 workflow4metabolomics parents: diff
changeset | 43 "\n" | 
| 
860907bf0e0f
planemo upload for repository https://github.com/your_org_or_user/tools-metabolomics commit 3dd90b60510fa72eb8351464ec5d5883b0b6222a
 workflow4metabolomics parents: diff
changeset | 44 ) | 
| 
860907bf0e0f
planemo upload for repository https://github.com/your_org_or_user/tools-metabolomics commit 3dd90b60510fa72eb8351464ec5d5883b0b6222a
 workflow4metabolomics parents: diff
changeset | 45 } | 
| 
860907bf0e0f
planemo upload for repository https://github.com/your_org_or_user/tools-metabolomics commit 3dd90b60510fa72eb8351464ec5d5883b0b6222a
 workflow4metabolomics parents: diff
changeset | 46 if (length(missing_in_dm) > 0) { | 
| 
860907bf0e0f
planemo upload for repository https://github.com/your_org_or_user/tools-metabolomics commit 3dd90b60510fa72eb8351464ec5d5883b0b6222a
 workflow4metabolomics parents: diff
changeset | 47 prefix <- if (length(missing_in_dm) < 4) { | 
| 
860907bf0e0f
planemo upload for repository https://github.com/your_org_or_user/tools-metabolomics commit 3dd90b60510fa72eb8351464ec5d5883b0b6222a
 workflow4metabolomics parents: diff
changeset | 48 "\n The " | 
| 
860907bf0e0f
planemo upload for repository https://github.com/your_org_or_user/tools-metabolomics commit 3dd90b60510fa72eb8351464ec5d5883b0b6222a
 workflow4metabolomics parents: diff
changeset | 49 } else { | 
| 
860907bf0e0f
planemo upload for repository https://github.com/your_org_or_user/tools-metabolomics commit 3dd90b60510fa72eb8351464ec5d5883b0b6222a
 workflow4metabolomics parents: diff
changeset | 50 "\n For example, the " | 
| 
860907bf0e0f
planemo upload for repository https://github.com/your_org_or_user/tools-metabolomics commit 3dd90b60510fa72eb8351464ec5d5883b0b6222a
 workflow4metabolomics parents: diff
changeset | 51 } | 
| 
860907bf0e0f
planemo upload for repository https://github.com/your_org_or_user/tools-metabolomics commit 3dd90b60510fa72eb8351464ec5d5883b0b6222a
 workflow4metabolomics parents: diff
changeset | 52 err.stock <- c( | 
| 
860907bf0e0f
planemo upload for repository https://github.com/your_org_or_user/tools-metabolomics commit 3dd90b60510fa72eb8351464ec5d5883b0b6222a
 workflow4metabolomics parents: diff
changeset | 53 err.stock, | 
| 
860907bf0e0f
planemo upload for repository https://github.com/your_org_or_user/tools-metabolomics commit 3dd90b60510fa72eb8351464ec5d5883b0b6222a
 workflow4metabolomics parents: diff
changeset | 54 prefix, | 
| 
860907bf0e0f
planemo upload for repository https://github.com/your_org_or_user/tools-metabolomics commit 3dd90b60510fa72eb8351464ec5d5883b0b6222a
 workflow4metabolomics parents: diff
changeset | 55 "following identifiers found in the sample metadata file\n", | 
| 
860907bf0e0f
planemo upload for repository https://github.com/your_org_or_user/tools-metabolomics commit 3dd90b60510fa72eb8351464ec5d5883b0b6222a
 workflow4metabolomics parents: diff
changeset | 56 " do not appear in the data matrix:\n", | 
| 
860907bf0e0f
planemo upload for repository https://github.com/your_org_or_user/tools-metabolomics commit 3dd90b60510fa72eb8351464ec5d5883b0b6222a
 workflow4metabolomics parents: diff
changeset | 57 " ", | 
| 
860907bf0e0f
planemo upload for repository https://github.com/your_org_or_user/tools-metabolomics commit 3dd90b60510fa72eb8351464ec5d5883b0b6222a
 workflow4metabolomics parents: diff
changeset | 58 paste(head(missing_in_dm, 3), collapse = "\n "), | 
| 
860907bf0e0f
planemo upload for repository https://github.com/your_org_or_user/tools-metabolomics commit 3dd90b60510fa72eb8351464ec5d5883b0b6222a
 workflow4metabolomics parents: diff
changeset | 59 "\n" | 
| 
860907bf0e0f
planemo upload for repository https://github.com/your_org_or_user/tools-metabolomics commit 3dd90b60510fa72eb8351464ec5d5883b0b6222a
 workflow4metabolomics parents: diff
changeset | 60 ) | 
| 
860907bf0e0f
planemo upload for repository https://github.com/your_org_or_user/tools-metabolomics commit 3dd90b60510fa72eb8351464ec5d5883b0b6222a
 workflow4metabolomics parents: diff
changeset | 61 } | 
| 
860907bf0e0f
planemo upload for repository https://github.com/your_org_or_user/tools-metabolomics commit 3dd90b60510fa72eb8351464ec5d5883b0b6222a
 workflow4metabolomics parents: diff
changeset | 62 } | 
| 
860907bf0e0f
planemo upload for repository https://github.com/your_org_or_user/tools-metabolomics commit 3dd90b60510fa72eb8351464ec5d5883b0b6222a
 workflow4metabolomics parents: diff
changeset | 63 | 
| 
860907bf0e0f
planemo upload for repository https://github.com/your_org_or_user/tools-metabolomics commit 3dd90b60510fa72eb8351464ec5d5883b0b6222a
 workflow4metabolomics parents: diff
changeset | 64 # Check variable IDs | 
| 
860907bf0e0f
planemo upload for repository https://github.com/your_org_or_user/tools-metabolomics commit 3dd90b60510fa72eb8351464ec5d5883b0b6222a
 workflow4metabolomics parents: diff
changeset | 65 missing_in_vm <- setdiff(dm_vars, vm_vars) | 
| 
860907bf0e0f
planemo upload for repository https://github.com/your_org_or_user/tools-metabolomics commit 3dd90b60510fa72eb8351464ec5d5883b0b6222a
 workflow4metabolomics parents: diff
changeset | 66 missing_in_dm_var <- setdiff(vm_vars, dm_vars) | 
| 
860907bf0e0f
planemo upload for repository https://github.com/your_org_or_user/tools-metabolomics commit 3dd90b60510fa72eb8351464ec5d5883b0b6222a
 workflow4metabolomics parents: diff
changeset | 67 if (length(missing_in_vm) > 0 || length(missing_in_dm_var) > 0) { | 
| 
860907bf0e0f
planemo upload for repository https://github.com/your_org_or_user/tools-metabolomics commit 3dd90b60510fa72eb8351464ec5d5883b0b6222a
 workflow4metabolomics parents: diff
changeset | 68 err.stock <- c( | 
| 
860907bf0e0f
planemo upload for repository https://github.com/your_org_or_user/tools-metabolomics commit 3dd90b60510fa72eb8351464ec5d5883b0b6222a
 workflow4metabolomics parents: diff
changeset | 69 err.stock, | 
| 
860907bf0e0f
planemo upload for repository https://github.com/your_org_or_user/tools-metabolomics commit 3dd90b60510fa72eb8351464ec5d5883b0b6222a
 workflow4metabolomics parents: diff
changeset | 70 "\nData matrix and variable metadata do not match regarding variable identifiers." | 
| 
860907bf0e0f
planemo upload for repository https://github.com/your_org_or_user/tools-metabolomics commit 3dd90b60510fa72eb8351464ec5d5883b0b6222a
 workflow4metabolomics parents: diff
changeset | 71 ) | 
| 
860907bf0e0f
planemo upload for repository https://github.com/your_org_or_user/tools-metabolomics commit 3dd90b60510fa72eb8351464ec5d5883b0b6222a
 workflow4metabolomics parents: diff
changeset | 72 if (length(missing_in_vm) > 0) { | 
| 
860907bf0e0f
planemo upload for repository https://github.com/your_org_or_user/tools-metabolomics commit 3dd90b60510fa72eb8351464ec5d5883b0b6222a
 workflow4metabolomics parents: diff
changeset | 73 prefix <- if (length(missing_in_vm) < 4) { | 
| 
860907bf0e0f
planemo upload for repository https://github.com/your_org_or_user/tools-metabolomics commit 3dd90b60510fa72eb8351464ec5d5883b0b6222a
 workflow4metabolomics parents: diff
changeset | 74 "\n The " | 
| 
860907bf0e0f
planemo upload for repository https://github.com/your_org_or_user/tools-metabolomics commit 3dd90b60510fa72eb8351464ec5d5883b0b6222a
 workflow4metabolomics parents: diff
changeset | 75 } else { | 
| 
860907bf0e0f
planemo upload for repository https://github.com/your_org_or_user/tools-metabolomics commit 3dd90b60510fa72eb8351464ec5d5883b0b6222a
 workflow4metabolomics parents: diff
changeset | 76 "\n For example, the " | 
| 
860907bf0e0f
planemo upload for repository https://github.com/your_org_or_user/tools-metabolomics commit 3dd90b60510fa72eb8351464ec5d5883b0b6222a
 workflow4metabolomics parents: diff
changeset | 77 } | 
| 
860907bf0e0f
planemo upload for repository https://github.com/your_org_or_user/tools-metabolomics commit 3dd90b60510fa72eb8351464ec5d5883b0b6222a
 workflow4metabolomics parents: diff
changeset | 78 err.stock <- c( | 
| 
860907bf0e0f
planemo upload for repository https://github.com/your_org_or_user/tools-metabolomics commit 3dd90b60510fa72eb8351464ec5d5883b0b6222a
 workflow4metabolomics parents: diff
changeset | 79 err.stock, | 
| 
860907bf0e0f
planemo upload for repository https://github.com/your_org_or_user/tools-metabolomics commit 3dd90b60510fa72eb8351464ec5d5883b0b6222a
 workflow4metabolomics parents: diff
changeset | 80 prefix, | 
| 
860907bf0e0f
planemo upload for repository https://github.com/your_org_or_user/tools-metabolomics commit 3dd90b60510fa72eb8351464ec5d5883b0b6222a
 workflow4metabolomics parents: diff
changeset | 81 "following identifiers found in the data matrix\n", | 
| 
860907bf0e0f
planemo upload for repository https://github.com/your_org_or_user/tools-metabolomics commit 3dd90b60510fa72eb8351464ec5d5883b0b6222a
 workflow4metabolomics parents: diff
changeset | 82 " do not appear in the variable metadata file:\n", | 
| 
860907bf0e0f
planemo upload for repository https://github.com/your_org_or_user/tools-metabolomics commit 3dd90b60510fa72eb8351464ec5d5883b0b6222a
 workflow4metabolomics parents: diff
changeset | 83 " ", | 
| 
860907bf0e0f
planemo upload for repository https://github.com/your_org_or_user/tools-metabolomics commit 3dd90b60510fa72eb8351464ec5d5883b0b6222a
 workflow4metabolomics parents: diff
changeset | 84 paste(head(missing_in_vm, 3), collapse = "\n "), | 
| 
860907bf0e0f
planemo upload for repository https://github.com/your_org_or_user/tools-metabolomics commit 3dd90b60510fa72eb8351464ec5d5883b0b6222a
 workflow4metabolomics parents: diff
changeset | 85 "\n" | 
| 
860907bf0e0f
planemo upload for repository https://github.com/your_org_or_user/tools-metabolomics commit 3dd90b60510fa72eb8351464ec5d5883b0b6222a
 workflow4metabolomics parents: diff
changeset | 86 ) | 
| 
860907bf0e0f
planemo upload for repository https://github.com/your_org_or_user/tools-metabolomics commit 3dd90b60510fa72eb8351464ec5d5883b0b6222a
 workflow4metabolomics parents: diff
changeset | 87 } | 
| 
860907bf0e0f
planemo upload for repository https://github.com/your_org_or_user/tools-metabolomics commit 3dd90b60510fa72eb8351464ec5d5883b0b6222a
 workflow4metabolomics parents: diff
changeset | 88 if (length(missing_in_dm_var) > 0) { | 
| 
860907bf0e0f
planemo upload for repository https://github.com/your_org_or_user/tools-metabolomics commit 3dd90b60510fa72eb8351464ec5d5883b0b6222a
 workflow4metabolomics parents: diff
changeset | 89 prefix <- if (length(missing_in_dm_var) < 4) { | 
| 
860907bf0e0f
planemo upload for repository https://github.com/your_org_or_user/tools-metabolomics commit 3dd90b60510fa72eb8351464ec5d5883b0b6222a
 workflow4metabolomics parents: diff
changeset | 90 "\n The " | 
| 
860907bf0e0f
planemo upload for repository https://github.com/your_org_or_user/tools-metabolomics commit 3dd90b60510fa72eb8351464ec5d5883b0b6222a
 workflow4metabolomics parents: diff
changeset | 91 } else { | 
| 
860907bf0e0f
planemo upload for repository https://github.com/your_org_or_user/tools-metabolomics commit 3dd90b60510fa72eb8351464ec5d5883b0b6222a
 workflow4metabolomics parents: diff
changeset | 92 "\n For example, the " | 
| 
860907bf0e0f
planemo upload for repository https://github.com/your_org_or_user/tools-metabolomics commit 3dd90b60510fa72eb8351464ec5d5883b0b6222a
 workflow4metabolomics parents: diff
changeset | 93 } | 
| 
860907bf0e0f
planemo upload for repository https://github.com/your_org_or_user/tools-metabolomics commit 3dd90b60510fa72eb8351464ec5d5883b0b6222a
 workflow4metabolomics parents: diff
changeset | 94 err.stock <- c( | 
| 
860907bf0e0f
planemo upload for repository https://github.com/your_org_or_user/tools-metabolomics commit 3dd90b60510fa72eb8351464ec5d5883b0b6222a
 workflow4metabolomics parents: diff
changeset | 95 err.stock, | 
| 
860907bf0e0f
planemo upload for repository https://github.com/your_org_or_user/tools-metabolomics commit 3dd90b60510fa72eb8351464ec5d5883b0b6222a
 workflow4metabolomics parents: diff
changeset | 96 prefix, | 
| 
860907bf0e0f
planemo upload for repository https://github.com/your_org_or_user/tools-metabolomics commit 3dd90b60510fa72eb8351464ec5d5883b0b6222a
 workflow4metabolomics parents: diff
changeset | 97 "following identifiers found in the variable metadata file\n", | 
| 
860907bf0e0f
planemo upload for repository https://github.com/your_org_or_user/tools-metabolomics commit 3dd90b60510fa72eb8351464ec5d5883b0b6222a
 workflow4metabolomics parents: diff
changeset | 98 " do not appear in the data matrix:\n", | 
| 
860907bf0e0f
planemo upload for repository https://github.com/your_org_or_user/tools-metabolomics commit 3dd90b60510fa72eb8351464ec5d5883b0b6222a
 workflow4metabolomics parents: diff
changeset | 99 " ", | 
| 
860907bf0e0f
planemo upload for repository https://github.com/your_org_or_user/tools-metabolomics commit 3dd90b60510fa72eb8351464ec5d5883b0b6222a
 workflow4metabolomics parents: diff
changeset | 100 paste(head(missing_in_dm_var, 3), collapse = "\n "), | 
| 
860907bf0e0f
planemo upload for repository https://github.com/your_org_or_user/tools-metabolomics commit 3dd90b60510fa72eb8351464ec5d5883b0b6222a
 workflow4metabolomics parents: diff
changeset | 101 "\n" | 
| 
860907bf0e0f
planemo upload for repository https://github.com/your_org_or_user/tools-metabolomics commit 3dd90b60510fa72eb8351464ec5d5883b0b6222a
 workflow4metabolomics parents: diff
changeset | 102 ) | 
| 
860907bf0e0f
planemo upload for repository https://github.com/your_org_or_user/tools-metabolomics commit 3dd90b60510fa72eb8351464ec5d5883b0b6222a
 workflow4metabolomics parents: diff
changeset | 103 } | 
| 
860907bf0e0f
planemo upload for repository https://github.com/your_org_or_user/tools-metabolomics commit 3dd90b60510fa72eb8351464ec5d5883b0b6222a
 workflow4metabolomics parents: diff
changeset | 104 } | 
| 
860907bf0e0f
planemo upload for repository https://github.com/your_org_or_user/tools-metabolomics commit 3dd90b60510fa72eb8351464ec5d5883b0b6222a
 workflow4metabolomics parents: diff
changeset | 105 | 
| 
860907bf0e0f
planemo upload for repository https://github.com/your_org_or_user/tools-metabolomics commit 3dd90b60510fa72eb8351464ec5d5883b0b6222a
 workflow4metabolomics parents: diff
changeset | 106 if (length(err.stock) > 0) { | 
| 
860907bf0e0f
planemo upload for repository https://github.com/your_org_or_user/tools-metabolomics commit 3dd90b60510fa72eb8351464ec5d5883b0b6222a
 workflow4metabolomics parents: diff
changeset | 107 err.stock <- c(err.stock, "\nPlease check your data.\n") | 
| 
860907bf0e0f
planemo upload for repository https://github.com/your_org_or_user/tools-metabolomics commit 3dd90b60510fa72eb8351464ec5d5883b0b6222a
 workflow4metabolomics parents: diff
changeset | 108 } | 
| 
860907bf0e0f
planemo upload for repository https://github.com/your_org_or_user/tools-metabolomics commit 3dd90b60510fa72eb8351464ec5d5883b0b6222a
 workflow4metabolomics parents: diff
changeset | 109 | 
| 
860907bf0e0f
planemo upload for repository https://github.com/your_org_or_user/tools-metabolomics commit 3dd90b60510fa72eb8351464ec5d5883b0b6222a
 workflow4metabolomics parents: diff
changeset | 110 return(err.stock) | 
| 
860907bf0e0f
planemo upload for repository https://github.com/your_org_or_user/tools-metabolomics commit 3dd90b60510fa72eb8351464ec5d5883b0b6222a
 workflow4metabolomics parents: diff
changeset | 111 } | 
| 
860907bf0e0f
planemo upload for repository https://github.com/your_org_or_user/tools-metabolomics commit 3dd90b60510fa72eb8351464ec5d5883b0b6222a
 workflow4metabolomics parents: diff
changeset | 112 | 
| 
860907bf0e0f
planemo upload for repository https://github.com/your_org_or_user/tools-metabolomics commit 3dd90b60510fa72eb8351464ec5d5883b0b6222a
 workflow4metabolomics parents: diff
changeset | 113 | 
| 
860907bf0e0f
planemo upload for repository https://github.com/your_org_or_user/tools-metabolomics commit 3dd90b60510fa72eb8351464ec5d5883b0b6222a
 workflow4metabolomics parents: diff
changeset | 114 intens_check <- function( | 
| 
860907bf0e0f
planemo upload for repository https://github.com/your_org_or_user/tools-metabolomics commit 3dd90b60510fa72eb8351464ec5d5883b0b6222a
 workflow4metabolomics parents: diff
changeset | 115 DM.name, | 
| 
860907bf0e0f
planemo upload for repository https://github.com/your_org_or_user/tools-metabolomics commit 3dd90b60510fa72eb8351464ec5d5883b0b6222a
 workflow4metabolomics parents: diff
changeset | 116 SM.name, | 
| 
860907bf0e0f
planemo upload for repository https://github.com/your_org_or_user/tools-metabolomics commit 3dd90b60510fa72eb8351464ec5d5883b0b6222a
 workflow4metabolomics parents: diff
changeset | 117 VM.name, | 
| 
860907bf0e0f
planemo upload for repository https://github.com/your_org_or_user/tools-metabolomics commit 3dd90b60510fa72eb8351464ec5d5883b0b6222a
 workflow4metabolomics parents: diff
changeset | 118 method, | 
| 
860907bf0e0f
planemo upload for repository https://github.com/your_org_or_user/tools-metabolomics commit 3dd90b60510fa72eb8351464ec5d5883b0b6222a
 workflow4metabolomics parents: diff
changeset | 119 chosen.stat, | 
| 
860907bf0e0f
planemo upload for repository https://github.com/your_org_or_user/tools-metabolomics commit 3dd90b60510fa72eb8351464ec5d5883b0b6222a
 workflow4metabolomics parents: diff
changeset | 120 class.col, | 
| 
860907bf0e0f
planemo upload for repository https://github.com/your_org_or_user/tools-metabolomics commit 3dd90b60510fa72eb8351464ec5d5883b0b6222a
 workflow4metabolomics parents: diff
changeset | 121 test.fold, | 
| 
860907bf0e0f
planemo upload for repository https://github.com/your_org_or_user/tools-metabolomics commit 3dd90b60510fa72eb8351464ec5d5883b0b6222a
 workflow4metabolomics parents: diff
changeset | 122 class1, | 
| 
860907bf0e0f
planemo upload for repository https://github.com/your_org_or_user/tools-metabolomics commit 3dd90b60510fa72eb8351464ec5d5883b0b6222a
 workflow4metabolomics parents: diff
changeset | 123 fold.frac, | 
| 
860907bf0e0f
planemo upload for repository https://github.com/your_org_or_user/tools-metabolomics commit 3dd90b60510fa72eb8351464ec5d5883b0b6222a
 workflow4metabolomics parents: diff
changeset | 124 logarithm, | 
| 
860907bf0e0f
planemo upload for repository https://github.com/your_org_or_user/tools-metabolomics commit 3dd90b60510fa72eb8351464ec5d5883b0b6222a
 workflow4metabolomics parents: diff
changeset | 125 VM.output, | 
| 
860907bf0e0f
planemo upload for repository https://github.com/your_org_or_user/tools-metabolomics commit 3dd90b60510fa72eb8351464ec5d5883b0b6222a
 workflow4metabolomics parents: diff
changeset | 126 graphs.output) { | 
| 
860907bf0e0f
planemo upload for repository https://github.com/your_org_or_user/tools-metabolomics commit 3dd90b60510fa72eb8351464ec5d5883b0b6222a
 workflow4metabolomics parents: diff
changeset | 127 # Read input tables | 
| 
860907bf0e0f
planemo upload for repository https://github.com/your_org_or_user/tools-metabolomics commit 3dd90b60510fa72eb8351464ec5d5883b0b6222a
 workflow4metabolomics parents: diff
changeset | 128 DM <- read.table(DM.name, header = TRUE, sep = "\t", check.names = FALSE) | 
| 
860907bf0e0f
planemo upload for repository https://github.com/your_org_or_user/tools-metabolomics commit 3dd90b60510fa72eb8351464ec5d5883b0b6222a
 workflow4metabolomics parents: diff
changeset | 129 SM <- read.table(SM.name, header = TRUE, sep = "\t", check.names = FALSE) | 
| 
860907bf0e0f
planemo upload for repository https://github.com/your_org_or_user/tools-metabolomics commit 3dd90b60510fa72eb8351464ec5d5883b0b6222a
 workflow4metabolomics parents: diff
changeset | 130 VM <- read.table(VM.name, header = TRUE, sep = "\t", check.names = FALSE) | 
| 
860907bf0e0f
planemo upload for repository https://github.com/your_org_or_user/tools-metabolomics commit 3dd90b60510fa72eb8351464ec5d5883b0b6222a
 workflow4metabolomics parents: diff
changeset | 131 | 
| 
860907bf0e0f
planemo upload for repository https://github.com/your_org_or_user/tools-metabolomics commit 3dd90b60510fa72eb8351464ec5d5883b0b6222a
 workflow4metabolomics parents: diff
changeset | 132 # Table match check | 
| 
860907bf0e0f
planemo upload for repository https://github.com/your_org_or_user/tools-metabolomics commit 3dd90b60510fa72eb8351464ec5d5883b0b6222a
 workflow4metabolomics parents: diff
changeset | 133 table.check <- table_match(DM, SM, VM) | 
| 
860907bf0e0f
planemo upload for repository https://github.com/your_org_or_user/tools-metabolomics commit 3dd90b60510fa72eb8351464ec5d5883b0b6222a
 workflow4metabolomics parents: diff
changeset | 134 check.err(table.check) | 
| 
860907bf0e0f
planemo upload for repository https://github.com/your_org_or_user/tools-metabolomics commit 3dd90b60510fa72eb8351464ec5d5883b0b6222a
 workflow4metabolomics parents: diff
changeset | 135 | 
| 
860907bf0e0f
planemo upload for repository https://github.com/your_org_or_user/tools-metabolomics commit 3dd90b60510fa72eb8351464ec5d5883b0b6222a
 workflow4metabolomics parents: diff
changeset | 136 # Transpose and align DM | 
| 
860907bf0e0f
planemo upload for repository https://github.com/your_org_or_user/tools-metabolomics commit 3dd90b60510fa72eb8351464ec5d5883b0b6222a
 workflow4metabolomics parents: diff
changeset | 137 rownames(DM) <- DM[, 1] | 
| 
860907bf0e0f
planemo upload for repository https://github.com/your_org_or_user/tools-metabolomics commit 3dd90b60510fa72eb8351464ec5d5883b0b6222a
 workflow4metabolomics parents: diff
changeset | 138 DM <- data.frame(t(DM[, -1])) | 
| 
860907bf0e0f
planemo upload for repository https://github.com/your_org_or_user/tools-metabolomics commit 3dd90b60510fa72eb8351464ec5d5883b0b6222a
 workflow4metabolomics parents: diff
changeset | 139 DM <- merge(x = cbind(1:nrow(SM), SM), y = DM, by.x = 2, by.y = 0) | 
| 
860907bf0e0f
planemo upload for repository https://github.com/your_org_or_user/tools-metabolomics commit 3dd90b60510fa72eb8351464ec5d5883b0b6222a
 workflow4metabolomics parents: diff
changeset | 140 DM <- DM[order(DM[, 2]), ] | 
| 
860907bf0e0f
planemo upload for repository https://github.com/your_org_or_user/tools-metabolomics commit 3dd90b60510fa72eb8351464ec5d5883b0b6222a
 workflow4metabolomics parents: diff
changeset | 141 rownames(DM) <- DM[, 1] | 
| 
860907bf0e0f
planemo upload for repository https://github.com/your_org_or_user/tools-metabolomics commit 3dd90b60510fa72eb8351464ec5d5883b0b6222a
 workflow4metabolomics parents: diff
changeset | 142 DM <- DM[, -c(1:(ncol(SM) + 1))] | 
| 
860907bf0e0f
planemo upload for repository https://github.com/your_org_or_user/tools-metabolomics commit 3dd90b60510fa72eb8351464ec5d5883b0b6222a
 workflow4metabolomics parents: diff
changeset | 143 | 
| 
860907bf0e0f
planemo upload for repository https://github.com/your_org_or_user/tools-metabolomics commit 3dd90b60510fa72eb8351464ec5d5883b0b6222a
 workflow4metabolomics parents: diff
changeset | 144 stat.list <- strsplit(chosen.stat, ",")[[1]] | 
| 
860907bf0e0f
planemo upload for repository https://github.com/your_org_or_user/tools-metabolomics commit 3dd90b60510fa72eb8351464ec5d5883b0b6222a
 workflow4metabolomics parents: diff
changeset | 145 | 
| 
860907bf0e0f
planemo upload for repository https://github.com/your_org_or_user/tools-metabolomics commit 3dd90b60510fa72eb8351464ec5d5883b0b6222a
 workflow4metabolomics parents: diff
changeset | 146 # Class assignment | 
| 
860907bf0e0f
planemo upload for repository https://github.com/your_org_or_user/tools-metabolomics commit 3dd90b60510fa72eb8351464ec5d5883b0b6222a
 workflow4metabolomics parents: diff
changeset | 147 if (method == "no_class") { | 
| 
860907bf0e0f
planemo upload for repository https://github.com/your_org_or_user/tools-metabolomics commit 3dd90b60510fa72eb8351464ec5d5883b0b6222a
 workflow4metabolomics parents: diff
changeset | 148 c_class <- rep("global", nrow(DM)) | 
| 
860907bf0e0f
planemo upload for repository https://github.com/your_org_or_user/tools-metabolomics commit 3dd90b60510fa72eb8351464ec5d5883b0b6222a
 workflow4metabolomics parents: diff
changeset | 149 classnames <- "global" | 
| 
860907bf0e0f
planemo upload for repository https://github.com/your_org_or_user/tools-metabolomics commit 3dd90b60510fa72eb8351464ec5d5883b0b6222a
 workflow4metabolomics parents: diff
changeset | 150 nb_class <- 1 | 
| 
860907bf0e0f
planemo upload for repository https://github.com/your_org_or_user/tools-metabolomics commit 3dd90b60510fa72eb8351464ec5d5883b0b6222a
 workflow4metabolomics parents: diff
changeset | 151 test.fold <- "No" | 
| 
860907bf0e0f
planemo upload for repository https://github.com/your_org_or_user/tools-metabolomics commit 3dd90b60510fa72eb8351464ec5d5883b0b6222a
 workflow4metabolomics parents: diff
changeset | 152 } else { | 
| 
860907bf0e0f
planemo upload for repository https://github.com/your_org_or_user/tools-metabolomics commit 3dd90b60510fa72eb8351464ec5d5883b0b6222a
 workflow4metabolomics parents: diff
changeset | 153 class.col <- colnames(SM)[as.numeric(class.col)] | 
| 
860907bf0e0f
planemo upload for repository https://github.com/your_org_or_user/tools-metabolomics commit 3dd90b60510fa72eb8351464ec5d5883b0b6222a
 workflow4metabolomics parents: diff
changeset | 154 if (!(class.col %in% colnames(SM))) { | 
| 
860907bf0e0f
planemo upload for repository https://github.com/your_org_or_user/tools-metabolomics commit 3dd90b60510fa72eb8351464ec5d5883b0b6222a
 workflow4metabolomics parents: diff
changeset | 155 stop("The column ", class.col, " is not in sample metadata") | 
| 
860907bf0e0f
planemo upload for repository https://github.com/your_org_or_user/tools-metabolomics commit 3dd90b60510fa72eb8351464ec5d5883b0b6222a
 workflow4metabolomics parents: diff
changeset | 156 } | 
| 
860907bf0e0f
planemo upload for repository https://github.com/your_org_or_user/tools-metabolomics commit 3dd90b60510fa72eb8351464ec5d5883b0b6222a
 workflow4metabolomics parents: diff
changeset | 157 c_class <- as.factor(SM[, class.col]) | 
| 
860907bf0e0f
planemo upload for repository https://github.com/your_org_or_user/tools-metabolomics commit 3dd90b60510fa72eb8351464ec5d5883b0b6222a
 workflow4metabolomics parents: diff
changeset | 158 nb_class <- nlevels(c_class) | 
| 
860907bf0e0f
planemo upload for repository https://github.com/your_org_or_user/tools-metabolomics commit 3dd90b60510fa72eb8351464ec5d5883b0b6222a
 workflow4metabolomics parents: diff
changeset | 159 classnames <- levels(c_class) | 
| 
860907bf0e0f
planemo upload for repository https://github.com/your_org_or_user/tools-metabolomics commit 3dd90b60510fa72eb8351464ec5d5883b0b6222a
 workflow4metabolomics parents: diff
changeset | 160 if (nb_class < 2 && test.fold == "Yes") { | 
| 
860907bf0e0f
planemo upload for repository https://github.com/your_org_or_user/tools-metabolomics commit 3dd90b60510fa72eb8351464ec5d5883b0b6222a
 workflow4metabolomics parents: diff
changeset | 161 cat( | 
| 
860907bf0e0f
planemo upload for repository https://github.com/your_org_or_user/tools-metabolomics commit 3dd90b60510fa72eb8351464ec5d5883b0b6222a
 workflow4metabolomics parents: diff
changeset | 162 "The '", | 
| 
860907bf0e0f
planemo upload for repository https://github.com/your_org_or_user/tools-metabolomics commit 3dd90b60510fa72eb8351464ec5d5883b0b6222a
 workflow4metabolomics parents: diff
changeset | 163 class.col, | 
| 
860907bf0e0f
planemo upload for repository https://github.com/your_org_or_user/tools-metabolomics commit 3dd90b60510fa72eb8351464ec5d5883b0b6222a
 workflow4metabolomics parents: diff
changeset | 164 "' column contains only one class, fold calculation could not be executed.\n" | 
| 
860907bf0e0f
planemo upload for repository https://github.com/your_org_or_user/tools-metabolomics commit 3dd90b60510fa72eb8351464ec5d5883b0b6222a
 workflow4metabolomics parents: diff
changeset | 165 ) | 
| 
860907bf0e0f
planemo upload for repository https://github.com/your_org_or_user/tools-metabolomics commit 3dd90b60510fa72eb8351464ec5d5883b0b6222a
 workflow4metabolomics parents: diff
changeset | 166 } | 
| 
860907bf0e0f
planemo upload for repository https://github.com/your_org_or_user/tools-metabolomics commit 3dd90b60510fa72eb8351464ec5d5883b0b6222a
 workflow4metabolomics parents: diff
changeset | 167 if (nb_class > (nrow(SM)) / 3 && method == "each_class") { | 
| 
860907bf0e0f
planemo upload for repository https://github.com/your_org_or_user/tools-metabolomics commit 3dd90b60510fa72eb8351464ec5d5883b0b6222a
 workflow4metabolomics parents: diff
changeset | 168 cat("There are too many classes, consider reducing the number.\n") | 
| 
860907bf0e0f
planemo upload for repository https://github.com/your_org_or_user/tools-metabolomics commit 3dd90b60510fa72eb8351464ec5d5883b0b6222a
 workflow4metabolomics parents: diff
changeset | 169 } | 
| 
860907bf0e0f
planemo upload for repository https://github.com/your_org_or_user/tools-metabolomics commit 3dd90b60510fa72eb8351464ec5d5883b0b6222a
 workflow4metabolomics parents: diff
changeset | 170 if (method == "one_class") { | 
| 
860907bf0e0f
planemo upload for repository https://github.com/your_org_or_user/tools-metabolomics commit 3dd90b60510fa72eb8351464ec5d5883b0b6222a
 workflow4metabolomics parents: diff
changeset | 171 if (!(class1 %in% classnames)) { | 
| 
860907bf0e0f
planemo upload for repository https://github.com/your_org_or_user/tools-metabolomics commit 3dd90b60510fa72eb8351464ec5d5883b0b6222a
 workflow4metabolomics parents: diff
changeset | 172 stop("The '", class1, "' class does not appear in the '", class.col, "'column.") | 
| 
860907bf0e0f
planemo upload for repository https://github.com/your_org_or_user/tools-metabolomics commit 3dd90b60510fa72eb8351464ec5d5883b0b6222a
 workflow4metabolomics parents: diff
changeset | 173 } | 
| 
860907bf0e0f
planemo upload for repository https://github.com/your_org_or_user/tools-metabolomics commit 3dd90b60510fa72eb8351464ec5d5883b0b6222a
 workflow4metabolomics parents: diff
changeset | 174 c_class <- factor( | 
| 
860907bf0e0f
planemo upload for repository https://github.com/your_org_or_user/tools-metabolomics commit 3dd90b60510fa72eb8351464ec5d5883b0b6222a
 workflow4metabolomics parents: diff
changeset | 175 ifelse(c_class == class1, class1, "Other"), | 
| 
860907bf0e0f
planemo upload for repository https://github.com/your_org_or_user/tools-metabolomics commit 3dd90b60510fa72eb8351464ec5d5883b0b6222a
 workflow4metabolomics parents: diff
changeset | 176 levels = c(class1, "Other") | 
| 
860907bf0e0f
planemo upload for repository https://github.com/your_org_or_user/tools-metabolomics commit 3dd90b60510fa72eb8351464ec5d5883b0b6222a
 workflow4metabolomics parents: diff
changeset | 177 ) | 
| 
860907bf0e0f
planemo upload for repository https://github.com/your_org_or_user/tools-metabolomics commit 3dd90b60510fa72eb8351464ec5d5883b0b6222a
 workflow4metabolomics parents: diff
changeset | 178 nb_class <- nlevels(c_class) | 
| 
860907bf0e0f
planemo upload for repository https://github.com/your_org_or_user/tools-metabolomics commit 3dd90b60510fa72eb8351464ec5d5883b0b6222a
 workflow4metabolomics parents: diff
changeset | 179 classnames <- levels(c_class) | 
| 
860907bf0e0f
planemo upload for repository https://github.com/your_org_or_user/tools-metabolomics commit 3dd90b60510fa72eb8351464ec5d5883b0b6222a
 workflow4metabolomics parents: diff
changeset | 180 } | 
| 
860907bf0e0f
planemo upload for repository https://github.com/your_org_or_user/tools-metabolomics commit 3dd90b60510fa72eb8351464ec5d5883b0b6222a
 workflow4metabolomics parents: diff
changeset | 181 } | 
| 
860907bf0e0f
planemo upload for repository https://github.com/your_org_or_user/tools-metabolomics commit 3dd90b60510fa72eb8351464ec5d5883b0b6222a
 workflow4metabolomics parents: diff
changeset | 182 | 
| 
860907bf0e0f
planemo upload for repository https://github.com/your_org_or_user/tools-metabolomics commit 3dd90b60510fa72eb8351464ec5d5883b0b6222a
 workflow4metabolomics parents: diff
changeset | 183 # Check numeric | 
| 
860907bf0e0f
planemo upload for repository https://github.com/your_org_or_user/tools-metabolomics commit 3dd90b60510fa72eb8351464ec5d5883b0b6222a
 workflow4metabolomics parents: diff
changeset | 184 if (!is.numeric(as.matrix(DM))) { | 
| 
860907bf0e0f
planemo upload for repository https://github.com/your_org_or_user/tools-metabolomics commit 3dd90b60510fa72eb8351464ec5d5883b0b6222a
 workflow4metabolomics parents: diff
changeset | 185 findchar <- function(myval) { | 
| 
860907bf0e0f
planemo upload for repository https://github.com/your_org_or_user/tools-metabolomics commit 3dd90b60510fa72eb8351464ec5d5883b0b6222a
 workflow4metabolomics parents: diff
changeset | 186 ifelse( | 
| 
860907bf0e0f
planemo upload for repository https://github.com/your_org_or_user/tools-metabolomics commit 3dd90b60510fa72eb8351464ec5d5883b0b6222a
 workflow4metabolomics parents: diff
changeset | 187 is.na(myval), | 
| 
860907bf0e0f
planemo upload for repository https://github.com/your_org_or_user/tools-metabolomics commit 3dd90b60510fa72eb8351464ec5d5883b0b6222a
 workflow4metabolomics parents: diff
changeset | 188 "ok", | 
| 
860907bf0e0f
planemo upload for repository https://github.com/your_org_or_user/tools-metabolomics commit 3dd90b60510fa72eb8351464ec5d5883b0b6222a
 workflow4metabolomics parents: diff
changeset | 189 ifelse(is.na(as.numeric(as.character(myval))), "char", "ok") | 
| 
860907bf0e0f
planemo upload for repository https://github.com/your_org_or_user/tools-metabolomics commit 3dd90b60510fa72eb8351464ec5d5883b0b6222a
 workflow4metabolomics parents: diff
changeset | 190 ) | 
| 
860907bf0e0f
planemo upload for repository https://github.com/your_org_or_user/tools-metabolomics commit 3dd90b60510fa72eb8351464ec5d5883b0b6222a
 workflow4metabolomics parents: diff
changeset | 191 } | 
| 
860907bf0e0f
planemo upload for repository https://github.com/your_org_or_user/tools-metabolomics commit 3dd90b60510fa72eb8351464ec5d5883b0b6222a
 workflow4metabolomics parents: diff
changeset | 192 chardiag <- suppressWarnings(apply(DM, 2, vapply, findchar, "character")) | 
| 
860907bf0e0f
planemo upload for repository https://github.com/your_org_or_user/tools-metabolomics commit 3dd90b60510fa72eb8351464ec5d5883b0b6222a
 workflow4metabolomics parents: diff
changeset | 193 charlist <- which(chardiag == "char") | 
| 
860907bf0e0f
planemo upload for repository https://github.com/your_org_or_user/tools-metabolomics commit 3dd90b60510fa72eb8351464ec5d5883b0b6222a
 workflow4metabolomics parents: diff
changeset | 194 err.stock <- paste( | 
| 
860907bf0e0f
planemo upload for repository https://github.com/your_org_or_user/tools-metabolomics commit 3dd90b60510fa72eb8351464ec5d5883b0b6222a
 workflow4metabolomics parents: diff
changeset | 195 "\n- - - - - - - - -\nYour dataMatrix contains", | 
| 
860907bf0e0f
planemo upload for repository https://github.com/your_org_or_user/tools-metabolomics commit 3dd90b60510fa72eb8351464ec5d5883b0b6222a
 workflow4metabolomics parents: diff
changeset | 196 length(charlist), | 
| 
860907bf0e0f
planemo upload for repository https://github.com/your_org_or_user/tools-metabolomics commit 3dd90b60510fa72eb8351464ec5d5883b0b6222a
 workflow4metabolomics parents: diff
changeset | 197 "non-numeric value(s).\n" | 
| 
860907bf0e0f
planemo upload for repository https://github.com/your_org_or_user/tools-metabolomics commit 3dd90b60510fa72eb8351464ec5d5883b0b6222a
 workflow4metabolomics parents: diff
changeset | 198 ) | 
| 
860907bf0e0f
planemo upload for repository https://github.com/your_org_or_user/tools-metabolomics commit 3dd90b60510fa72eb8351464ec5d5883b0b6222a
 workflow4metabolomics parents: diff
changeset | 199 stop(c( | 
| 
860907bf0e0f
planemo upload for repository https://github.com/your_org_or_user/tools-metabolomics commit 3dd90b60510fa72eb8351464ec5d5883b0b6222a
 workflow4metabolomics parents: diff
changeset | 200 err.stock, | 
| 
860907bf0e0f
planemo upload for repository https://github.com/your_org_or_user/tools-metabolomics commit 3dd90b60510fa72eb8351464ec5d5883b0b6222a
 workflow4metabolomics parents: diff
changeset | 201 "The dataMatrix file is supposed to contain only numeric values.\n- - - - - - - - -\n" | 
| 
860907bf0e0f
planemo upload for repository https://github.com/your_org_or_user/tools-metabolomics commit 3dd90b60510fa72eb8351464ec5d5883b0b6222a
 workflow4metabolomics parents: diff
changeset | 202 )) | 
| 
860907bf0e0f
planemo upload for repository https://github.com/your_org_or_user/tools-metabolomics commit 3dd90b60510fa72eb8351464ec5d5883b0b6222a
 workflow4metabolomics parents: diff
changeset | 203 } | 
| 
860907bf0e0f
planemo upload for repository https://github.com/your_org_or_user/tools-metabolomics commit 3dd90b60510fa72eb8351464ec5d5883b0b6222a
 workflow4metabolomics parents: diff
changeset | 204 | 
| 
860907bf0e0f
planemo upload for repository https://github.com/your_org_or_user/tools-metabolomics commit 3dd90b60510fa72eb8351464ec5d5883b0b6222a
 workflow4metabolomics parents: diff
changeset | 205 DM <- cbind(c_class, DM) | 
| 
860907bf0e0f
planemo upload for repository https://github.com/your_org_or_user/tools-metabolomics commit 3dd90b60510fa72eb8351464ec5d5883b0b6222a
 workflow4metabolomics parents: diff
changeset | 206 stat.res <- t(DM[0, -1, drop = FALSE]) | 
| 
860907bf0e0f
planemo upload for repository https://github.com/your_org_or_user/tools-metabolomics commit 3dd90b60510fa72eb8351464ec5d5883b0b6222a
 workflow4metabolomics parents: diff
changeset | 207 names <- NULL | 
| 
860907bf0e0f
planemo upload for repository https://github.com/your_org_or_user/tools-metabolomics commit 3dd90b60510fa72eb8351464ec5d5883b0b6222a
 workflow4metabolomics parents: diff
changeset | 208 | 
| 
860907bf0e0f
planemo upload for repository https://github.com/your_org_or_user/tools-metabolomics commit 3dd90b60510fa72eb8351464ec5d5883b0b6222a
 workflow4metabolomics parents: diff
changeset | 209 mean.res <- sd.res <- med.res <- quart.res <- dec.res <- NA.res <- pct_NA.res <- fold.res <- NULL | 
| 
860907bf0e0f
planemo upload for repository https://github.com/your_org_or_user/tools-metabolomics commit 3dd90b60510fa72eb8351464ec5d5883b0b6222a
 workflow4metabolomics parents: diff
changeset | 210 mean.names <- sd.names <- med.names <- quart.names <- dec.names <- NA.names <- pct_NA.names <- fold.names <- NULL | 
| 
860907bf0e0f
planemo upload for repository https://github.com/your_org_or_user/tools-metabolomics commit 3dd90b60510fa72eb8351464ec5d5883b0b6222a
 workflow4metabolomics parents: diff
changeset | 211 graphs <- if (("NA" %in% stat.list) || (test.fold == "Yes")) 1 else 0 | 
| 
860907bf0e0f
planemo upload for repository https://github.com/your_org_or_user/tools-metabolomics commit 3dd90b60510fa72eb8351464ec5d5883b0b6222a
 workflow4metabolomics parents: diff
changeset | 212 data_bp <- data.frame() | 
| 
860907bf0e0f
planemo upload for repository https://github.com/your_org_or_user/tools-metabolomics commit 3dd90b60510fa72eb8351464ec5d5883b0b6222a
 workflow4metabolomics parents: diff
changeset | 213 | 
| 
860907bf0e0f
planemo upload for repository https://github.com/your_org_or_user/tools-metabolomics commit 3dd90b60510fa72eb8351464ec5d5883b0b6222a
 workflow4metabolomics parents: diff
changeset | 214 for (j in 1:nb_class) { | 
| 
860907bf0e0f
planemo upload for repository https://github.com/your_org_or_user/tools-metabolomics commit 3dd90b60510fa72eb8351464ec5d5883b0b6222a
 workflow4metabolomics parents: diff
changeset | 215 idx <- which(DM$c_class == classnames[j]) | 
| 
860907bf0e0f
planemo upload for repository https://github.com/your_org_or_user/tools-metabolomics commit 3dd90b60510fa72eb8351464ec5d5883b0b6222a
 workflow4metabolomics parents: diff
changeset | 216 # Mean | 
| 
860907bf0e0f
planemo upload for repository https://github.com/your_org_or_user/tools-metabolomics commit 3dd90b60510fa72eb8351464ec5d5883b0b6222a
 workflow4metabolomics parents: diff
changeset | 217 if ("mean" %in% stat.list) { | 
| 
860907bf0e0f
planemo upload for repository https://github.com/your_org_or_user/tools-metabolomics commit 3dd90b60510fa72eb8351464ec5d5883b0b6222a
 workflow4metabolomics parents: diff
changeset | 218 mean.res <- cbind(mean.res, colMeans(DM[idx, -1], na.rm = TRUE)) | 
| 
860907bf0e0f
planemo upload for repository https://github.com/your_org_or_user/tools-metabolomics commit 3dd90b60510fa72eb8351464ec5d5883b0b6222a
 workflow4metabolomics parents: diff
changeset | 219 mean.names <- cbind(mean.names, paste("Mean", classnames[j], sep = "_")) | 
| 
860907bf0e0f
planemo upload for repository https://github.com/your_org_or_user/tools-metabolomics commit 3dd90b60510fa72eb8351464ec5d5883b0b6222a
 workflow4metabolomics parents: diff
changeset | 220 if (j == nb_class) { | 
| 
860907bf0e0f
planemo upload for repository https://github.com/your_org_or_user/tools-metabolomics commit 3dd90b60510fa72eb8351464ec5d5883b0b6222a
 workflow4metabolomics parents: diff
changeset | 221 stat.res <- cbind(stat.res, mean.res) | 
| 
860907bf0e0f
planemo upload for repository https://github.com/your_org_or_user/tools-metabolomics commit 3dd90b60510fa72eb8351464ec5d5883b0b6222a
 workflow4metabolomics parents: diff
changeset | 222 names <- cbind(names, mean.names) | 
| 
860907bf0e0f
planemo upload for repository https://github.com/your_org_or_user/tools-metabolomics commit 3dd90b60510fa72eb8351464ec5d5883b0b6222a
 workflow4metabolomics parents: diff
changeset | 223 } | 
| 
860907bf0e0f
planemo upload for repository https://github.com/your_org_or_user/tools-metabolomics commit 3dd90b60510fa72eb8351464ec5d5883b0b6222a
 workflow4metabolomics parents: diff
changeset | 224 } | 
| 
860907bf0e0f
planemo upload for repository https://github.com/your_org_or_user/tools-metabolomics commit 3dd90b60510fa72eb8351464ec5d5883b0b6222a
 workflow4metabolomics parents: diff
changeset | 225 # SD | 
| 
860907bf0e0f
planemo upload for repository https://github.com/your_org_or_user/tools-metabolomics commit 3dd90b60510fa72eb8351464ec5d5883b0b6222a
 workflow4metabolomics parents: diff
changeset | 226 if ("sd" %in% stat.list) { | 
| 
860907bf0e0f
planemo upload for repository https://github.com/your_org_or_user/tools-metabolomics commit 3dd90b60510fa72eb8351464ec5d5883b0b6222a
 workflow4metabolomics parents: diff
changeset | 227 sd.res <- cbind(sd.res, apply(DM[idx, -1], 2, sd, na.rm = TRUE)) | 
| 
860907bf0e0f
planemo upload for repository https://github.com/your_org_or_user/tools-metabolomics commit 3dd90b60510fa72eb8351464ec5d5883b0b6222a
 workflow4metabolomics parents: diff
changeset | 228 sd.names <- cbind(sd.names, paste("Sd", classnames[j], sep = "_")) | 
| 
860907bf0e0f
planemo upload for repository https://github.com/your_org_or_user/tools-metabolomics commit 3dd90b60510fa72eb8351464ec5d5883b0b6222a
 workflow4metabolomics parents: diff
changeset | 229 if (j == nb_class) { | 
| 
860907bf0e0f
planemo upload for repository https://github.com/your_org_or_user/tools-metabolomics commit 3dd90b60510fa72eb8351464ec5d5883b0b6222a
 workflow4metabolomics parents: diff
changeset | 230 stat.res <- cbind(stat.res, sd.res) | 
| 
860907bf0e0f
planemo upload for repository https://github.com/your_org_or_user/tools-metabolomics commit 3dd90b60510fa72eb8351464ec5d5883b0b6222a
 workflow4metabolomics parents: diff
changeset | 231 names <- cbind(names, sd.names) | 
| 
860907bf0e0f
planemo upload for repository https://github.com/your_org_or_user/tools-metabolomics commit 3dd90b60510fa72eb8351464ec5d5883b0b6222a
 workflow4metabolomics parents: diff
changeset | 232 } | 
| 
860907bf0e0f
planemo upload for repository https://github.com/your_org_or_user/tools-metabolomics commit 3dd90b60510fa72eb8351464ec5d5883b0b6222a
 workflow4metabolomics parents: diff
changeset | 233 } | 
| 
860907bf0e0f
planemo upload for repository https://github.com/your_org_or_user/tools-metabolomics commit 3dd90b60510fa72eb8351464ec5d5883b0b6222a
 workflow4metabolomics parents: diff
changeset | 234 # Median | 
| 
860907bf0e0f
planemo upload for repository https://github.com/your_org_or_user/tools-metabolomics commit 3dd90b60510fa72eb8351464ec5d5883b0b6222a
 workflow4metabolomics parents: diff
changeset | 235 if (("median" %in% stat.list) && (!("quartile" %in% stat.list))) { | 
| 
860907bf0e0f
planemo upload for repository https://github.com/your_org_or_user/tools-metabolomics commit 3dd90b60510fa72eb8351464ec5d5883b0b6222a
 workflow4metabolomics parents: diff
changeset | 236 med.res <- cbind(med.res, apply(DM[idx, -1], 2, median, na.rm = TRUE)) | 
| 
860907bf0e0f
planemo upload for repository https://github.com/your_org_or_user/tools-metabolomics commit 3dd90b60510fa72eb8351464ec5d5883b0b6222a
 workflow4metabolomics parents: diff
changeset | 237 med.names <- cbind(med.names, paste("Median", classnames[j], sep = "_")) | 
| 
860907bf0e0f
planemo upload for repository https://github.com/your_org_or_user/tools-metabolomics commit 3dd90b60510fa72eb8351464ec5d5883b0b6222a
 workflow4metabolomics parents: diff
changeset | 238 if (j == nb_class) { | 
| 
860907bf0e0f
planemo upload for repository https://github.com/your_org_or_user/tools-metabolomics commit 3dd90b60510fa72eb8351464ec5d5883b0b6222a
 workflow4metabolomics parents: diff
changeset | 239 stat.res <- cbind(stat.res, med.res) | 
| 
860907bf0e0f
planemo upload for repository https://github.com/your_org_or_user/tools-metabolomics commit 3dd90b60510fa72eb8351464ec5d5883b0b6222a
 workflow4metabolomics parents: diff
changeset | 240 names <- cbind(names, med.names) | 
| 
860907bf0e0f
planemo upload for repository https://github.com/your_org_or_user/tools-metabolomics commit 3dd90b60510fa72eb8351464ec5d5883b0b6222a
 workflow4metabolomics parents: diff
changeset | 241 } | 
| 
860907bf0e0f
planemo upload for repository https://github.com/your_org_or_user/tools-metabolomics commit 3dd90b60510fa72eb8351464ec5d5883b0b6222a
 workflow4metabolomics parents: diff
changeset | 242 } | 
| 
860907bf0e0f
planemo upload for repository https://github.com/your_org_or_user/tools-metabolomics commit 3dd90b60510fa72eb8351464ec5d5883b0b6222a
 workflow4metabolomics parents: diff
changeset | 243 # Quartiles | 
| 
860907bf0e0f
planemo upload for repository https://github.com/your_org_or_user/tools-metabolomics commit 3dd90b60510fa72eb8351464ec5d5883b0b6222a
 workflow4metabolomics parents: diff
changeset | 244 if ("quartile" %in% stat.list) { | 
| 
860907bf0e0f
planemo upload for repository https://github.com/your_org_or_user/tools-metabolomics commit 3dd90b60510fa72eb8351464ec5d5883b0b6222a
 workflow4metabolomics parents: diff
changeset | 245 quart.res <- cbind( | 
| 
860907bf0e0f
planemo upload for repository https://github.com/your_org_or_user/tools-metabolomics commit 3dd90b60510fa72eb8351464ec5d5883b0b6222a
 workflow4metabolomics parents: diff
changeset | 246 quart.res, | 
| 
860907bf0e0f
planemo upload for repository https://github.com/your_org_or_user/tools-metabolomics commit 3dd90b60510fa72eb8351464ec5d5883b0b6222a
 workflow4metabolomics parents: diff
changeset | 247 t(apply(DM[idx, -1], 2, quantile, na.rm = TRUE)) | 
| 
860907bf0e0f
planemo upload for repository https://github.com/your_org_or_user/tools-metabolomics commit 3dd90b60510fa72eb8351464ec5d5883b0b6222a
 workflow4metabolomics parents: diff
changeset | 248 ) | 
| 
860907bf0e0f
planemo upload for repository https://github.com/your_org_or_user/tools-metabolomics commit 3dd90b60510fa72eb8351464ec5d5883b0b6222a
 workflow4metabolomics parents: diff
changeset | 249 quart.names <- cbind( | 
| 
860907bf0e0f
planemo upload for repository https://github.com/your_org_or_user/tools-metabolomics commit 3dd90b60510fa72eb8351464ec5d5883b0b6222a
 workflow4metabolomics parents: diff
changeset | 250 quart.names, | 
| 
860907bf0e0f
planemo upload for repository https://github.com/your_org_or_user/tools-metabolomics commit 3dd90b60510fa72eb8351464ec5d5883b0b6222a
 workflow4metabolomics parents: diff
changeset | 251 paste("Min", classnames[j], sep = "_"), | 
| 
860907bf0e0f
planemo upload for repository https://github.com/your_org_or_user/tools-metabolomics commit 3dd90b60510fa72eb8351464ec5d5883b0b6222a
 workflow4metabolomics parents: diff
changeset | 252 paste("Q1", classnames[j], sep = "_"), | 
| 
860907bf0e0f
planemo upload for repository https://github.com/your_org_or_user/tools-metabolomics commit 3dd90b60510fa72eb8351464ec5d5883b0b6222a
 workflow4metabolomics parents: diff
changeset | 253 paste("Median", classnames[j], sep = "_"), | 
| 
860907bf0e0f
planemo upload for repository https://github.com/your_org_or_user/tools-metabolomics commit 3dd90b60510fa72eb8351464ec5d5883b0b6222a
 workflow4metabolomics parents: diff
changeset | 254 paste("Q3", classnames[j], sep = "_"), | 
| 
860907bf0e0f
planemo upload for repository https://github.com/your_org_or_user/tools-metabolomics commit 3dd90b60510fa72eb8351464ec5d5883b0b6222a
 workflow4metabolomics parents: diff
changeset | 255 paste("Max", classnames[j], sep = "_") | 
| 
860907bf0e0f
planemo upload for repository https://github.com/your_org_or_user/tools-metabolomics commit 3dd90b60510fa72eb8351464ec5d5883b0b6222a
 workflow4metabolomics parents: diff
changeset | 256 ) | 
| 
860907bf0e0f
planemo upload for repository https://github.com/your_org_or_user/tools-metabolomics commit 3dd90b60510fa72eb8351464ec5d5883b0b6222a
 workflow4metabolomics parents: diff
changeset | 257 if (j == nb_class) { | 
| 
860907bf0e0f
planemo upload for repository https://github.com/your_org_or_user/tools-metabolomics commit 3dd90b60510fa72eb8351464ec5d5883b0b6222a
 workflow4metabolomics parents: diff
changeset | 258 stat.res <- cbind(stat.res, quart.res) | 
| 
860907bf0e0f
planemo upload for repository https://github.com/your_org_or_user/tools-metabolomics commit 3dd90b60510fa72eb8351464ec5d5883b0b6222a
 workflow4metabolomics parents: diff
changeset | 259 names <- cbind(names, quart.names) | 
| 
860907bf0e0f
planemo upload for repository https://github.com/your_org_or_user/tools-metabolomics commit 3dd90b60510fa72eb8351464ec5d5883b0b6222a
 workflow4metabolomics parents: diff
changeset | 260 } | 
| 
860907bf0e0f
planemo upload for repository https://github.com/your_org_or_user/tools-metabolomics commit 3dd90b60510fa72eb8351464ec5d5883b0b6222a
 workflow4metabolomics parents: diff
changeset | 261 } | 
| 
860907bf0e0f
planemo upload for repository https://github.com/your_org_or_user/tools-metabolomics commit 3dd90b60510fa72eb8351464ec5d5883b0b6222a
 workflow4metabolomics parents: diff
changeset | 262 # Deciles | 
| 
860907bf0e0f
planemo upload for repository https://github.com/your_org_or_user/tools-metabolomics commit 3dd90b60510fa72eb8351464ec5d5883b0b6222a
 workflow4metabolomics parents: diff
changeset | 263 if ("decile" %in% stat.list) { | 
| 
860907bf0e0f
planemo upload for repository https://github.com/your_org_or_user/tools-metabolomics commit 3dd90b60510fa72eb8351464ec5d5883b0b6222a
 workflow4metabolomics parents: diff
changeset | 264 dec.res <- cbind( | 
| 
860907bf0e0f
planemo upload for repository https://github.com/your_org_or_user/tools-metabolomics commit 3dd90b60510fa72eb8351464ec5d5883b0b6222a
 workflow4metabolomics parents: diff
changeset | 265 dec.res, | 
| 
860907bf0e0f
planemo upload for repository https://github.com/your_org_or_user/tools-metabolomics commit 3dd90b60510fa72eb8351464ec5d5883b0b6222a
 workflow4metabolomics parents: diff
changeset | 266 t(apply(DM[idx, -1], 2, quantile, na.rm = TRUE, seq(0, 1, 0.1))) | 
| 
860907bf0e0f
planemo upload for repository https://github.com/your_org_or_user/tools-metabolomics commit 3dd90b60510fa72eb8351464ec5d5883b0b6222a
 workflow4metabolomics parents: diff
changeset | 267 ) | 
| 
860907bf0e0f
planemo upload for repository https://github.com/your_org_or_user/tools-metabolomics commit 3dd90b60510fa72eb8351464ec5d5883b0b6222a
 workflow4metabolomics parents: diff
changeset | 268 dec.names <- cbind( | 
| 
860907bf0e0f
planemo upload for repository https://github.com/your_org_or_user/tools-metabolomics commit 3dd90b60510fa72eb8351464ec5d5883b0b6222a
 workflow4metabolomics parents: diff
changeset | 269 dec.names, | 
| 
860907bf0e0f
planemo upload for repository https://github.com/your_org_or_user/tools-metabolomics commit 3dd90b60510fa72eb8351464ec5d5883b0b6222a
 workflow4metabolomics parents: diff
changeset | 270 t(matrix(paste("D", seq(0, 10, 1), sep = "_", classnames[j]))) | 
| 
860907bf0e0f
planemo upload for repository https://github.com/your_org_or_user/tools-metabolomics commit 3dd90b60510fa72eb8351464ec5d5883b0b6222a
 workflow4metabolomics parents: diff
changeset | 271 ) | 
| 
860907bf0e0f
planemo upload for repository https://github.com/your_org_or_user/tools-metabolomics commit 3dd90b60510fa72eb8351464ec5d5883b0b6222a
 workflow4metabolomics parents: diff
changeset | 272 if (j == nb_class) { | 
| 
860907bf0e0f
planemo upload for repository https://github.com/your_org_or_user/tools-metabolomics commit 3dd90b60510fa72eb8351464ec5d5883b0b6222a
 workflow4metabolomics parents: diff
changeset | 273 stat.res <- cbind(stat.res, dec.res) | 
| 
860907bf0e0f
planemo upload for repository https://github.com/your_org_or_user/tools-metabolomics commit 3dd90b60510fa72eb8351464ec5d5883b0b6222a
 workflow4metabolomics parents: diff
changeset | 274 names <- cbind(names, dec.names) | 
| 
860907bf0e0f
planemo upload for repository https://github.com/your_org_or_user/tools-metabolomics commit 3dd90b60510fa72eb8351464ec5d5883b0b6222a
 workflow4metabolomics parents: diff
changeset | 275 } | 
| 
860907bf0e0f
planemo upload for repository https://github.com/your_org_or_user/tools-metabolomics commit 3dd90b60510fa72eb8351464ec5d5883b0b6222a
 workflow4metabolomics parents: diff
changeset | 276 } | 
| 
860907bf0e0f
planemo upload for repository https://github.com/your_org_or_user/tools-metabolomics commit 3dd90b60510fa72eb8351464ec5d5883b0b6222a
 workflow4metabolomics parents: diff
changeset | 277 # Missing values | 
| 
860907bf0e0f
planemo upload for repository https://github.com/your_org_or_user/tools-metabolomics commit 3dd90b60510fa72eb8351464ec5d5883b0b6222a
 workflow4metabolomics parents: diff
changeset | 278 if ("NA" %in% stat.list) { | 
| 
860907bf0e0f
planemo upload for repository https://github.com/your_org_or_user/tools-metabolomics commit 3dd90b60510fa72eb8351464ec5d5883b0b6222a
 workflow4metabolomics parents: diff
changeset | 279 nb_NA <- apply(DM[idx, -1], 2, function(x) sum(is.na(x))) | 
| 
860907bf0e0f
planemo upload for repository https://github.com/your_org_or_user/tools-metabolomics commit 3dd90b60510fa72eb8351464ec5d5883b0b6222a
 workflow4metabolomics parents: diff
changeset | 280 pct_NA <- round(nb_NA / nrow(DM[idx, -1]) * 100, 4) | 
| 
860907bf0e0f
planemo upload for repository https://github.com/your_org_or_user/tools-metabolomics commit 3dd90b60510fa72eb8351464ec5d5883b0b6222a
 workflow4metabolomics parents: diff
changeset | 281 NA.res <- cbind(NA.res, nb_NA) | 
| 
860907bf0e0f
planemo upload for repository https://github.com/your_org_or_user/tools-metabolomics commit 3dd90b60510fa72eb8351464ec5d5883b0b6222a
 workflow4metabolomics parents: diff
changeset | 282 pct_NA.res <- cbind(pct_NA.res, pct_NA) | 
| 
860907bf0e0f
planemo upload for repository https://github.com/your_org_or_user/tools-metabolomics commit 3dd90b60510fa72eb8351464ec5d5883b0b6222a
 workflow4metabolomics parents: diff
changeset | 283 NA.names <- cbind(NA.names, paste("NA", classnames[j], sep = "_")) | 
| 
860907bf0e0f
planemo upload for repository https://github.com/your_org_or_user/tools-metabolomics commit 3dd90b60510fa72eb8351464ec5d5883b0b6222a
 workflow4metabolomics parents: diff
changeset | 284 pct_NA.names <- cbind( | 
| 
860907bf0e0f
planemo upload for repository https://github.com/your_org_or_user/tools-metabolomics commit 3dd90b60510fa72eb8351464ec5d5883b0b6222a
 workflow4metabolomics parents: diff
changeset | 285 pct_NA.names, | 
| 
860907bf0e0f
planemo upload for repository https://github.com/your_org_or_user/tools-metabolomics commit 3dd90b60510fa72eb8351464ec5d5883b0b6222a
 workflow4metabolomics parents: diff
changeset | 286 paste("Pct_NA", classnames[j], sep = "_") | 
| 
860907bf0e0f
planemo upload for repository https://github.com/your_org_or_user/tools-metabolomics commit 3dd90b60510fa72eb8351464ec5d5883b0b6222a
 workflow4metabolomics parents: diff
changeset | 287 ) | 
| 
860907bf0e0f
planemo upload for repository https://github.com/your_org_or_user/tools-metabolomics commit 3dd90b60510fa72eb8351464ec5d5883b0b6222a
 workflow4metabolomics parents: diff
changeset | 288 if (j == nb_class) { | 
| 
860907bf0e0f
planemo upload for repository https://github.com/your_org_or_user/tools-metabolomics commit 3dd90b60510fa72eb8351464ec5d5883b0b6222a
 workflow4metabolomics parents: diff
changeset | 289 stat.res <- cbind(stat.res, NA.res, pct_NA.res) | 
| 
860907bf0e0f
planemo upload for repository https://github.com/your_org_or_user/tools-metabolomics commit 3dd90b60510fa72eb8351464ec5d5883b0b6222a
 workflow4metabolomics parents: diff
changeset | 290 names <- cbind(names, NA.names, pct_NA.names) | 
| 
860907bf0e0f
planemo upload for repository https://github.com/your_org_or_user/tools-metabolomics commit 3dd90b60510fa72eb8351464ec5d5883b0b6222a
 workflow4metabolomics parents: diff
changeset | 291 } | 
| 
860907bf0e0f
planemo upload for repository https://github.com/your_org_or_user/tools-metabolomics commit 3dd90b60510fa72eb8351464ec5d5883b0b6222a
 workflow4metabolomics parents: diff
changeset | 292 # Barplot data | 
| 
860907bf0e0f
planemo upload for repository https://github.com/your_org_or_user/tools-metabolomics commit 3dd90b60510fa72eb8351464ec5d5883b0b6222a
 workflow4metabolomics parents: diff
changeset | 293 bins <- cut(pct_NA, breaks = c(-1, 20, 40, 60, 80, 100), labels = FALSE) | 
| 
860907bf0e0f
planemo upload for repository https://github.com/your_org_or_user/tools-metabolomics commit 3dd90b60510fa72eb8351464ec5d5883b0b6222a
 workflow4metabolomics parents: diff
changeset | 294 for (b in 1:5) data_bp[b, j] <- sum(bins == b) | 
| 
860907bf0e0f
planemo upload for repository https://github.com/your_org_or_user/tools-metabolomics commit 3dd90b60510fa72eb8351464ec5d5883b0b6222a
 workflow4metabolomics parents: diff
changeset | 295 rownames(data_bp) <- c( | 
| 
860907bf0e0f
planemo upload for repository https://github.com/your_org_or_user/tools-metabolomics commit 3dd90b60510fa72eb8351464ec5d5883b0b6222a
 workflow4metabolomics parents: diff
changeset | 296 "0%-20%", | 
| 
860907bf0e0f
planemo upload for repository https://github.com/your_org_or_user/tools-metabolomics commit 3dd90b60510fa72eb8351464ec5d5883b0b6222a
 workflow4metabolomics parents: diff
changeset | 297 "20%-40%", | 
| 
860907bf0e0f
planemo upload for repository https://github.com/your_org_or_user/tools-metabolomics commit 3dd90b60510fa72eb8351464ec5d5883b0b6222a
 workflow4metabolomics parents: diff
changeset | 298 "40%-60%", | 
| 
860907bf0e0f
planemo upload for repository https://github.com/your_org_or_user/tools-metabolomics commit 3dd90b60510fa72eb8351464ec5d5883b0b6222a
 workflow4metabolomics parents: diff
changeset | 299 "60%-80%", | 
| 
860907bf0e0f
planemo upload for repository https://github.com/your_org_or_user/tools-metabolomics commit 3dd90b60510fa72eb8351464ec5d5883b0b6222a
 workflow4metabolomics parents: diff
changeset | 300 "80%-100%" | 
| 
860907bf0e0f
planemo upload for repository https://github.com/your_org_or_user/tools-metabolomics commit 3dd90b60510fa72eb8351464ec5d5883b0b6222a
 workflow4metabolomics parents: diff
changeset | 301 ) | 
| 
860907bf0e0f
planemo upload for repository https://github.com/your_org_or_user/tools-metabolomics commit 3dd90b60510fa72eb8351464ec5d5883b0b6222a
 workflow4metabolomics parents: diff
changeset | 302 if (j == nb_class) { | 
| 
860907bf0e0f
planemo upload for repository https://github.com/your_org_or_user/tools-metabolomics commit 3dd90b60510fa72eb8351464ec5d5883b0b6222a
 workflow4metabolomics parents: diff
changeset | 303 if (sum(NA.res) == 0) cat("Data Matrix contains no NA.\n") | 
| 
860907bf0e0f
planemo upload for repository https://github.com/your_org_or_user/tools-metabolomics commit 3dd90b60510fa72eb8351464ec5d5883b0b6222a
 workflow4metabolomics parents: diff
changeset | 304 colnames(data_bp) <- classnames | 
| 
860907bf0e0f
planemo upload for repository https://github.com/your_org_or_user/tools-metabolomics commit 3dd90b60510fa72eb8351464ec5d5883b0b6222a
 workflow4metabolomics parents: diff
changeset | 305 data_bp <- as.matrix(data_bp) | 
| 
860907bf0e0f
planemo upload for repository https://github.com/your_org_or_user/tools-metabolomics commit 3dd90b60510fa72eb8351464ec5d5883b0b6222a
 workflow4metabolomics parents: diff
changeset | 306 } | 
| 
860907bf0e0f
planemo upload for repository https://github.com/your_org_or_user/tools-metabolomics commit 3dd90b60510fa72eb8351464ec5d5883b0b6222a
 workflow4metabolomics parents: diff
changeset | 307 } | 
| 
860907bf0e0f
planemo upload for repository https://github.com/your_org_or_user/tools-metabolomics commit 3dd90b60510fa72eb8351464ec5d5883b0b6222a
 workflow4metabolomics parents: diff
changeset | 308 # Mean fold change | 
| 
860907bf0e0f
planemo upload for repository https://github.com/your_org_or_user/tools-metabolomics commit 3dd90b60510fa72eb8351464ec5d5883b0b6222a
 workflow4metabolomics parents: diff
changeset | 309 if (test.fold == "Yes" && nb_class >= 2 && j != nb_class) { | 
| 
860907bf0e0f
planemo upload for repository https://github.com/your_org_or_user/tools-metabolomics commit 3dd90b60510fa72eb8351464ec5d5883b0b6222a
 workflow4metabolomics parents: diff
changeset | 310 if (method == "each_class") fold.frac <- "Top" | 
| 
860907bf0e0f
planemo upload for repository https://github.com/your_org_or_user/tools-metabolomics commit 3dd90b60510fa72eb8351464ec5d5883b0b6222a
 workflow4metabolomics parents: diff
changeset | 311 for (k in (j + 1):nb_class) { | 
| 
860907bf0e0f
planemo upload for repository https://github.com/your_org_or_user/tools-metabolomics commit 3dd90b60510fa72eb8351464ec5d5883b0b6222a
 workflow4metabolomics parents: diff
changeset | 312 ratio1 <- if (fold.frac == "Bottom") classnames[k] else classnames[j] | 
| 
860907bf0e0f
planemo upload for repository https://github.com/your_org_or_user/tools-metabolomics commit 3dd90b60510fa72eb8351464ec5d5883b0b6222a
 workflow4metabolomics parents: diff
changeset | 313 ratio2 <- if (fold.frac == "Bottom") classnames[j] else classnames[k] | 
| 
860907bf0e0f
planemo upload for repository https://github.com/your_org_or_user/tools-metabolomics commit 3dd90b60510fa72eb8351464ec5d5883b0b6222a
 workflow4metabolomics parents: diff
changeset | 314 fold <- colMeans(DM[which(DM$c_class == ratio1), -1], na.rm = TRUE) / | 
| 
860907bf0e0f
planemo upload for repository https://github.com/your_org_or_user/tools-metabolomics commit 3dd90b60510fa72eb8351464ec5d5883b0b6222a
 workflow4metabolomics parents: diff
changeset | 315 colMeans(DM[which(DM$c_class == ratio2), -1], na.rm = TRUE) | 
| 
860907bf0e0f
planemo upload for repository https://github.com/your_org_or_user/tools-metabolomics commit 3dd90b60510fa72eb8351464ec5d5883b0b6222a
 workflow4metabolomics parents: diff
changeset | 316 if (logarithm == "log2") { | 
| 
860907bf0e0f
planemo upload for repository https://github.com/your_org_or_user/tools-metabolomics commit 3dd90b60510fa72eb8351464ec5d5883b0b6222a
 workflow4metabolomics parents: diff
changeset | 317 fold <- log2(fold) | 
| 
860907bf0e0f
planemo upload for repository https://github.com/your_org_or_user/tools-metabolomics commit 3dd90b60510fa72eb8351464ec5d5883b0b6222a
 workflow4metabolomics parents: diff
changeset | 318 } else if ( | 
| 
860907bf0e0f
planemo upload for repository https://github.com/your_org_or_user/tools-metabolomics commit 3dd90b60510fa72eb8351464ec5d5883b0b6222a
 workflow4metabolomics parents: diff
changeset | 319 logarithm == "log10" | 
| 
860907bf0e0f
planemo upload for repository https://github.com/your_org_or_user/tools-metabolomics commit 3dd90b60510fa72eb8351464ec5d5883b0b6222a
 workflow4metabolomics parents: diff
changeset | 320 ) { | 
| 
860907bf0e0f
planemo upload for repository https://github.com/your_org_or_user/tools-metabolomics commit 3dd90b60510fa72eb8351464ec5d5883b0b6222a
 workflow4metabolomics parents: diff
changeset | 321 fold <- log10(fold) | 
| 
860907bf0e0f
planemo upload for repository https://github.com/your_org_or_user/tools-metabolomics commit 3dd90b60510fa72eb8351464ec5d5883b0b6222a
 workflow4metabolomics parents: diff
changeset | 322 } | 
| 
860907bf0e0f
planemo upload for repository https://github.com/your_org_or_user/tools-metabolomics commit 3dd90b60510fa72eb8351464ec5d5883b0b6222a
 workflow4metabolomics parents: diff
changeset | 323 fold.res <- cbind(fold.res, fold) | 
| 
860907bf0e0f
planemo upload for repository https://github.com/your_org_or_user/tools-metabolomics commit 3dd90b60510fa72eb8351464ec5d5883b0b6222a
 workflow4metabolomics parents: diff
changeset | 324 fname <- if (logarithm == "none") { | 
| 
860907bf0e0f
planemo upload for repository https://github.com/your_org_or_user/tools-metabolomics commit 3dd90b60510fa72eb8351464ec5d5883b0b6222a
 workflow4metabolomics parents: diff
changeset | 325 paste("fold", ratio1, "VS", ratio2, sep = "_") | 
| 
860907bf0e0f
planemo upload for repository https://github.com/your_org_or_user/tools-metabolomics commit 3dd90b60510fa72eb8351464ec5d5883b0b6222a
 workflow4metabolomics parents: diff
changeset | 326 } else { | 
| 
860907bf0e0f
planemo upload for repository https://github.com/your_org_or_user/tools-metabolomics commit 3dd90b60510fa72eb8351464ec5d5883b0b6222a
 workflow4metabolomics parents: diff
changeset | 327 paste(logarithm, "fold", ratio1, "VS", ratio2, sep = "_") | 
| 
860907bf0e0f
planemo upload for repository https://github.com/your_org_or_user/tools-metabolomics commit 3dd90b60510fa72eb8351464ec5d5883b0b6222a
 workflow4metabolomics parents: diff
changeset | 328 } | 
| 
860907bf0e0f
planemo upload for repository https://github.com/your_org_or_user/tools-metabolomics commit 3dd90b60510fa72eb8351464ec5d5883b0b6222a
 workflow4metabolomics parents: diff
changeset | 329 fold.names <- cbind(fold.names, fname) | 
| 
860907bf0e0f
planemo upload for repository https://github.com/your_org_or_user/tools-metabolomics commit 3dd90b60510fa72eb8351464ec5d5883b0b6222a
 workflow4metabolomics parents: diff
changeset | 330 } | 
| 
860907bf0e0f
planemo upload for repository https://github.com/your_org_or_user/tools-metabolomics commit 3dd90b60510fa72eb8351464ec5d5883b0b6222a
 workflow4metabolomics parents: diff
changeset | 331 if (j == nb_class) { | 
| 
860907bf0e0f
planemo upload for repository https://github.com/your_org_or_user/tools-metabolomics commit 3dd90b60510fa72eb8351464ec5d5883b0b6222a
 workflow4metabolomics parents: diff
changeset | 332 stat.res <- cbind(stat.res, fold.res) | 
| 
860907bf0e0f
planemo upload for repository https://github.com/your_org_or_user/tools-metabolomics commit 3dd90b60510fa72eb8351464ec5d5883b0b6222a
 workflow4metabolomics parents: diff
changeset | 333 names <- cbind(names, fold.names) | 
| 
860907bf0e0f
planemo upload for repository https://github.com/your_org_or_user/tools-metabolomics commit 3dd90b60510fa72eb8351464ec5d5883b0b6222a
 workflow4metabolomics parents: diff
changeset | 334 } | 
| 
860907bf0e0f
planemo upload for repository https://github.com/your_org_or_user/tools-metabolomics commit 3dd90b60510fa72eb8351464ec5d5883b0b6222a
 workflow4metabolomics parents: diff
changeset | 335 } | 
| 
860907bf0e0f
planemo upload for repository https://github.com/your_org_or_user/tools-metabolomics commit 3dd90b60510fa72eb8351464ec5d5883b0b6222a
 workflow4metabolomics parents: diff
changeset | 336 } | 
| 
860907bf0e0f
planemo upload for repository https://github.com/your_org_or_user/tools-metabolomics commit 3dd90b60510fa72eb8351464ec5d5883b0b6222a
 workflow4metabolomics parents: diff
changeset | 337 | 
| 
860907bf0e0f
planemo upload for repository https://github.com/your_org_or_user/tools-metabolomics commit 3dd90b60510fa72eb8351464ec5d5883b0b6222a
 workflow4metabolomics parents: diff
changeset | 338 # Ensure unique column names | 
| 
860907bf0e0f
planemo upload for repository https://github.com/your_org_or_user/tools-metabolomics commit 3dd90b60510fa72eb8351464ec5d5883b0b6222a
 workflow4metabolomics parents: diff
changeset | 339 VM.names <- colnames(VM) | 
| 
860907bf0e0f
planemo upload for repository https://github.com/your_org_or_user/tools-metabolomics commit 3dd90b60510fa72eb8351464ec5d5883b0b6222a
 workflow4metabolomics parents: diff
changeset | 340 for (i in seq_along(VM.names)) { | 
| 
860907bf0e0f
planemo upload for repository https://github.com/your_org_or_user/tools-metabolomics commit 3dd90b60510fa72eb8351464ec5d5883b0b6222a
 workflow4metabolomics parents: diff
changeset | 341 for (j in seq_along(names)) { | 
| 
860907bf0e0f
planemo upload for repository https://github.com/your_org_or_user/tools-metabolomics commit 3dd90b60510fa72eb8351464ec5d5883b0b6222a
 workflow4metabolomics parents: diff
changeset | 342 if (VM.names[i] == names[j]) names[j] <- paste(names[j], "2", sep = "_") | 
| 
860907bf0e0f
planemo upload for repository https://github.com/your_org_or_user/tools-metabolomics commit 3dd90b60510fa72eb8351464ec5d5883b0b6222a
 workflow4metabolomics parents: diff
changeset | 343 } | 
| 
860907bf0e0f
planemo upload for repository https://github.com/your_org_or_user/tools-metabolomics commit 3dd90b60510fa72eb8351464ec5d5883b0b6222a
 workflow4metabolomics parents: diff
changeset | 344 } | 
| 
860907bf0e0f
planemo upload for repository https://github.com/your_org_or_user/tools-metabolomics commit 3dd90b60510fa72eb8351464ec5d5883b0b6222a
 workflow4metabolomics parents: diff
changeset | 345 colnames(stat.res) <- names | 
| 
860907bf0e0f
planemo upload for repository https://github.com/your_org_or_user/tools-metabolomics commit 3dd90b60510fa72eb8351464ec5d5883b0b6222a
 workflow4metabolomics parents: diff
changeset | 346 | 
| 
860907bf0e0f
planemo upload for repository https://github.com/your_org_or_user/tools-metabolomics commit 3dd90b60510fa72eb8351464ec5d5883b0b6222a
 workflow4metabolomics parents: diff
changeset | 347 # Output | 
| 
860907bf0e0f
planemo upload for repository https://github.com/your_org_or_user/tools-metabolomics commit 3dd90b60510fa72eb8351464ec5d5883b0b6222a
 workflow4metabolomics parents: diff
changeset | 348 VM <- cbind(VM, stat.res) | 
| 
860907bf0e0f
planemo upload for repository https://github.com/your_org_or_user/tools-metabolomics commit 3dd90b60510fa72eb8351464ec5d5883b0b6222a
 workflow4metabolomics parents: diff
changeset | 349 write.table(VM, VM.output, sep = "\t", quote = FALSE, row.names = FALSE) | 
| 
860907bf0e0f
planemo upload for repository https://github.com/your_org_or_user/tools-metabolomics commit 3dd90b60510fa72eb8351464ec5d5883b0b6222a
 workflow4metabolomics parents: diff
changeset | 350 | 
| 
860907bf0e0f
planemo upload for repository https://github.com/your_org_or_user/tools-metabolomics commit 3dd90b60510fa72eb8351464ec5d5883b0b6222a
 workflow4metabolomics parents: diff
changeset | 351 # Graphics | 
| 
860907bf0e0f
planemo upload for repository https://github.com/your_org_or_user/tools-metabolomics commit 3dd90b60510fa72eb8351464ec5d5883b0b6222a
 workflow4metabolomics parents: diff
changeset | 352 pdf(graphs.output) | 
| 
860907bf0e0f
planemo upload for repository https://github.com/your_org_or_user/tools-metabolomics commit 3dd90b60510fa72eb8351464ec5d5883b0b6222a
 workflow4metabolomics parents: diff
changeset | 353 if (graphs == 1) { | 
| 
860907bf0e0f
planemo upload for repository https://github.com/your_org_or_user/tools-metabolomics commit 3dd90b60510fa72eb8351464ec5d5883b0b6222a
 workflow4metabolomics parents: diff
changeset | 354 if ("NA" %in% stat.list) { | 
| 
860907bf0e0f
planemo upload for repository https://github.com/your_org_or_user/tools-metabolomics commit 3dd90b60510fa72eb8351464ec5d5883b0b6222a
 workflow4metabolomics parents: diff
changeset | 355 graph.colors <- c("green3", "palegreen3", "lightblue", "orangered", "red") | 
| 
860907bf0e0f
planemo upload for repository https://github.com/your_org_or_user/tools-metabolomics commit 3dd90b60510fa72eb8351464ec5d5883b0b6222a
 workflow4metabolomics parents: diff
changeset | 356 par(mar = c(5.1, 4.1, 4.1, 8.1), xpd = TRUE) | 
| 
860907bf0e0f
planemo upload for repository https://github.com/your_org_or_user/tools-metabolomics commit 3dd90b60510fa72eb8351464ec5d5883b0b6222a
 workflow4metabolomics parents: diff
changeset | 357 bp <- barplot( | 
| 
860907bf0e0f
planemo upload for repository https://github.com/your_org_or_user/tools-metabolomics commit 3dd90b60510fa72eb8351464ec5d5883b0b6222a
 workflow4metabolomics parents: diff
changeset | 358 data_bp, | 
| 
860907bf0e0f
planemo upload for repository https://github.com/your_org_or_user/tools-metabolomics commit 3dd90b60510fa72eb8351464ec5d5883b0b6222a
 workflow4metabolomics parents: diff
changeset | 359 col = graph.colors, | 
| 
860907bf0e0f
planemo upload for repository https://github.com/your_org_or_user/tools-metabolomics commit 3dd90b60510fa72eb8351464ec5d5883b0b6222a
 workflow4metabolomics parents: diff
changeset | 360 main = "Proportion of NA", | 
| 
860907bf0e0f
planemo upload for repository https://github.com/your_org_or_user/tools-metabolomics commit 3dd90b60510fa72eb8351464ec5d5883b0b6222a
 workflow4metabolomics parents: diff
changeset | 361 xlab = "Classes", | 
| 
860907bf0e0f
planemo upload for repository https://github.com/your_org_or_user/tools-metabolomics commit 3dd90b60510fa72eb8351464ec5d5883b0b6222a
 workflow4metabolomics parents: diff
changeset | 362 ylab = "Variables" | 
| 
860907bf0e0f
planemo upload for repository https://github.com/your_org_or_user/tools-metabolomics commit 3dd90b60510fa72eb8351464ec5d5883b0b6222a
 workflow4metabolomics parents: diff
changeset | 363 ) | 
| 
860907bf0e0f
planemo upload for repository https://github.com/your_org_or_user/tools-metabolomics commit 3dd90b60510fa72eb8351464ec5d5883b0b6222a
 workflow4metabolomics parents: diff
changeset | 364 legend( | 
| 
860907bf0e0f
planemo upload for repository https://github.com/your_org_or_user/tools-metabolomics commit 3dd90b60510fa72eb8351464ec5d5883b0b6222a
 workflow4metabolomics parents: diff
changeset | 365 "topright", | 
| 
860907bf0e0f
planemo upload for repository https://github.com/your_org_or_user/tools-metabolomics commit 3dd90b60510fa72eb8351464ec5d5883b0b6222a
 workflow4metabolomics parents: diff
changeset | 366 fill = graph.colors, | 
| 
860907bf0e0f
planemo upload for repository https://github.com/your_org_or_user/tools-metabolomics commit 3dd90b60510fa72eb8351464ec5d5883b0b6222a
 workflow4metabolomics parents: diff
changeset | 367 rownames(data_bp), | 
| 
860907bf0e0f
planemo upload for repository https://github.com/your_org_or_user/tools-metabolomics commit 3dd90b60510fa72eb8351464ec5d5883b0b6222a
 workflow4metabolomics parents: diff
changeset | 368 inset = c(-0.3, 0) | 
| 
860907bf0e0f
planemo upload for repository https://github.com/your_org_or_user/tools-metabolomics commit 3dd90b60510fa72eb8351464ec5d5883b0b6222a
 workflow4metabolomics parents: diff
changeset | 369 ) | 
| 
860907bf0e0f
planemo upload for repository https://github.com/your_org_or_user/tools-metabolomics commit 3dd90b60510fa72eb8351464ec5d5883b0b6222a
 workflow4metabolomics parents: diff
changeset | 370 stock <- 0 | 
| 
860907bf0e0f
planemo upload for repository https://github.com/your_org_or_user/tools-metabolomics commit 3dd90b60510fa72eb8351464ec5d5883b0b6222a
 workflow4metabolomics parents: diff
changeset | 371 for (i in 1:nrow(data_bp)) { | 
| 
860907bf0e0f
planemo upload for repository https://github.com/your_org_or_user/tools-metabolomics commit 3dd90b60510fa72eb8351464ec5d5883b0b6222a
 workflow4metabolomics parents: diff
changeset | 372 text( | 
| 
860907bf0e0f
planemo upload for repository https://github.com/your_org_or_user/tools-metabolomics commit 3dd90b60510fa72eb8351464ec5d5883b0b6222a
 workflow4metabolomics parents: diff
changeset | 373 bp, | 
| 
860907bf0e0f
planemo upload for repository https://github.com/your_org_or_user/tools-metabolomics commit 3dd90b60510fa72eb8351464ec5d5883b0b6222a
 workflow4metabolomics parents: diff
changeset | 374 stock + data_bp[i, ] / 2, | 
| 
860907bf0e0f
planemo upload for repository https://github.com/your_org_or_user/tools-metabolomics commit 3dd90b60510fa72eb8351464ec5d5883b0b6222a
 workflow4metabolomics parents: diff
changeset | 375 data_bp[i, ], | 
| 
860907bf0e0f
planemo upload for repository https://github.com/your_org_or_user/tools-metabolomics commit 3dd90b60510fa72eb8351464ec5d5883b0b6222a
 workflow4metabolomics parents: diff
changeset | 376 col = "white", | 
| 
860907bf0e0f
planemo upload for repository https://github.com/your_org_or_user/tools-metabolomics commit 3dd90b60510fa72eb8351464ec5d5883b0b6222a
 workflow4metabolomics parents: diff
changeset | 377 cex = 0.7 | 
| 
860907bf0e0f
planemo upload for repository https://github.com/your_org_or_user/tools-metabolomics commit 3dd90b60510fa72eb8351464ec5d5883b0b6222a
 workflow4metabolomics parents: diff
changeset | 378 ) | 
| 
860907bf0e0f
planemo upload for repository https://github.com/your_org_or_user/tools-metabolomics commit 3dd90b60510fa72eb8351464ec5d5883b0b6222a
 workflow4metabolomics parents: diff
changeset | 379 stock <- stock + data_bp[i, ] | 
| 
860907bf0e0f
planemo upload for repository https://github.com/your_org_or_user/tools-metabolomics commit 3dd90b60510fa72eb8351464ec5d5883b0b6222a
 workflow4metabolomics parents: diff
changeset | 380 } | 
| 
860907bf0e0f
planemo upload for repository https://github.com/your_org_or_user/tools-metabolomics commit 3dd90b60510fa72eb8351464ec5d5883b0b6222a
 workflow4metabolomics parents: diff
changeset | 381 } | 
| 
860907bf0e0f
planemo upload for repository https://github.com/your_org_or_user/tools-metabolomics commit 3dd90b60510fa72eb8351464ec5d5883b0b6222a
 workflow4metabolomics parents: diff
changeset | 382 if ((test.fold == "Yes") && (nb_class >= 2)) { | 
| 
860907bf0e0f
planemo upload for repository https://github.com/your_org_or_user/tools-metabolomics commit 3dd90b60510fa72eb8351464ec5d5883b0b6222a
 workflow4metabolomics parents: diff
changeset | 383 clean_fold <- fold.res | 
| 
860907bf0e0f
planemo upload for repository https://github.com/your_org_or_user/tools-metabolomics commit 3dd90b60510fa72eb8351464ec5d5883b0b6222a
 workflow4metabolomics parents: diff
changeset | 384 clean_fold[is.infinite(clean_fold)] <- NA | 
| 
860907bf0e0f
planemo upload for repository https://github.com/your_org_or_user/tools-metabolomics commit 3dd90b60510fa72eb8351464ec5d5883b0b6222a
 workflow4metabolomics parents: diff
changeset | 385 for (j in 1:ncol(clean_fold)) { | 
| 
860907bf0e0f
planemo upload for repository https://github.com/your_org_or_user/tools-metabolomics commit 3dd90b60510fa72eb8351464ec5d5883b0b6222a
 workflow4metabolomics parents: diff
changeset | 386 boxplot(clean_fold[, j], main = fold.names[j]) | 
| 
860907bf0e0f
planemo upload for repository https://github.com/your_org_or_user/tools-metabolomics commit 3dd90b60510fa72eb8351464ec5d5883b0b6222a
 workflow4metabolomics parents: diff
changeset | 387 } | 
| 
860907bf0e0f
planemo upload for repository https://github.com/your_org_or_user/tools-metabolomics commit 3dd90b60510fa72eb8351464ec5d5883b0b6222a
 workflow4metabolomics parents: diff
changeset | 388 } | 
| 
860907bf0e0f
planemo upload for repository https://github.com/your_org_or_user/tools-metabolomics commit 3dd90b60510fa72eb8351464ec5d5883b0b6222a
 workflow4metabolomics parents: diff
changeset | 389 } else { | 
| 
860907bf0e0f
planemo upload for repository https://github.com/your_org_or_user/tools-metabolomics commit 3dd90b60510fa72eb8351464ec5d5883b0b6222a
 workflow4metabolomics parents: diff
changeset | 390 plot.new() | 
| 
860907bf0e0f
planemo upload for repository https://github.com/your_org_or_user/tools-metabolomics commit 3dd90b60510fa72eb8351464ec5d5883b0b6222a
 workflow4metabolomics parents: diff
changeset | 391 legend("center", "You did not select any option with graphical output.") | 
| 
860907bf0e0f
planemo upload for repository https://github.com/your_org_or_user/tools-metabolomics commit 3dd90b60510fa72eb8351464ec5d5883b0b6222a
 workflow4metabolomics parents: diff
changeset | 392 } | 
| 
860907bf0e0f
planemo upload for repository https://github.com/your_org_or_user/tools-metabolomics commit 3dd90b60510fa72eb8351464ec5d5883b0b6222a
 workflow4metabolomics parents: diff
changeset | 393 dev.off() | 
| 
860907bf0e0f
planemo upload for repository https://github.com/your_org_or_user/tools-metabolomics commit 3dd90b60510fa72eb8351464ec5d5883b0b6222a
 workflow4metabolomics parents: diff
changeset | 394 } | 
| 
860907bf0e0f
planemo upload for repository https://github.com/your_org_or_user/tools-metabolomics commit 3dd90b60510fa72eb8351464ec5d5883b0b6222a
 workflow4metabolomics parents: diff
changeset | 395 | 
| 
860907bf0e0f
planemo upload for repository https://github.com/your_org_or_user/tools-metabolomics commit 3dd90b60510fa72eb8351464ec5d5883b0b6222a
 workflow4metabolomics parents: diff
changeset | 396 | 
| 
860907bf0e0f
planemo upload for repository https://github.com/your_org_or_user/tools-metabolomics commit 3dd90b60510fa72eb8351464ec5d5883b0b6222a
 workflow4metabolomics parents: diff
changeset | 397 parser <- ArgumentParser(description = "Intensity Check Tool") | 
| 
860907bf0e0f
planemo upload for repository https://github.com/your_org_or_user/tools-metabolomics commit 3dd90b60510fa72eb8351464ec5d5883b0b6222a
 workflow4metabolomics parents: diff
changeset | 398 | 
| 
860907bf0e0f
planemo upload for repository https://github.com/your_org_or_user/tools-metabolomics commit 3dd90b60510fa72eb8351464ec5d5883b0b6222a
 workflow4metabolomics parents: diff
changeset | 399 parser$add_argument( | 
| 
860907bf0e0f
planemo upload for repository https://github.com/your_org_or_user/tools-metabolomics commit 3dd90b60510fa72eb8351464ec5d5883b0b6222a
 workflow4metabolomics parents: diff
changeset | 400 "--dataMatrix_in", | 
| 
860907bf0e0f
planemo upload for repository https://github.com/your_org_or_user/tools-metabolomics commit 3dd90b60510fa72eb8351464ec5d5883b0b6222a
 workflow4metabolomics parents: diff
changeset | 401 required = TRUE, | 
| 
860907bf0e0f
planemo upload for repository https://github.com/your_org_or_user/tools-metabolomics commit 3dd90b60510fa72eb8351464ec5d5883b0b6222a
 workflow4metabolomics parents: diff
changeset | 402 help = "Input data matrix file" | 
| 
860907bf0e0f
planemo upload for repository https://github.com/your_org_or_user/tools-metabolomics commit 3dd90b60510fa72eb8351464ec5d5883b0b6222a
 workflow4metabolomics parents: diff
changeset | 403 ) | 
| 
860907bf0e0f
planemo upload for repository https://github.com/your_org_or_user/tools-metabolomics commit 3dd90b60510fa72eb8351464ec5d5883b0b6222a
 workflow4metabolomics parents: diff
changeset | 404 parser$add_argument( | 
| 
860907bf0e0f
planemo upload for repository https://github.com/your_org_or_user/tools-metabolomics commit 3dd90b60510fa72eb8351464ec5d5883b0b6222a
 workflow4metabolomics parents: diff
changeset | 405 "--sampleMetadata_in", | 
| 
860907bf0e0f
planemo upload for repository https://github.com/your_org_or_user/tools-metabolomics commit 3dd90b60510fa72eb8351464ec5d5883b0b6222a
 workflow4metabolomics parents: diff
changeset | 406 required = TRUE, | 
| 
860907bf0e0f
planemo upload for repository https://github.com/your_org_or_user/tools-metabolomics commit 3dd90b60510fa72eb8351464ec5d5883b0b6222a
 workflow4metabolomics parents: diff
changeset | 407 help = "Input sample metadata file" | 
| 
860907bf0e0f
planemo upload for repository https://github.com/your_org_or_user/tools-metabolomics commit 3dd90b60510fa72eb8351464ec5d5883b0b6222a
 workflow4metabolomics parents: diff
changeset | 408 ) | 
| 
860907bf0e0f
planemo upload for repository https://github.com/your_org_or_user/tools-metabolomics commit 3dd90b60510fa72eb8351464ec5d5883b0b6222a
 workflow4metabolomics parents: diff
changeset | 409 parser$add_argument( | 
| 
860907bf0e0f
planemo upload for repository https://github.com/your_org_or_user/tools-metabolomics commit 3dd90b60510fa72eb8351464ec5d5883b0b6222a
 workflow4metabolomics parents: diff
changeset | 410 "--variableMetadata_in", | 
| 
860907bf0e0f
planemo upload for repository https://github.com/your_org_or_user/tools-metabolomics commit 3dd90b60510fa72eb8351464ec5d5883b0b6222a
 workflow4metabolomics parents: diff
changeset | 411 required = TRUE, | 
| 
860907bf0e0f
planemo upload for repository https://github.com/your_org_or_user/tools-metabolomics commit 3dd90b60510fa72eb8351464ec5d5883b0b6222a
 workflow4metabolomics parents: diff
changeset | 412 help = "Input variable metadata file" | 
| 
860907bf0e0f
planemo upload for repository https://github.com/your_org_or_user/tools-metabolomics commit 3dd90b60510fa72eb8351464ec5d5883b0b6222a
 workflow4metabolomics parents: diff
changeset | 413 ) | 
| 
860907bf0e0f
planemo upload for repository https://github.com/your_org_or_user/tools-metabolomics commit 3dd90b60510fa72eb8351464ec5d5883b0b6222a
 workflow4metabolomics parents: diff
changeset | 414 parser$add_argument("--method", required = TRUE, help = "Computation method") | 
| 
860907bf0e0f
planemo upload for repository https://github.com/your_org_or_user/tools-metabolomics commit 3dd90b60510fa72eb8351464ec5d5883b0b6222a
 workflow4metabolomics parents: diff
changeset | 415 parser$add_argument( | 
| 
860907bf0e0f
planemo upload for repository https://github.com/your_org_or_user/tools-metabolomics commit 3dd90b60510fa72eb8351464ec5d5883b0b6222a
 workflow4metabolomics parents: diff
changeset | 416 "--chosen_stat", | 
| 
860907bf0e0f
planemo upload for repository https://github.com/your_org_or_user/tools-metabolomics commit 3dd90b60510fa72eb8351464ec5d5883b0b6222a
 workflow4metabolomics parents: diff
changeset | 417 required = TRUE, | 
| 
860907bf0e0f
planemo upload for repository https://github.com/your_org_or_user/tools-metabolomics commit 3dd90b60510fa72eb8351464ec5d5883b0b6222a
 workflow4metabolomics parents: diff
changeset | 418 help = "Statistics to compute" | 
| 
860907bf0e0f
planemo upload for repository https://github.com/your_org_or_user/tools-metabolomics commit 3dd90b60510fa72eb8351464ec5d5883b0b6222a
 workflow4metabolomics parents: diff
changeset | 419 ) | 
| 
860907bf0e0f
planemo upload for repository https://github.com/your_org_or_user/tools-metabolomics commit 3dd90b60510fa72eb8351464ec5d5883b0b6222a
 workflow4metabolomics parents: diff
changeset | 420 parser$add_argument( | 
| 
860907bf0e0f
planemo upload for repository https://github.com/your_org_or_user/tools-metabolomics commit 3dd90b60510fa72eb8351464ec5d5883b0b6222a
 workflow4metabolomics parents: diff
changeset | 421 "--class_col", | 
| 
860907bf0e0f
planemo upload for repository https://github.com/your_org_or_user/tools-metabolomics commit 3dd90b60510fa72eb8351464ec5d5883b0b6222a
 workflow4metabolomics parents: diff
changeset | 422 default = NULL, | 
| 
860907bf0e0f
planemo upload for repository https://github.com/your_org_or_user/tools-metabolomics commit 3dd90b60510fa72eb8351464ec5d5883b0b6222a
 workflow4metabolomics parents: diff
changeset | 423 help = "Class column (optional)" | 
| 
860907bf0e0f
planemo upload for repository https://github.com/your_org_or_user/tools-metabolomics commit 3dd90b60510fa72eb8351464ec5d5883b0b6222a
 workflow4metabolomics parents: diff
changeset | 424 ) | 
| 
860907bf0e0f
planemo upload for repository https://github.com/your_org_or_user/tools-metabolomics commit 3dd90b60510fa72eb8351464ec5d5883b0b6222a
 workflow4metabolomics parents: diff
changeset | 425 parser$add_argument( | 
| 
860907bf0e0f
planemo upload for repository https://github.com/your_org_or_user/tools-metabolomics commit 3dd90b60510fa72eb8351464ec5d5883b0b6222a
 workflow4metabolomics parents: diff
changeset | 426 "--test_fold", | 
| 
860907bf0e0f
planemo upload for repository https://github.com/your_org_or_user/tools-metabolomics commit 3dd90b60510fa72eb8351464ec5d5883b0b6222a
 workflow4metabolomics parents: diff
changeset | 427 default = NULL, | 
| 
860907bf0e0f
planemo upload for repository https://github.com/your_org_or_user/tools-metabolomics commit 3dd90b60510fa72eb8351464ec5d5883b0b6222a
 workflow4metabolomics parents: diff
changeset | 428 help = "Test fold (optional)" | 
| 
860907bf0e0f
planemo upload for repository https://github.com/your_org_or_user/tools-metabolomics commit 3dd90b60510fa72eb8351464ec5d5883b0b6222a
 workflow4metabolomics parents: diff
changeset | 429 ) | 
| 
860907bf0e0f
planemo upload for repository https://github.com/your_org_or_user/tools-metabolomics commit 3dd90b60510fa72eb8351464ec5d5883b0b6222a
 workflow4metabolomics parents: diff
changeset | 430 parser$add_argument("--class1", default = NULL, help = "Class1 (optional)") | 
| 
860907bf0e0f
planemo upload for repository https://github.com/your_org_or_user/tools-metabolomics commit 3dd90b60510fa72eb8351464ec5d5883b0b6222a
 workflow4metabolomics parents: diff
changeset | 431 parser$add_argument( | 
| 
860907bf0e0f
planemo upload for repository https://github.com/your_org_or_user/tools-metabolomics commit 3dd90b60510fa72eb8351464ec5d5883b0b6222a
 workflow4metabolomics parents: diff
changeset | 432 "--fold_frac", | 
| 
860907bf0e0f
planemo upload for repository https://github.com/your_org_or_user/tools-metabolomics commit 3dd90b60510fa72eb8351464ec5d5883b0b6222a
 workflow4metabolomics parents: diff
changeset | 433 default = NULL, | 
| 
860907bf0e0f
planemo upload for repository https://github.com/your_org_or_user/tools-metabolomics commit 3dd90b60510fa72eb8351464ec5d5883b0b6222a
 workflow4metabolomics parents: diff
changeset | 434 help = "Fold fraction (optional)" | 
| 
860907bf0e0f
planemo upload for repository https://github.com/your_org_or_user/tools-metabolomics commit 3dd90b60510fa72eb8351464ec5d5883b0b6222a
 workflow4metabolomics parents: diff
changeset | 435 ) | 
| 
860907bf0e0f
planemo upload for repository https://github.com/your_org_or_user/tools-metabolomics commit 3dd90b60510fa72eb8351464ec5d5883b0b6222a
 workflow4metabolomics parents: diff
changeset | 436 parser$add_argument( | 
| 
860907bf0e0f
planemo upload for repository https://github.com/your_org_or_user/tools-metabolomics commit 3dd90b60510fa72eb8351464ec5d5883b0b6222a
 workflow4metabolomics parents: diff
changeset | 437 "--logarithm", | 
| 
860907bf0e0f
planemo upload for repository https://github.com/your_org_or_user/tools-metabolomics commit 3dd90b60510fa72eb8351464ec5d5883b0b6222a
 workflow4metabolomics parents: diff
changeset | 438 default = NULL, | 
| 
860907bf0e0f
planemo upload for repository https://github.com/your_org_or_user/tools-metabolomics commit 3dd90b60510fa72eb8351464ec5d5883b0b6222a
 workflow4metabolomics parents: diff
changeset | 439 help = "Logarithm (optional)" | 
| 
860907bf0e0f
planemo upload for repository https://github.com/your_org_or_user/tools-metabolomics commit 3dd90b60510fa72eb8351464ec5d5883b0b6222a
 workflow4metabolomics parents: diff
changeset | 440 ) | 
| 
860907bf0e0f
planemo upload for repository https://github.com/your_org_or_user/tools-metabolomics commit 3dd90b60510fa72eb8351464ec5d5883b0b6222a
 workflow4metabolomics parents: diff
changeset | 441 parser$add_argument( | 
| 
860907bf0e0f
planemo upload for repository https://github.com/your_org_or_user/tools-metabolomics commit 3dd90b60510fa72eb8351464ec5d5883b0b6222a
 workflow4metabolomics parents: diff
changeset | 442 "--variableMetadata_out", | 
| 
860907bf0e0f
planemo upload for repository https://github.com/your_org_or_user/tools-metabolomics commit 3dd90b60510fa72eb8351464ec5d5883b0b6222a
 workflow4metabolomics parents: diff
changeset | 443 required = TRUE, | 
| 
860907bf0e0f
planemo upload for repository https://github.com/your_org_or_user/tools-metabolomics commit 3dd90b60510fa72eb8351464ec5d5883b0b6222a
 workflow4metabolomics parents: diff
changeset | 444 help = "Output variable metadata file" | 
| 
860907bf0e0f
planemo upload for repository https://github.com/your_org_or_user/tools-metabolomics commit 3dd90b60510fa72eb8351464ec5d5883b0b6222a
 workflow4metabolomics parents: diff
changeset | 445 ) | 
| 
860907bf0e0f
planemo upload for repository https://github.com/your_org_or_user/tools-metabolomics commit 3dd90b60510fa72eb8351464ec5d5883b0b6222a
 workflow4metabolomics parents: diff
changeset | 446 parser$add_argument( | 
| 
860907bf0e0f
planemo upload for repository https://github.com/your_org_or_user/tools-metabolomics commit 3dd90b60510fa72eb8351464ec5d5883b0b6222a
 workflow4metabolomics parents: diff
changeset | 447 "--graphs_out", | 
| 
860907bf0e0f
planemo upload for repository https://github.com/your_org_or_user/tools-metabolomics commit 3dd90b60510fa72eb8351464ec5d5883b0b6222a
 workflow4metabolomics parents: diff
changeset | 448 required = TRUE, | 
| 
860907bf0e0f
planemo upload for repository https://github.com/your_org_or_user/tools-metabolomics commit 3dd90b60510fa72eb8351464ec5d5883b0b6222a
 workflow4metabolomics parents: diff
changeset | 449 help = "Output graphs file" | 
| 
860907bf0e0f
planemo upload for repository https://github.com/your_org_or_user/tools-metabolomics commit 3dd90b60510fa72eb8351464ec5d5883b0b6222a
 workflow4metabolomics parents: diff
changeset | 450 ) | 
| 
860907bf0e0f
planemo upload for repository https://github.com/your_org_or_user/tools-metabolomics commit 3dd90b60510fa72eb8351464ec5d5883b0b6222a
 workflow4metabolomics parents: diff
changeset | 451 | 
| 
860907bf0e0f
planemo upload for repository https://github.com/your_org_or_user/tools-metabolomics commit 3dd90b60510fa72eb8351464ec5d5883b0b6222a
 workflow4metabolomics parents: diff
changeset | 452 args <- parser$parse_args() | 
| 
860907bf0e0f
planemo upload for repository https://github.com/your_org_or_user/tools-metabolomics commit 3dd90b60510fa72eb8351464ec5d5883b0b6222a
 workflow4metabolomics parents: diff
changeset | 453 | 
| 
860907bf0e0f
planemo upload for repository https://github.com/your_org_or_user/tools-metabolomics commit 3dd90b60510fa72eb8351464ec5d5883b0b6222a
 workflow4metabolomics parents: diff
changeset | 454 print(args) | 
| 
860907bf0e0f
planemo upload for repository https://github.com/your_org_or_user/tools-metabolomics commit 3dd90b60510fa72eb8351464ec5d5883b0b6222a
 workflow4metabolomics parents: diff
changeset | 455 | 
| 
860907bf0e0f
planemo upload for repository https://github.com/your_org_or_user/tools-metabolomics commit 3dd90b60510fa72eb8351464ec5d5883b0b6222a
 workflow4metabolomics parents: diff
changeset | 456 if (length(args) < 7) { | 
| 
860907bf0e0f
planemo upload for repository https://github.com/your_org_or_user/tools-metabolomics commit 3dd90b60510fa72eb8351464ec5d5883b0b6222a
 workflow4metabolomics parents: diff
changeset | 457 stop("NOT enough argument !!!") | 
| 
860907bf0e0f
planemo upload for repository https://github.com/your_org_or_user/tools-metabolomics commit 3dd90b60510fa72eb8351464ec5d5883b0b6222a
 workflow4metabolomics parents: diff
changeset | 458 } | 
| 
860907bf0e0f
planemo upload for repository https://github.com/your_org_or_user/tools-metabolomics commit 3dd90b60510fa72eb8351464ec5d5883b0b6222a
 workflow4metabolomics parents: diff
changeset | 459 | 
| 
860907bf0e0f
planemo upload for repository https://github.com/your_org_or_user/tools-metabolomics commit 3dd90b60510fa72eb8351464ec5d5883b0b6222a
 workflow4metabolomics parents: diff
changeset | 460 cat( | 
| 
860907bf0e0f
planemo upload for repository https://github.com/your_org_or_user/tools-metabolomics commit 3dd90b60510fa72eb8351464ec5d5883b0b6222a
 workflow4metabolomics parents: diff
changeset | 461 "\nJob starting time:\n", | 
| 
860907bf0e0f
planemo upload for repository https://github.com/your_org_or_user/tools-metabolomics commit 3dd90b60510fa72eb8351464ec5d5883b0b6222a
 workflow4metabolomics parents: diff
changeset | 462 format(Sys.time(), "%a %d %b %Y %X"), | 
| 
860907bf0e0f
planemo upload for repository https://github.com/your_org_or_user/tools-metabolomics commit 3dd90b60510fa72eb8351464ec5d5883b0b6222a
 workflow4metabolomics parents: diff
changeset | 463 "\n\n--------------------------------------------------------------------", | 
| 
860907bf0e0f
planemo upload for repository https://github.com/your_org_or_user/tools-metabolomics commit 3dd90b60510fa72eb8351464ec5d5883b0b6222a
 workflow4metabolomics parents: diff
changeset | 464 "\nIntensity Check parameters:\n\n" | 
| 
860907bf0e0f
planemo upload for repository https://github.com/your_org_or_user/tools-metabolomics commit 3dd90b60510fa72eb8351464ec5d5883b0b6222a
 workflow4metabolomics parents: diff
changeset | 465 ) | 
| 
860907bf0e0f
planemo upload for repository https://github.com/your_org_or_user/tools-metabolomics commit 3dd90b60510fa72eb8351464ec5d5883b0b6222a
 workflow4metabolomics parents: diff
changeset | 466 print(args) | 
| 
860907bf0e0f
planemo upload for repository https://github.com/your_org_or_user/tools-metabolomics commit 3dd90b60510fa72eb8351464ec5d5883b0b6222a
 workflow4metabolomics parents: diff
changeset | 467 cat("--------------------------------------------------------------------\n\n") | 
| 
860907bf0e0f
planemo upload for repository https://github.com/your_org_or_user/tools-metabolomics commit 3dd90b60510fa72eb8351464ec5d5883b0b6222a
 workflow4metabolomics parents: diff
changeset | 468 | 
| 
860907bf0e0f
planemo upload for repository https://github.com/your_org_or_user/tools-metabolomics commit 3dd90b60510fa72eb8351464ec5d5883b0b6222a
 workflow4metabolomics parents: diff
changeset | 469 class_col <- NULL | 
| 
860907bf0e0f
planemo upload for repository https://github.com/your_org_or_user/tools-metabolomics commit 3dd90b60510fa72eb8351464ec5d5883b0b6222a
 workflow4metabolomics parents: diff
changeset | 470 test_fold <- NULL | 
| 
860907bf0e0f
planemo upload for repository https://github.com/your_org_or_user/tools-metabolomics commit 3dd90b60510fa72eb8351464ec5d5883b0b6222a
 workflow4metabolomics parents: diff
changeset | 471 class1 <- NULL | 
| 
860907bf0e0f
planemo upload for repository https://github.com/your_org_or_user/tools-metabolomics commit 3dd90b60510fa72eb8351464ec5d5883b0b6222a
 workflow4metabolomics parents: diff
changeset | 472 fold_frac <- NULL | 
| 
860907bf0e0f
planemo upload for repository https://github.com/your_org_or_user/tools-metabolomics commit 3dd90b60510fa72eb8351464ec5d5883b0b6222a
 workflow4metabolomics parents: diff
changeset | 473 logarithm <- NULL | 
| 
860907bf0e0f
planemo upload for repository https://github.com/your_org_or_user/tools-metabolomics commit 3dd90b60510fa72eb8351464ec5d5883b0b6222a
 workflow4metabolomics parents: diff
changeset | 474 if (args$method == "each_class") { | 
| 
860907bf0e0f
planemo upload for repository https://github.com/your_org_or_user/tools-metabolomics commit 3dd90b60510fa72eb8351464ec5d5883b0b6222a
 workflow4metabolomics parents: diff
changeset | 475 class_col <- args$class_col | 
| 
860907bf0e0f
planemo upload for repository https://github.com/your_org_or_user/tools-metabolomics commit 3dd90b60510fa72eb8351464ec5d5883b0b6222a
 workflow4metabolomics parents: diff
changeset | 476 test_fold <- args$test_fold | 
| 
860907bf0e0f
planemo upload for repository https://github.com/your_org_or_user/tools-metabolomics commit 3dd90b60510fa72eb8351464ec5d5883b0b6222a
 workflow4metabolomics parents: diff
changeset | 477 if (args$test_fold == "Yes") { | 
| 
860907bf0e0f
planemo upload for repository https://github.com/your_org_or_user/tools-metabolomics commit 3dd90b60510fa72eb8351464ec5d5883b0b6222a
 workflow4metabolomics parents: diff
changeset | 478 logarithm <- args$logarithm | 
| 
860907bf0e0f
planemo upload for repository https://github.com/your_org_or_user/tools-metabolomics commit 3dd90b60510fa72eb8351464ec5d5883b0b6222a
 workflow4metabolomics parents: diff
changeset | 479 } | 
| 
860907bf0e0f
planemo upload for repository https://github.com/your_org_or_user/tools-metabolomics commit 3dd90b60510fa72eb8351464ec5d5883b0b6222a
 workflow4metabolomics parents: diff
changeset | 480 } | 
| 
860907bf0e0f
planemo upload for repository https://github.com/your_org_or_user/tools-metabolomics commit 3dd90b60510fa72eb8351464ec5d5883b0b6222a
 workflow4metabolomics parents: diff
changeset | 481 if (args$method == "one_class") { | 
| 
860907bf0e0f
planemo upload for repository https://github.com/your_org_or_user/tools-metabolomics commit 3dd90b60510fa72eb8351464ec5d5883b0b6222a
 workflow4metabolomics parents: diff
changeset | 482 class_col <- args$class_col | 
| 
860907bf0e0f
planemo upload for repository https://github.com/your_org_or_user/tools-metabolomics commit 3dd90b60510fa72eb8351464ec5d5883b0b6222a
 workflow4metabolomics parents: diff
changeset | 483 class1 <- args$class1 | 
| 
860907bf0e0f
planemo upload for repository https://github.com/your_org_or_user/tools-metabolomics commit 3dd90b60510fa72eb8351464ec5d5883b0b6222a
 workflow4metabolomics parents: diff
changeset | 484 test_fold <- args$test_fold | 
| 
860907bf0e0f
planemo upload for repository https://github.com/your_org_or_user/tools-metabolomics commit 3dd90b60510fa72eb8351464ec5d5883b0b6222a
 workflow4metabolomics parents: diff
changeset | 485 if (args$test_fold == "Yes") { | 
| 
860907bf0e0f
planemo upload for repository https://github.com/your_org_or_user/tools-metabolomics commit 3dd90b60510fa72eb8351464ec5d5883b0b6222a
 workflow4metabolomics parents: diff
changeset | 486 fold_frac <- args$fold_frac | 
| 
860907bf0e0f
planemo upload for repository https://github.com/your_org_or_user/tools-metabolomics commit 3dd90b60510fa72eb8351464ec5d5883b0b6222a
 workflow4metabolomics parents: diff
changeset | 487 logarithm <- args$logarithm | 
| 
860907bf0e0f
planemo upload for repository https://github.com/your_org_or_user/tools-metabolomics commit 3dd90b60510fa72eb8351464ec5d5883b0b6222a
 workflow4metabolomics parents: diff
changeset | 488 } | 
| 
860907bf0e0f
planemo upload for repository https://github.com/your_org_or_user/tools-metabolomics commit 3dd90b60510fa72eb8351464ec5d5883b0b6222a
 workflow4metabolomics parents: diff
changeset | 489 } | 
| 
860907bf0e0f
planemo upload for repository https://github.com/your_org_or_user/tools-metabolomics commit 3dd90b60510fa72eb8351464ec5d5883b0b6222a
 workflow4metabolomics parents: diff
changeset | 490 | 
| 
860907bf0e0f
planemo upload for repository https://github.com/your_org_or_user/tools-metabolomics commit 3dd90b60510fa72eb8351464ec5d5883b0b6222a
 workflow4metabolomics parents: diff
changeset | 491 err_no_option <- NULL | 
| 
860907bf0e0f
planemo upload for repository https://github.com/your_org_or_user/tools-metabolomics commit 3dd90b60510fa72eb8351464ec5d5883b0b6222a
 workflow4metabolomics parents: diff
changeset | 492 | 
| 
860907bf0e0f
planemo upload for repository https://github.com/your_org_or_user/tools-metabolomics commit 3dd90b60510fa72eb8351464ec5d5883b0b6222a
 workflow4metabolomics parents: diff
changeset | 493 if ( | 
| 
860907bf0e0f
planemo upload for repository https://github.com/your_org_or_user/tools-metabolomics commit 3dd90b60510fa72eb8351464ec5d5883b0b6222a
 workflow4metabolomics parents: diff
changeset | 494 ((args$method == "no_class") && (args$chosen_stat == "None")) || | 
| 
860907bf0e0f
planemo upload for repository https://github.com/your_org_or_user/tools-metabolomics commit 3dd90b60510fa72eb8351464ec5d5883b0b6222a
 workflow4metabolomics parents: diff
changeset | 495 ((args$method != "no_class") && | 
| 
860907bf0e0f
planemo upload for repository https://github.com/your_org_or_user/tools-metabolomics commit 3dd90b60510fa72eb8351464ec5d5883b0b6222a
 workflow4metabolomics parents: diff
changeset | 496 (args$chosen_stat == "None") && | 
| 
860907bf0e0f
planemo upload for repository https://github.com/your_org_or_user/tools-metabolomics commit 3dd90b60510fa72eb8351464ec5d5883b0b6222a
 workflow4metabolomics parents: diff
changeset | 497 (test_fold == "No")) | 
| 
860907bf0e0f
planemo upload for repository https://github.com/your_org_or_user/tools-metabolomics commit 3dd90b60510fa72eb8351464ec5d5883b0b6222a
 workflow4metabolomics parents: diff
changeset | 498 ) { | 
| 
860907bf0e0f
planemo upload for repository https://github.com/your_org_or_user/tools-metabolomics commit 3dd90b60510fa72eb8351464ec5d5883b0b6222a
 workflow4metabolomics parents: diff
changeset | 499 err_no_option <- "You did not select any computational option. Program can not be executed." | 
| 
860907bf0e0f
planemo upload for repository https://github.com/your_org_or_user/tools-metabolomics commit 3dd90b60510fa72eb8351464ec5d5883b0b6222a
 workflow4metabolomics parents: diff
changeset | 500 stop("\n- - - - - - - - -\n", err_no_option, "\n- - - - - - - - -\n") | 
| 
860907bf0e0f
planemo upload for repository https://github.com/your_org_or_user/tools-metabolomics commit 3dd90b60510fa72eb8351464ec5d5883b0b6222a
 workflow4metabolomics parents: diff
changeset | 501 } | 
| 
860907bf0e0f
planemo upload for repository https://github.com/your_org_or_user/tools-metabolomics commit 3dd90b60510fa72eb8351464ec5d5883b0b6222a
 workflow4metabolomics parents: diff
changeset | 502 | 
| 
860907bf0e0f
planemo upload for repository https://github.com/your_org_or_user/tools-metabolomics commit 3dd90b60510fa72eb8351464ec5d5883b0b6222a
 workflow4metabolomics parents: diff
changeset | 503 | 
| 
860907bf0e0f
planemo upload for repository https://github.com/your_org_or_user/tools-metabolomics commit 3dd90b60510fa72eb8351464ec5d5883b0b6222a
 workflow4metabolomics parents: diff
changeset | 504 if (is.null(err_no_option)) { | 
| 
860907bf0e0f
planemo upload for repository https://github.com/your_org_or_user/tools-metabolomics commit 3dd90b60510fa72eb8351464ec5d5883b0b6222a
 workflow4metabolomics parents: diff
changeset | 505 intens_check( | 
| 
860907bf0e0f
planemo upload for repository https://github.com/your_org_or_user/tools-metabolomics commit 3dd90b60510fa72eb8351464ec5d5883b0b6222a
 workflow4metabolomics parents: diff
changeset | 506 args$dataMatrix_in, | 
| 
860907bf0e0f
planemo upload for repository https://github.com/your_org_or_user/tools-metabolomics commit 3dd90b60510fa72eb8351464ec5d5883b0b6222a
 workflow4metabolomics parents: diff
changeset | 507 args$sampleMetadata_in, | 
| 
860907bf0e0f
planemo upload for repository https://github.com/your_org_or_user/tools-metabolomics commit 3dd90b60510fa72eb8351464ec5d5883b0b6222a
 workflow4metabolomics parents: diff
changeset | 508 args$variableMetadata_in, | 
| 
860907bf0e0f
planemo upload for repository https://github.com/your_org_or_user/tools-metabolomics commit 3dd90b60510fa72eb8351464ec5d5883b0b6222a
 workflow4metabolomics parents: diff
changeset | 509 args$method, | 
| 
860907bf0e0f
planemo upload for repository https://github.com/your_org_or_user/tools-metabolomics commit 3dd90b60510fa72eb8351464ec5d5883b0b6222a
 workflow4metabolomics parents: diff
changeset | 510 args$chosen_stat, | 
| 
860907bf0e0f
planemo upload for repository https://github.com/your_org_or_user/tools-metabolomics commit 3dd90b60510fa72eb8351464ec5d5883b0b6222a
 workflow4metabolomics parents: diff
changeset | 511 class_col, | 
| 
860907bf0e0f
planemo upload for repository https://github.com/your_org_or_user/tools-metabolomics commit 3dd90b60510fa72eb8351464ec5d5883b0b6222a
 workflow4metabolomics parents: diff
changeset | 512 test_fold, | 
| 
860907bf0e0f
planemo upload for repository https://github.com/your_org_or_user/tools-metabolomics commit 3dd90b60510fa72eb8351464ec5d5883b0b6222a
 workflow4metabolomics parents: diff
changeset | 513 class1, | 
| 
860907bf0e0f
planemo upload for repository https://github.com/your_org_or_user/tools-metabolomics commit 3dd90b60510fa72eb8351464ec5d5883b0b6222a
 workflow4metabolomics parents: diff
changeset | 514 fold_frac, | 
| 
860907bf0e0f
planemo upload for repository https://github.com/your_org_or_user/tools-metabolomics commit 3dd90b60510fa72eb8351464ec5d5883b0b6222a
 workflow4metabolomics parents: diff
changeset | 515 logarithm, | 
| 
860907bf0e0f
planemo upload for repository https://github.com/your_org_or_user/tools-metabolomics commit 3dd90b60510fa72eb8351464ec5d5883b0b6222a
 workflow4metabolomics parents: diff
changeset | 516 args$variableMetadata_out, | 
| 
860907bf0e0f
planemo upload for repository https://github.com/your_org_or_user/tools-metabolomics commit 3dd90b60510fa72eb8351464ec5d5883b0b6222a
 workflow4metabolomics parents: diff
changeset | 517 args$graphs_out | 
| 
860907bf0e0f
planemo upload for repository https://github.com/your_org_or_user/tools-metabolomics commit 3dd90b60510fa72eb8351464ec5d5883b0b6222a
 workflow4metabolomics parents: diff
changeset | 518 ) | 
| 
860907bf0e0f
planemo upload for repository https://github.com/your_org_or_user/tools-metabolomics commit 3dd90b60510fa72eb8351464ec5d5883b0b6222a
 workflow4metabolomics parents: diff
changeset | 519 } | 
| 
860907bf0e0f
planemo upload for repository https://github.com/your_org_or_user/tools-metabolomics commit 3dd90b60510fa72eb8351464ec5d5883b0b6222a
 workflow4metabolomics parents: diff
changeset | 520 | 
| 
860907bf0e0f
planemo upload for repository https://github.com/your_org_or_user/tools-metabolomics commit 3dd90b60510fa72eb8351464ec5d5883b0b6222a
 workflow4metabolomics parents: diff
changeset | 521 | 
| 
860907bf0e0f
planemo upload for repository https://github.com/your_org_or_user/tools-metabolomics commit 3dd90b60510fa72eb8351464ec5d5883b0b6222a
 workflow4metabolomics parents: diff
changeset | 522 cat( | 
| 
860907bf0e0f
planemo upload for repository https://github.com/your_org_or_user/tools-metabolomics commit 3dd90b60510fa72eb8351464ec5d5883b0b6222a
 workflow4metabolomics parents: diff
changeset | 523 "\n--------------------------------------------------------------------", | 
| 
860907bf0e0f
planemo upload for repository https://github.com/your_org_or_user/tools-metabolomics commit 3dd90b60510fa72eb8351464ec5d5883b0b6222a
 workflow4metabolomics parents: diff
changeset | 524 "\nInformation about R (version, Operating System, attached or loaded packages):\n\n" | 
| 
860907bf0e0f
planemo upload for repository https://github.com/your_org_or_user/tools-metabolomics commit 3dd90b60510fa72eb8351464ec5d5883b0b6222a
 workflow4metabolomics parents: diff
changeset | 525 ) | 
| 
860907bf0e0f
planemo upload for repository https://github.com/your_org_or_user/tools-metabolomics commit 3dd90b60510fa72eb8351464ec5d5883b0b6222a
 workflow4metabolomics parents: diff
changeset | 526 sessionInfo() | 
| 
860907bf0e0f
planemo upload for repository https://github.com/your_org_or_user/tools-metabolomics commit 3dd90b60510fa72eb8351464ec5d5883b0b6222a
 workflow4metabolomics parents: diff
changeset | 527 cat( | 
| 
860907bf0e0f
planemo upload for repository https://github.com/your_org_or_user/tools-metabolomics commit 3dd90b60510fa72eb8351464ec5d5883b0b6222a
 workflow4metabolomics parents: diff
changeset | 528 "--------------------------------------------------------------------\n", | 
| 
860907bf0e0f
planemo upload for repository https://github.com/your_org_or_user/tools-metabolomics commit 3dd90b60510fa72eb8351464ec5d5883b0b6222a
 workflow4metabolomics parents: diff
changeset | 529 "\nJob ending time:\n", | 
| 
860907bf0e0f
planemo upload for repository https://github.com/your_org_or_user/tools-metabolomics commit 3dd90b60510fa72eb8351464ec5d5883b0b6222a
 workflow4metabolomics parents: diff
changeset | 530 format(Sys.time(), "%a %d %b %Y %X") | 
| 
860907bf0e0f
planemo upload for repository https://github.com/your_org_or_user/tools-metabolomics commit 3dd90b60510fa72eb8351464ec5d5883b0b6222a
 workflow4metabolomics parents: diff
changeset | 531 ) | 
| 
860907bf0e0f
planemo upload for repository https://github.com/your_org_or_user/tools-metabolomics commit 3dd90b60510fa72eb8351464ec5d5883b0b6222a
 workflow4metabolomics parents: diff
changeset | 532 | 
| 
860907bf0e0f
planemo upload for repository https://github.com/your_org_or_user/tools-metabolomics commit 3dd90b60510fa72eb8351464ec5d5883b0b6222a
 workflow4metabolomics parents: diff
changeset | 533 | 
| 
860907bf0e0f
planemo upload for repository https://github.com/your_org_or_user/tools-metabolomics commit 3dd90b60510fa72eb8351464ec5d5883b0b6222a
 workflow4metabolomics parents: diff
changeset | 534 # delete the parameters to avoid the passage to the next tool in .RData image | 
| 
860907bf0e0f
planemo upload for repository https://github.com/your_org_or_user/tools-metabolomics commit 3dd90b60510fa72eb8351464ec5d5883b0b6222a
 workflow4metabolomics parents: diff
changeset | 535 rm(args) | 
