Previous changeset 3:191a720488ce (2017-05-11) Next changeset 5:2cdf7d5982c8 (2017-09-07) |
Commit message:
planemo upload for repository https://github.com/HegemanLab/w4mclassfilter_galaxy_wrapper/tree/master commit 7049f74a86f6e47565a68336d6496d112713cbba |
modified:
w4mclassfilter.xml w4mclassfilter_wrapper.R |
b |
diff -r 191a720488ce -r 499c7ecfa834 w4mclassfilter.xml --- a/w4mclassfilter.xml Thu May 11 00:05:51 2017 -0400 +++ b/w4mclassfilter.xml Mon Jun 19 23:42:33 2017 -0400 |
[ |
b'@@ -1,10 +1,10 @@\n-<tool id="w4mclassfilter" name="Sample_Subset" version="0.98.1">\n+<tool id="w4mclassfilter" name="Sample_Subset" version="0.98.2">\n <description>Filter W4M data by sample class</description>\n \n <requirements>\n <requirement type="package" version="3.3.1">r-base</requirement>\n <requirement type="package" version="1.1_4">r-batch</requirement>\n- <requirement type="package" version="0.98.1">w4mclassfilter</requirement>\n+ <requirement type="package" version="0.98.2">w4mclassfilter</requirement>\n </requirements>\n \n <stdio>\n@@ -14,29 +14,36 @@\n \n <command detect_errors="aggressive"><![CDATA[\n Rscript $__tool_directory__/w4mclassfilter_wrapper.R\n- dataMatrix_in "$dataMatrix_in"\n- sampleMetadata_in "$sampleMetadata_in"\n- variableMetadata_in "$variableMetadata_in"\n- sampleclassNames "$sampleclassNames"\n- inclusive "$inclusive"\n- classnameColumn "$classnameColumn"\n- samplenameColumn "$samplenameColumn"\n- dataMatrix_out "$dataMatrix_out"\n- sampleMetadata_out "$sampleMetadata_out"\n- variableMetadata_out "$variableMetadata_out"\n+ dataMatrix_in \'$dataMatrix_in\'\n+ sampleMetadata_in \'$sampleMetadata_in\'\n+ variableMetadata_in \'$variableMetadata_in\'\n+ sampleclassNames \'$sampleclassNames\'\n+ inclusive \'$inclusive\'\n+ wildcards \'$wildcards\'\n+ classnameColumn \'$classnameColumn\'\n+ samplenameColumn \'$samplenameColumn\'\n+ dataMatrix_out \'$dataMatrix_out\'\n+ sampleMetadata_out \'$sampleMetadata_out\'\n+ variableMetadata_out \'$variableMetadata_out\'\n ]]></command>\n \n <inputs>\n <param name="dataMatrix_in" label="Data matrix file" type="data" format="tabular" help="variable x sample, decimal: \'.\', missing: NA, mode: numerical, separator: tab" />\n <param name="sampleMetadata_in" label="Sample metadata file" type="data" format="tabular" help="sample x metadata columns, separator: tab" />\n <param name="variableMetadata_in" label="Variable metadata file" type="data" format="tabular" help="variable x metadata columns, separator: tab" />\n- <param name="sampleclassNames" label="Names of sample classes" type="text" value = "" help="comma-separated names of sample classes to filter in or out; defaults to no names" />\n+ <param name="samplenameColumn" label="Column that names the sample" type="text" value = "sampleMetadata" help="name of the column in the sample metadata file that has the name of the sample - defaults to \'sampleMetadata\'" />\n+ <param name="classnameColumn" label="Column that names the sample-class" type="text" value = "class" help="name of the column in sample metadata that has the values to be tested against the \'classes\' input parameter - defaults to \'class\'" />\n+ <param name="sampleclassNames" label="Names of sample classes" type="text" value = "" help="comma-separated names (or comma-less regular expressions to match names) of sample-classes to filter in or out; defaults to no names">\n+ <sanitizer sanitize="False"/>\n+ </param>\n+ <param name="wildcards" label="Use wild-cards or regular-expressions" type="select" help="wild-cards (the default) - use \'*\' and \'?\' to match class names; regular-expressions - use comma-less regular expressions to match class names">\n+ <option value="TRUE" selected="true">wild-cards</option>\n+ <option value="FALSE">regular-expressions</option>\n+ </param>\n <param name="inclusive" label="Include named classes" type="select" help="filter-in - include only the named sample classes; filter-out (the default) - exclude only the named sample classes">\n <option value="TRUE">filter-in</option>\n <option value="FALSE" selected="true">filter-out</option>\n </param>\n- <param name="classnameColumn" label="Column that names the sample-class" type="text" value = "class" help="name of the column in sample metadata that has the values to be tested against the \'classes\' input parameter - defaults to \'class\'" />\n- <param name="samplenameColumn" label="Column that names the sample" type="text" value = "sample'..b"clude only the named sample classes\n+\t| '``filter-out``' - exclude only the named sample classes\n \t|\n \n-Column that names the sample (default = 'sampleMetadata')\n-\t| name of the column in sample metadata that has the name of the sample\n-\t|\n \n \n ------------\n@@ -293,6 +396,63 @@\n \t|\n \n \n+---------------------------------------\n+Wild card patterns to match class-names\n+---------------------------------------\n+\n+Beginning with v0.98.2, w4mclassfilter supports use of R regular expression patterns to select class-names.\n+\n+- use '``?``' to match a single character\n+- use '``*``' to match zero or more characters\n+- the entire pattern must match the sample name\n+\n+For example\n+\n+- '``??.samp*``' matches '``my.sample``' but not '``my.own.sample``'\n+- '``*.sample``' matches '``my.sample``' and '``my.own.sample``'\n+- '``*.sampl``' matches neither '``my.sample``' nor '``my.own.sample``'\n+\n+------------------------------------------------\n+Regular expression patterns to match class-names\n+------------------------------------------------\n+\n+Beginning with v0.98.2, w4mclassfilter supports use of R regular expression patterns to select class-names.\n+\n+R uses POSIX 1003.2 standard regular expressions, which allow precise pattern-matching and are exhaustively defined at:\n+http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap09.html\n+\n+However, only a few basic building blocks of regular expressions need to be mastered for most cases:\n+\n+- '``^``' matches the beginning of a class-name\n+- '``$``' matches the end of a class-name\n+- '``.``' outside of square brackets matches a single character\n+- '``*``' matches character specified immediately before zero or more times\n+- square brackets specify a set of characters to be matched.\n+\n+Within square brackets\n+\n+- '``^``' as the first character specifies that the list of characters are those that should **not** be matched.\n+- '``-``' is used to specify ranges of characters\n+\n+Caveat: The tool wrapper uses the comma ('``,``') to split a list of sample-class names, so **commas may not be used within regular expressions for this tool**\n+\n+First Example: Consider a field of class-names consisting of '``marq3,marq6,marq9,marq12,front3,front6,front9,front12``'\n+\n+- The regular expression '``^front[0-9][0-9]*$``' will match the same sample-classes as '``front3,front6,front9,front12``'\n+- The regular expression '``^[a-z][a-z]3$``' will match the same sample-classes as '``front3,marq3``'\n+- The regular expression '``^[a-z][a-z]12$``' will match the same sample-classes as '``front12,marq12``'\n+- The regular expression '``^[a-z][a-z][0-9]$``' will match the same sample-classes as '``front3,front6,front9,marq3,marq6,marq9``'\n+\n+Second Example: Consider these regular expression patterns as possible matches to a sample-class name '``AB0123``':\n+\n+- '``^[A-Z][A-Z][0-9][0-9]*$``' - MATCHES '``**^AB0123$**``'\n+- '``^[A-Z][A-Z]*[0-9][0-9]*$``' - MATCHES '``**^AB0123$**``'\n+- '``^[A-Z][0-9]*``' - MATCHES '``**^A** B0123$``' - first character is a letter, '``*``' can specify zero characters, and end of line did not need to be matched.\n+- '``^[A-Z][A-Z][0-9]``' - MATCHES '``**^AB0** 123$``' - first two characters are letters aind the third is a digit.\n+- '``^[A-Z][A-Z]*[0-9][0-9]$``' - NO MATCH - the name does not end with the pattern '``[A-Z][0-9][0-9]$``', i.e., it ends with four digits, not two.\n+- '``^[A-Z][0-9]*$``' - NO MATCH - the pattern specifies that second character and all those that follow, if present, must be digits.\n+\n+\n ---------------\n Working example\n ---------------\n@@ -348,6 +508,19 @@\n NEWS\n ----\n \n+CHANGES IN VERSION 0.98.2\n+=========================\n+\n+NEW FEATURES\n+\n+* Added support for R-flavored regular expression pattern-matching when selecting names of sample-classes.\n+* Empty classes argument or zero-length class_column result in no samples filtered out.\n+\n+INTERNAL MODIFICATIONS\n+\n+* Support and tests for new features.\n+\n+\n CHANGES IN VERSION 0.98.1\n =========================\n \n" |
b |
diff -r 191a720488ce -r 499c7ecfa834 w4mclassfilter_wrapper.R --- a/w4mclassfilter_wrapper.R Thu May 11 00:05:51 2017 -0400 +++ b/w4mclassfilter_wrapper.R Mon Jun 19 23:42:33 2017 -0400 |
[ |
@@ -83,15 +83,13 @@ # other parameters sampleclassNames <- as.character(argVc["sampleclassNames"]) -# if (sampleclassNames == "NONE_SPECIFIED") { -# sampleclassNames <- as.character(c()) -# -# } else { -# sampleclassNames <- strsplit(x = sampleclassNames, split = ",", fixed = TRUE)[[1]] -# } +wildcards <- as.logical(argVc["wildcards"]) sampleclassNames <- strsplit(x = sampleclassNames, split = ",", fixed = TRUE)[[1]] +if (wildcards) { + sampleclassNames <- gsub("[.]", "[.]", sampleclassNames) + sampleclassNames <- utils::glob2rx(sampleclassNames, trim.tail = FALSE) +} inclusive <- as.logical(argVc["inclusive"]) -# print(sprintf("inclusive = '%s'", as.character(inclusive))) classnameColumn <- as.character(argVc["classnameColumn"]) samplenameColumn <- as.character(argVc["samplenameColumn"]) |