Cut tool (Text Manipulation) doesn't rearrange columns?

Hello. I’m new to Galaxy and I noticed that the Cut tool seems to be broken relative to its usual functionality in unix as well as what is described in the galaxy 101 tutorial. Namely, I can keep and discard columns, but they cannot be rearranged.

For example, if I try to cut (keep) columns 1, 2, 10, and 3 in that order, they are automatically sorted back to 1, 2, 3, and 10.

Is there another tool for rearranging? Thanks!

1 Like

Welcome, @hannah413 and thanks for reporting the problem.

There are two versions of the “Cut” tool on Galaxy Main https://usegalaxy.org.

One is the original, the other is updated with a bit more built-in functionality.

Would you please click on the re-run button for the dataset that did not order the columns correctly, then copy/paste the entire tool name back here (the complete name that includes the version number)? This is at the very top of the form.

I’ll test it out and get back to you early next week, probably Monday. Could be a bug or a usage problem. Let’s see if I can reproduce it, then follow-up from there.

Meanwhile, if you are in a rush, try using the other version.

For reference:

  1. Original tool version **Cut** columns from a table (Galaxy Version 1.0.2)
  2. Alternate version Cut columns from a table (cut) (Galaxy Version 1.1.0)

The first (original) version was specifically designed to re-arrange columns. I’m not sure about the other, have not used it since we upgraded to the latest tool version and Galaxy release for this type of purpose, and the help on that tool form does not include column re-arrangement examples.

I’d be somewhat surprised if the first version doesn’t work correctly – was one of our original tools (created 12+ years ago) so if buggy would be a priority fix.

The second is from the IUC – if there is a problem with the intended functionality, they will definitely appreciate the feedback and also likely address the usage/result optimization going forward if there is something “off” (I’ll make the report/request part of that as needed).

Ideally, both should work the same at the most basic level, eg: cutting columns out based on user-specified parameters.

Thanks for reporting the issue!

I think you’re misremembering that, the output of cut -f1,2 is the same as cut -f2,1, cut does not reorder columns.

2 Likes

This is a good explanation, @mvdbeek, I missed that, too. Thanks!

Detail:

^^ Is based on a custom python function that is similar to the Unix “cut” utility in many ways and was designed to rearrange columns.

^^ Is based on a Unix utility. Does not rearrange columns (by default).

We could probably make the difference clearer in the tool help. Eg: have each reference the other and explain column rearrangement versus not.

Ah, thanks @mvdbeek I should have double checked my memory of the unix approach. Good eye.

@jennaj Here is the exact text I copied from the top of the re-run page: Cut columns from a table (cut) (Galaxy Version 1.1.0).

It is probably not an issue with the tool itself, but rather an issue with the entry box where it lists the selected fields for cutting. That entry box forces a rearrangement. For example, if I try to give it the columns 6, 5, 4, 3, 2, and 1 in that order (descending), it automatically rearranges them to ascending order as you see in the picture. I think the tool receives the already-reordered input

1 Like

Right, that is how the version of the tool you are using works (as @mvdbeek clarified).

Try the other alternate version of the tool I listed above to rearrange columns.

Yup, that resolves it. Thanks for your patient explanations!

1 Like

@hannah413 Glad this is working now and things are cleared up :rocket:

I created a ticket to discuss what the options are to make identifying the “right” Cut tool easier for others to find. If interested, please see: https://github.com/galaxyproject/tools-iuc/issues/2458

Appreciate all the feedback :slight_smile: