galaxyproject / galaxy

Data intensive science for everyone.
https://galaxyproject.org
Other
1.41k stars 1.01k forks source link

Apply rules: replacing a text string doesn't seem possible? #19103

Open hexylena opened 1 week ago

hexylena commented 1 week ago

Describe the bug

I want to use "create column from regex replacement" to delete a substring (retaining the rest)

Galaxy Version and/or server at which you observed the bug Browser and Operating System same as #19102

To Reproduce Steps to reproduce the behavior:

  1. Create a collection with asdf.fa and bsdf and a second collection with asdf.fa and bsdf.fa
  2. Apply rules
  3. Column
  4. Using a regular expression
  5. Create column from expression replacement
  6. Regex: .fa
  7. Replacement: `` (nothing)

What happens

The regex fails, failing to match some datasets.

If every dataset ends in .fa, instead it fails by creating a column with just .fa, because the rule sees the empty replacement and decides I actually meant to do "create column matching expression".

Expected behavior

I expect this to behave like cat | sed 's/a/b/g but it isn't. I expect it to be providing the entire identifier as input, and then doing the requested replacement (.fa with nothing) which shouldn't fail.

hexylena commented 1 week ago

For others encountering the same I'm using the following workflow as a workaround. It is not ideal but it works. Maybe it is useful as inspiration.

Galaxy-Workflow-Sanitize_Filename.ga.txt