Create a new column with an expression

I have tabular data and I want to add an extra column which is some operations over existing columns. E.g `str(c2) + “__” + str(c3)` . I don’t want awk as the step for new users.

I would be grateful for a tool which can do this without multiple steps.

Hi @microfuge

I’m guessing that you have already tried with the Compute on rows tool but are getting an error with Invalid expression: at the start, yes?

The issue is that the underscore character cannot be passed directly as it isn’t a whitelisted character that passes through the wrapper’s QA sanitation.

Syntax

Using the Unicode value instead can work through the Python interpreter.

Specifically for your use case, this fails

c2 + “__” + c3

Instead, try using this

c2 + chr(95) + c3
c2 + chr(95) + chr(95) + c3

Please give this a try and let us know what happens! :slight_smile:

Example details

Thanks @jennaj . That worked. Although for new users this solution is a bit less straightforward. An editable spreadsheet would be great in Galaxy :).

Great, glad that helped!

For editing files directly, have you seen the Editor tool under Visualizations?

:warning: This is very basic editing function and error prone but also really useful!

The process goes something like this

  1. Expand the target dataset
  2. :bar_chart: Visualize icon
  3. Search for the Editor
  4. Type in new content into the file
  5. Click on export*
  6. The modified output is written as a new distinct dataset in the history
  7. Repeat as needed!
  8. Double check with Tabulator and consider using Convert delimiters to TAB after

*export is really pale (on purpose!) unless hovered over, so I’ll share a screenshot for where to look!