Repository 'intensity_checks'
hg clone https://toolshed.g2.bx.psu.edu/repos/melpetera/intensity_checks

Changeset 6:ec75de7f1e08 (2023-12-11)
Previous changeset 5:a31f3f802b2b (2020-01-22)
Commit message:
Uploaded
modified:
Intchecks/README.md
Intchecks/Script_intensity_check.R
Intchecks/wrapper_intensity_check.R
Intchecks/xml_intensity_check.xml
added:
Intchecks/parseargs.R
Intchecks/test-data/input_IC_DM.txt
Intchecks/test-data/input_IC_SM.txt
Intchecks/test-data/input_IC_VM.txt
Intchecks/test-data/output_IC_VM.tabular
b
diff -r a31f3f802b2b -r ec75de7f1e08 Intchecks/README.md
--- a/Intchecks/README.md Wed Jan 22 09:34:08 2020 -0500
+++ b/Intchecks/README.md Mon Dec 11 12:56:20 2023 +0000
b
@@ -5,7 +5,7 @@
 -----------
 
  * **@name**: Intensity check
- * **@version**: 1.2.8
+ * **@version**: 1.3.0
  * **@authors**: Original code: Anthony Fernandes (PFEM - INRA) - Maintainer: Melanie Petera (PFEM - INRAE - MetaboHUB)
  * **@init date**: 2018, September
  * **@main usage**: This tool computes some statistical measures, number of missing values and mean fold change.
@@ -25,8 +25,8 @@
 -----------
 
 ### Requirement:
- * R software: version > 3.0.0 recommended
- * Specific R libraries: 'batch' 
+ * R software: version > 4.0.0 recommended
+ * Specific R libraries: none 
 
 
 Technical description
b
diff -r a31f3f802b2b -r ec75de7f1e08 Intchecks/Script_intensity_check.R
--- a/Intchecks/Script_intensity_check.R Wed Jan 22 09:34:08 2020 -0500
+++ b/Intchecks/Script_intensity_check.R Mon Dec 11 12:56:20 2023 +0000
[
@@ -20,7 +20,7 @@
   VM.name <- "vM_NA.tabular"
   method <- "one_class"
   chosen.stat <- "mean,sd,quartile,decile,NA" 
-  class.col <- "2" 
+  class.col <- "uv" 
   test.fold <- "Yes" 
   class1 <- "Pools"
   fold.frac <- "Top"
@@ -97,11 +97,9 @@
 
 
   if(method != "no_class"){
-    
-    class.col <- colnames(SM)[as.numeric(class.col)]
   
     if(!(class.col %in% colnames(SM))){
-      stop("\n- - - - - - - - -\n", "The column ",class.col, " is not a part of the specify sample Metadata","\n- - - - - - - - -\n")
+      stop("\n- - - - - - - - -\n", "The ",class.col, " column is not found in the specified sample metadata file.","\n- - - - - - - - -\n")
     }
   
     c_class <- SM[,class.col]
@@ -110,7 +108,7 @@
     classnames <- levels(c_class)
   
     if((nb_class < 2)&&(test.fold=="Yes")){
-      err.1class <- c("\n The column",class.col, "contains only one class, fold calculation could not be executed. \n")
+      err.1class <- c("\n The ",class.col, " column contains only one class, fold calculation could not be executed. \n")
       cat(err.1class)  
     }
   
@@ -125,7 +123,7 @@
       if(!(class1 %in% classnames)){
         list.class1 <- c("\n Classes:",classnames,"\n")
         cat(list.class1)
-        err.class1 <- c("The class ",class1, " does not appear in the column ", class.col)
+        err.class1 <- c("The ",class1, " class does not appear in the ",class.col," column.")
         stop("\n- - - - - - - - -\n", err.class1,"\n- - - - - - - - -\n")
       }
   
b
diff -r a31f3f802b2b -r ec75de7f1e08 Intchecks/parseargs.R
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/Intchecks/parseargs.R Mon Dec 11 12:56:20 2023 +0000
[
@@ -0,0 +1,53 @@
+# parseCommandArgs function
+parse_args <- function(
+  args = NULL,
+  convert_booleans = TRUE,
+  convert_numerics = TRUE
+) {
+  if (is.null(args)) {
+    args <- commandArgs()
+  }
+  start <- which(args == "--args")[1] + 1
+  if (is.na(start)) {
+    return(list())
+  }
+  seq_by2 <- seq(start, length(args), by = 2)
+  result <- as.list(args[seq_by2 + 1])
+  names(result) <- args[seq_by2]
+  converters <- c()
+  if (convert_booleans) {
+    converters <- c(
+      converters,
+      function(x) {
+        return(if (x == "TRUE") TRUE else if (x == "FALSE") FALSE else x)
+      }
+    )
+  }
+  if (convert_numerics) {
+    converters <- c(
+      converters,
+      function(x) {
+        return(if (is.na(y <- as.numeric(x))) x else y)
+      }
+    )
+  }
+  return(convert_parameters(result, converters))
+}
+
+convert_parameters <- function(args, converters) {
+  suppressWarnings(
+    for (param in names(args)) {
+      for (converter in converters) {
+        old_value <- args[[param]]
+        args[[param]] <- converter(args[[param]])
+        if (!identical(args[[param]], old_value)) {
+          ## The value has been modified by the converter, and
+          ## we don't want values to be converted multiple times,
+          ## so we pass to the next value.
+          break
+        }
+      }
+    }
+  )
+  return(args)
+}
\ No newline at end of file
b
diff -r a31f3f802b2b -r ec75de7f1e08 Intchecks/test-data/input_IC_DM.txt
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/Intchecks/test-data/input_IC_DM.txt Mon Dec 11 12:56:20 2023 +0000
b
@@ -0,0 +1,18 @@
+data j 785  y54j 68y4j6 5-6 4 hrh  5h - 3  t564 t54 66  y6y t6 5h (5y   g51  ( 6  98 j7-0  06654h  60
+5d_-kkcùf 0.356426723610756 0.380152310071702 0.0306944207412024 0.334137638848017 0.298147485608469 0.975073793297568 0.129099504745855 0.973451663994064 0.334792719284834 0.0751565260418877 0.322897933010729 0.129033714279026 0.722966330196726 0.580654367692078 0.644502528016206 0.352827235332827 0.511778286438001
+npèt 0.801750949101246 0.535593104115636 0.258351312473067 0.599475573145688 0.0763319665667417 0.504558103160623 0.367963830290116 0.440540211857668 0.158066366765388 0.609574253877002 0.550590276177951 0.232864384033621 0.637065775537391 0.424098276140436 0.662053737304139 0.0217541227637467 0.299053946391647
+5PY4(*3 0.875199970420953 NA 0.253659010703906 0.507762246807195 0.856444177031262 NA 0.616538655402613 0.388475672176377 0.914254939740854 0.449607330807756 0.628469388494906 0.436558212905713 0.951198610265672 0.956459387015831 0.0113483457928278 0.611559621193868 0.127393349941781
+k 0.235214515530521 0.50917637648828 0.0303152651414629 0.305595242012361 0.470145996588881 0.356776179776951 0.569840649303474 0.720070419680388 0.875026990189028 0.97246313990283 0.936423978578332 0.810603455355391 0.903046784946495 0.667091730522105 0.0282601148338295 0.276666638740528 0.747503427028951
+"t v^ptok!R/; " 0.251801918471682 0.871383805557867 0.285183681272061 0.552739436194454 0.863766301215097 0.182656918760194 0.977603710051043 0.204845724382198 0.751690583305025 0.751475804910098 0.938399878874186 0.218163132174348 0.523463794277572 0.987156468237196 0.630938391969655 0.495061607430081 0.815474132321848
+ojt* 0.907412839750932 0.857498273276021 0.370137361785406 0.76678484779183 0.213299689296413 0.521214352529346 0.0851731095099456 0.868227767553325 0.0711706993343434 NA 0.700568035764899 NA 0.570332959002042 0.23270290523468 NA NA 0.466363859676536
+lmtki 0.344288940919619 0.308219131305663 0.218449898667526 0.700869668247368 0.932538878977527 0.396198994630489 0.710306820874376 0.124235068279782 0.56608643523601 0.887647287670482 0.0375011938139768 0.282378766400105 0.757492159558571 0.506567258021703 0.990910788272054 0.326205008250378 0.61003856679129
+1h6-(587 t 0.308709890328272 0.717202505490233 0.777934118812417 NA 0.588458968776734 0.940112596977594 0.788662314418432 0.133046934771924 0.891405172730758 0.915119678712577 0.401136527896346 0.996068607925829 0.049077648050296 0.157657286859101 0.598183619914656 0.439531332356748 0.11995300831499
+r154 (54 86 0.0861033910635205 0.243889357950567 0.848801588667359 0.972183114768299 0.311829870889657 0.434854970574638 0.0240613698880671 0.273335646139236 0.902686361056168 0.73479376111027 0.232132726965829 0.471097756642369 0.511949019774828 0.934158039531663 0.60125450357768 0.972297241140637 0.63149263296722
+(h4  0.336373953934809 0.521412085356266 0.281632887739949 0.67004516763179 0.0199332367594847 0.867732114278491 0.973477443505332 0.883197938525362 0.334509105447652 0.793947578560618 0.465167375556954 0.508757674191867 0.983758014396725 0.100582744588671 0.501301982240787 0.789637338939369 0.967382850752139
+2 0.65083934802851 NA 0.0376667088550816 0.514003854683931 0.274761574286474 0.652108809243866 0.689393057486628 0.262205073769319 0.871958663956254 0.709490850507154 0.854477673591409 0.672918329289054 0.141693817710263 0.00543057257281332 0.273084303937691 0.39570748778882 0.303196826092465
+ m(yk 0.798331012769621 0.806128809071498 0.519974578571807 0.0237856823099186 0.396426673475168 0.75979784245693 0.0589336105092753 0.763144123705766 0.16086904822931 0.301000258395631 0.321186481311644 0.0091434029302796 0.0346149352313591 0.276366137673702 NA NA NA
+ -546 -3 -3 0.981561422839383 0.755973696318293 0.328878596436459 0.233341270249666 0.14569201922932 0.458105216271765 NA 0.775603857680909 0.146769440956804 0.86812372109824 0.601678275863019 0.782019307745586 0.955614654474782 0.836058192741214 0.454550085076576 0.181788519803465 0.325277631599655
+nz^à  t  0.920089977342539 NA 0.105577675363886 0.805216649434891 0.505774902707566 0.619612431793644 0.337662179244335 0.672829320507873 0.387228581340173 0.209795853201976 0.0403285073621635 0.540614252108851 0.43362855410287 0.160204078494507 0.924783730297701 0.116837628312753 0.58763473928668
+kzjù 0.418651623550921 0.668434005412235 0.845525871017258 0.567468950919516 0.111441846749533 0.411424602517146 0.0743349602270699 0.583730221710347 0.0105008018078939 0.918789674284249 0.808643595994088 0.33578972219198 0.536848200622412 0.898842910125025 0.333954421105444 0.0390509357521919 0.159857705429294
+. Glk(ôepjg$ 0.3266193089274 0.806668730531573 0.87265879590923 0.934940869880726 0.548967615908753 0.250539517744596 0.75436043048449 0.597444122305604 0.343955002787363 0.560987092777944 0.134929631392942 0.958047956861493 0.870429681664852 0.66286672214456 0.441523248613101 0.437073092741238 0.265031623006715
+rmlgj*lr , 0.462672931523031 0.74679446664976 0.151929368261195 0.165870989887449 0.90931621240424 0.423706631494886 0.337742032589001 0.184993498717115 0.0792523932129463 0.071353352835237 0.525247607449536 0.647744088759121 0.158725526449032 0.203927461340644 0.20055683200405 0.897053444943847 0.506954538974894
b
diff -r a31f3f802b2b -r ec75de7f1e08 Intchecks/test-data/input_IC_SM.txt
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/Intchecks/test-data/input_IC_SM.txt Mon Dec 11 12:56:20 2023 +0000
b
@@ -0,0 +1,18 @@
+data ABCD E AAA fp uv
+j 785 1 91 a a s
+y54j 68y4j6 2 60 b z d
+5-6 4 2 43 c e f
+hrh 3 24 d r s
+5h - 4 29 b t d
+3 56 71 a y f
+t564 4 4 r u s
+t54 66 23 91 c i d
+y6y 5 61 f o f
+t6 5h 8 21 s p s
+(5y 98 77 b q d
+g51 67 1 b s f
+( 98 48 r d s
+6 2 10 a f d
+98 j7-0 1 36 a g f
+06654h 34 100 k h s
+60 67 38 d j d
b
diff -r a31f3f802b2b -r ec75de7f1e08 Intchecks/test-data/input_IC_VM.txt
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/Intchecks/test-data/input_IC_VM.txt Mon Dec 11 12:56:20 2023 +0000
b
@@ -0,0 +1,18 @@
+variable A B C D
+5d_-kkcùf 0 a ze$ùj 0
+npèt 1 b  g 0
+5PY4(*3 2 c  15j-è, 0
+k 3 a 6jè 1
+t v^ptok!R/;  4 b 8j4, 1
+ojt* 5 c 5èj1 1
+lmtki 6 a j84 2
+1h6-(587 t 7 b j4e54 2
+r154 (54 86 8 c j 2
+(h4  9 a 54j6@44èu6(è4 3
+2 10 b (51h 3
+ m(yk 11 c 8-1 3
+ -546 -3 -3 12 a hy-81u 4
+nz^à  t  13 b zs5-hj1 4
+kzjù 14 c 861h 4
+. Glk(ôepjg$ 15 a (8168(h1 9
+rmlgj*lr , 16 b 8hjè1 9
b
diff -r a31f3f802b2b -r ec75de7f1e08 Intchecks/test-data/output_IC_VM.tabular
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/Intchecks/test-data/output_IC_VM.tabular Mon Dec 11 12:56:20 2023 +0000
b
@@ -0,0 +1,18 @@
+variable A B C D Mean_s Mean_Other Sd_s Sd_Other NA_s NA_Other Pct_NA_s Pct_NA_Other log2_fold_Other_VS_s
+5d_-kkcùf 0 a ze$ùj 0 0.328435659796011 0.471016292948534 0.228451584966275 0.306556034161105 0 0 0 0 0.520166189269251
+npèt 1 b  g 0 0.506264084119198 0.376554698635174 0.274830786331717 0.183936635993605 0 0 0 0 -0.427030691648967
+5PY4(*3 2 c  15j-è, 0 0.668644405816343 0.50811805375594 0.201164644457448 0.349587008290475 0 2 0 18.1818 -0.396075445063365
+k 3 a 6jè 1 0.543804495072701 0.559217630380327 0.327662996370251 0.314841391119243 0 0 0 0 0.040321768397534
+t v^ptok!R/;  4 b 8j4, 1 0.592024378555822 0.613605365279061 0.247181366605864 0.324224837252577 0 0 0 0 0.0516545128160351
+ojt* 5 c 5èj1 1 0.582425939013687 0.477909216050108 0.359170947930419 0.286185546056577 2 2 33.3333 18.1818 -0.285338020130744
+lmtki 6 a j84 2 0.621134980920132 0.452102270945102 0.231326066781317 0.308002376571479 0 0 0 0 -0.458257654955689
+1h6-(587 t 7 b j4e54 2 0.500220172773265 0.574650849860962 0.353280826805041 0.328577697095778 1 0 16.6667 0 0.200122420718524
+r154 (54 86 8 c j 2 0.550231316290937 0.535048495905671 0.420471482717973 0.267498028870002 0 0 0 0 -0.0403685917338988
+(h4  9 a 54j6@44èu6(è4 3 0.757873249494774 0.495600908676148 0.238828322527637 0.310985735881046 0 0 0 0 -0.612777752412226
+2 10 b (51h 3 0.516854736034218 0.420780853559443 0.219207900924983 0.318004326311928 0 1 0 9.0909 -0.296689802273714
+ m(yk 11 c 8-1 3 0.243333099843161 0.445893010825123 0.330573629082567 0.285737925809767 1 2 16.6667 18.1818 0.873765007290379
+ -546 -3 -3 12 a hy-81u 4 0.644085917693107 0.510055119992691 0.40111184763981 0.256342273516465 1 0 16.6667 0 -0.336599986295532
+nz^à  t  13 b zs5-hj1 4 0.470538473606561 0.454458821926304 0.3244119263237 0.280532541853305 0 1 0 9.0909 -0.0501631106824151
+kzjù 14 c 861h 4 0.425857390892727 0.46983142764184 0.331238344963174 0.311088298141582 0 0 0 0 0.141772831906062
+. Glk(ôepjg$ 15 a (8168(h1 9 0.647401746079442 0.534784815200539 0.244322481422829 0.27318926988152 0 0 0 0 -0.275702754775479
+rmlgj*lr , 16 b 8hjè1 9 0.348903046371266 0.41640209993349 0.303393826442722 0.274707725036023 0 0 0 0 0.255151150062007
b
diff -r a31f3f802b2b -r ec75de7f1e08 Intchecks/wrapper_intensity_check.R
--- a/Intchecks/wrapper_intensity_check.R Wed Jan 22 09:34:08 2020 -0500
+++ b/Intchecks/wrapper_intensity_check.R Mon Dec 11 12:56:20 2023 +0000
[
@@ -14,17 +14,15 @@
 #                                                                           #
 #############################################################################
 
-
-library(batch) #necessary for parseCommandArgs function
-args = parseCommandArgs(evaluate=FALSE) #interpretation of arguments given in command line as an R list of objects
-
 source_local <- function(...){
   argv <- commandArgs(trailingOnly = FALSE)
   base_dir <- dirname(substring(argv[grep("--file=", argv)], 8))
   for(i in 1:length(list(...))){source(paste(base_dir, list(...)[[i]], sep="/"))}
 }
 #Import the different functions
-source_local("Script_intensity_check.R", "RcheckLibrary.R")
+source_local("parseargs.R", "Script_intensity_check.R", "RcheckLibrary.R")
+
+args = parse_args() #interpretation of arguments given in command line as an R list of objects
 
 
 if(length(args) < 7){ stop("NOT enough argument !!!") }
b
diff -r a31f3f802b2b -r ec75de7f1e08 Intchecks/xml_intensity_check.xml
--- a/Intchecks/xml_intensity_check.xml Wed Jan 22 09:34:08 2020 -0500
+++ b/Intchecks/xml_intensity_check.xml Mon Dec 11 12:56:20 2023 +0000
b
@@ -1,7 +1,7 @@
-<tool id="intens_check" name="Intensity Check" version="1.2.8">
+<tool id="intens_check" name="Intensity Check" version="1.3.0">
  <description>Statistical measures, number of missing values and mean fold change</description>
  <requirements>
-     <requirement type="package" version="1.1_5">r-batch</requirement>
+     <requirement type="package" version="4.2.1">r-base</requirement>
  </requirements>
  <command interpreter="Rscript">
   
@@ -66,7 +66,7 @@
  </when>
 
  <when value="each_class">
- <param name="class_col" type="data_column" data_ref="sampleMetadata_in" use_header_names="true" label="Class column" help="Class column in Sample metadata" />
+ <param name="class_col" type="text" label="Class column" help="Name of the column in Sample metadata" />
  <param name="chosen_stat" type="select" display="checkboxes" multiple="True" label="Statistics">
  <option value="mean">Mean</option>
                     <option value="sd">Standard deviation</option>
@@ -87,11 +87,13 @@
  <option value="log10">log10 </option>
  </param>
  </when>
+ <when value="No">
+ </when>
  </conditional>
  </when>
 
  <when value="one_class">
- <param name="class_col" type="data_column" data_ref="sampleMetadata_in" use_header_names="true" label="Class column" help="Class column in Sample metadata" />
+ <param name="class_col" type="text" label="Class column" help="Name of the column in Sample metadata" />
  <param name="class1" type="text" label="Selected class" help="Name of the class to test versus all the remaining samples." />
  <param name="chosen_stat" type="select" display="checkboxes" multiple="True" label="Statistics">
  <option value="mean">Mean</option>
@@ -117,6 +119,8 @@
  <option value="log10">log10 </option>
  </param>
  </when>
+ <when value="No">
+ </when>
  </conditional>
  </when>
  </conditional>
@@ -129,7 +133,21 @@
  </outputs>
 
 
-
+  <tests>
+ <test>
+      <param name="dataMatrix_in" value="input_IC_DM.txt"/>
+      <param name="sampleMetadata_in" value="input_IC_SM.txt"/>
+      <param name="variableMetadata_in" value="input_IC_VM.txt"/>
+   <param name="method" value="one_class"/>
+   <param name="chosen_stat" value="mean,sd,NA"/>
+   <param name="class_col" value="uv"/>
+   <param name="class1" value="s"/>
+   <param name="test_fold" value="Yes"/>
+   <param name="fold_frac" value="Bottom"/>
+   <param name="logarithm" value="log2"/>
+      <output name="variableMetadata_out" file="output_IC_VM.tabular"/>
+ </test>
+  </tests>
 
  <help>
 
@@ -194,7 +212,7 @@
  |  Select the statistical measures you want to add in the variable metadata table. If the method is "each class" or "one class", you can choose to leave this section blank if you only want to calculate the mean fold change (see below).
 
 **Class column** (*only if "each class" or "one class"*)
- | Select the class column in sample metadata table.
+ | Fill the name of the class column in sample metadata table; it is case-sensitive.
 
 **Selected class** (*only if "one class"*)
  | If the method is "one class", specify it. Remaining samples will be named "Other".
@@ -231,7 +249,7 @@
 .. class:: warningmark
 
 For more information about input files, refer to the corresponding "W4M HowTo" page:
- | `W4M table format for Galaxy &lt;http://workflow4metabolomics.org/sites/workflow4metabolomics.org/files/files/w4m_TableFormatForGalaxy_150908.pdf&gt;`_
+ | `W4M table format for Galaxy &lt;https://workflow4metabolomics.org/sites/default/files/fichiers/documents/w4m_TableFormatForGalaxy_150908.pdf&gt;`_
  |