Repository 'text_processing'
hg clone https://toolshed.g2.bx.psu.edu/repos/bgruening/text_processing

Changeset 18:d698c222f354 (2022-10-08)
Previous changeset 17:f46f0e4f75c4 (2021-06-22) Next changeset 19:12615d397df7 (2024-02-29)
Commit message:
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/text_processing/text_processing commit 378e99cde623698fb44ee7ac9873f455fb51fdbc"
modified:
find_and_replace.xml
added:
test-data/find_and_replace_results3.txt
b
diff -r f46f0e4f75c4 -r d698c222f354 find_and_replace.xml
--- a/find_and_replace.xml Tue Jun 22 16:06:48 2021 +0000
+++ b/find_and_replace.xml Sat Oct 08 21:01:33 2022 +0000
[
b'@@ -1,4 +1,4 @@\n-<tool id="tp_find_and_replace" name="Replace" version="@BASE_VERSION@.3">\n+<tool id="tp_find_and_replace" name="Replace" version="@BASE_VERSION@.4">\n     <description>parts of text</description>\n     <macros>\n         <import>macros.xml</import>\n@@ -8,106 +8,149 @@\n     </requirements>\n     <command>\n <![CDATA[\n-        perl \'$__tool_directory__/find_and_replace\'\n-            #if $searchwhere.searchwhere_select == "column":\n-                -c $searchwhere.column\n+        #for $i, $el in enumerate($find_and_replace)\n+            #if $i == (len($find_and_replace) - 1)\n+                #set $join = ""\n+            #else \n+                #set $join = "|"\n             #end if\n-            -o $outfile\n-            $global\n-            $caseinsensitive\n-            $wholewords\n-            $skip_first_line\n-            $is_regex\n-            \'$find_pattern\'\n-            \'$replace_pattern\'\n-            \'$infile\'\n+            perl \'$__tool_directory__/find_and_replace\'\n+                #if $el.searchwhere.searchwhere_select == "column":\n+                    -c $el.searchwhere.column\n+                #end if\n+                #if $i == (len($find_and_replace) - 1)\n+                    -o \'$outfile\'\n+                #end if\n+                $el.global\n+                $el.caseinsensitive\n+                $el.wholewords\n+                $el.skip_first_line\n+                $el.is_regex\n+                \'$el.find_pattern\'\n+                \'$el.replace_pattern\'\n+                #if $i == 0\n+                    \'$infile\'\n+                #end if\n+                $join\n+        #end for        \n ]]>\n     </command>\n     <inputs>\n         <param name="infile" format="txt" type="data" label="File to process" />\n-        <param name="find_pattern" type="text" label="Find pattern" help="Use simple text, or a valid regular expression (without backslashes // ) " >\n-            <sanitizer>\n-                <valid initial="string.printable">\n-                    <remove value="&apos;"/>\n-                </valid>\n-            </sanitizer>\n-        </param>\n-        <param name="replace_pattern" type="text" label="Replace with"\n-            help="Use simple text, or $&amp; (dollar-ampersand) and $1 $2 $3 to refer to matched text. See examples below." >\n-            <sanitizer>\n-                <valid initial="string.printable">\n-                    <remove value="&apos;"/>\n-                </valid>\n-            </sanitizer>\n-        </param>\n-        <param name="is_regex" type="boolean" checked="false" truevalue="-r" falsevalue=""\n-            label="Find-Pattern is a regular expression" help="see help section for details." />\n+        <repeat name="find_and_replace" title="Find and Replace" min="1">\n+            <param name="find_pattern" type="text" label="Find pattern" help="Use simple text, or a valid regular expression (without backslashes // ) " >\n+                <sanitizer>\n+                    <valid initial="string.printable">\n+                        <remove value="&apos;"/>\n+                    </valid>\n+                </sanitizer>\n+            </param>\n+            <param name="replace_pattern" type="text" label="Replace with"\n+                help="Use simple text, or $&amp; (dollar-ampersand) and $1 $2 $3 to refer to matched text. See examples below." >\n+                <sanitizer>\n+                    <valid initial="string.printable">\n+                        <remove value="&apos;"/>\n+                    </valid>\n+                </sanitizer>\n+            </param>\n+            <param name="is_regex" type="boolean" checked="false" truevalue="-r" falsevalue=""\n+                label="Find-Pattern is a regular expression" help="see help section for details." />\n \n-        <param name="global" type="boolean" checked="false" truevalue="-g" falsevalue=""\n-            label="Replace all occurences of the pattern" />\n+            <param name="global" type="boolean" checked="false" truevalue="-g" falsevalue=""\n+            '..b'  result should be the same as in test 1 which works on whole line -->\n-        <test>\n+        <test expect_num_outputs="1">\n             <param name="infile" value="find_and_replace1.txt" ftype="tabular" />\n-            <param name="find_pattern" value="day" />\n-            <param name="replace_pattern" value="great day" />\n-            <param name="is_regex" value="False" />\n-            <param name="global" value="true" />\n-            <param name="caseinsensitive" value="False" />\n-            <param name="wholewords" value="True" />\n-            <conditional name="searchwhere">\n-                <param name="searchwhere_select" value="column"/>\n-                <param name="column" value="1" />\n-            </conditional>\n+            <repeat name="find_and_replace">\n+                <param name="find_pattern" value="day" />\n+                <param name="replace_pattern" value="great day" />\n+                <param name="is_regex" value="False" />\n+                <param name="global" value="true" />\n+                <param name="caseinsensitive" value="False" />\n+                <param name="wholewords" value="True" />\n+                <conditional name="searchwhere">\n+                    <param name="searchwhere_select" value="column"/>\n+                    <param name="column" value="1" />\n+                </conditional>\n+            </repeat>\n             <output name="outfile" file="find_and_replace_results1.txt" />\n         </test>\n-        <test>\n+        <test expect_num_outputs="1">\n             <param name="infile" value="find_and_replace2.txt" />\n-            <param name="find_pattern" value="^chr" />\n-            <param name="replace_pattern" value="" />\n-            <param name="is_regex" value="True" />\n-            <param name="caseinsensitive" value="False" />\n-            <param name="wholewords" value="False" />\n-            <param name="searchwhere_select" value="column" />\n-            <param name="column" value="3" />\n+            <repeat name="find_and_replace">\n+                <param name="find_pattern" value="^chr" />\n+                <param name="replace_pattern" value="" />\n+                <param name="is_regex" value="True" />\n+                <param name="caseinsensitive" value="False" />\n+                <param name="wholewords" value="False" />\n+                <conditional name="searchwhere">\n+                    <param name="searchwhere_select" value="column" />\n+                    <param name="column" value="3" />\n+                </conditional>\n+            </repeat>\n             <output name="outfile" file="find_and_replace_results2.txt" />\n         </test>\n+        <test expect_num_outputs="1">\n+            <param name="infile" value="find_and_replace1.txt" />\n+            <repeat name="find_and_replace">\n+                <param name="find_pattern" value="day" />\n+                <param name="replace_pattern" value="great day" />\n+                <param name="is_regex" value="False" />\n+                <param name="global" value="true" />\n+                <param name="caseinsensitive" value="False" />\n+                <param name="wholewords" value="True" />\n+            </repeat>\n+            <param name="infile" value="find_and_replace1.txt" />\n+            <repeat name="find_and_replace">\n+                <param name="find_pattern" value="great" />\n+                <param name="replace_pattern" value="best" />\n+                <param name="is_regex" value="False" />\n+                <param name="global" value="False" />\n+                <param name="caseinsensitive" value="False" />\n+                <param name="wholewords" value="True" />\n+            </repeat>\n+            <output name="outfile" file="find_and_replace_results3.txt" />    \n+        </test>\n     </tests>\n     <help>\n <![CDATA[\n@@ -125,7 +168,7 @@\n \n .. class:: infomark\n \n-This tool uses Perl regular expression syntax.\n+This tool uses `Perl regular expression <https://perldoc.perl.org/perlre>`_ syntax.\n \n -----\n \n'
b
diff -r f46f0e4f75c4 -r d698c222f354 test-data/find_and_replace_results3.txt
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test-data/find_and_replace_results3.txt Sat Oct 08 21:01:33 2022 +0000
b
@@ -0,0 +1,1 @@
+I have a dream that one best day this nation will rise up, and live out the true meaning of its creed: ‘We hold these truths to be self-evident: that all men are created equal.’ I have a dream that one great day on the red hills of Georgia the sons of former slaves and the sons of former slave owners will be able to sit down together at a table of brotherhood. I have a dream that one great day even the state of Mississippi, a state sweltering with the heat of injustice and sweltering with the heat of oppression, will be transformed into an oasis of freedom and justice. I have a dream that my four little children will one great day live in a nation where they will not be judged by the color of their skin but by the content of their character. I have a dream today!