-
Notifications
You must be signed in to change notification settings - Fork 436
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add Sort Column Order by heading tool. #1233
Add Sort Column Order by heading tool. #1233
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@blankenberg looks good, a few comments inline.
Btw. do you know this tool: https://github.com/bgruening/galaxytools/blob/master/tools/text_processing/column_arrange_by_header/columnArrange.xml
Will this also solve your use-case?
<exit_code range=":-1" /> | ||
</stdio> | ||
<command><![CDATA[ | ||
python '$__tool_directory__/column_order_header_sort.py' '${input_tabular}' '${output_tabular}' '${input_tabular.unsanitized.metadata.delimiter}' '${key_column}' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we have this with line breaks between the parameters?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Changed.
|
||
header = None | ||
with open( input_filename, 'r' ) as fh: | ||
header = fh.readline().strip( '\r\n' ) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there any reason to strip \r\n
and not \n
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is more complete and does not assume POSIX line endings, although this is probably moot in python3.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If anyone was confused, this will strip any and all \r
and \n
(not just the Windows style combination of \r\n
.
e.g.
>>> "abcde".strip("edf")
'abc'
So +1 on stripping both line endings, unless you want to open the file in universal new lines mode instead?
</command> | ||
<inputs> | ||
<param name="input_tabular" type="data" format="tabular" multiple="False" optional="False" label="Tabular file"/> | ||
<param name="key_column" type="data_column" data_ref="input_tabular" value="0" optional="True" label="Identifier column"/> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we add a help here and in the tool-help section what this parameter is doing?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Definitely a great idea, thanks, updated help.
This would require manually entering, and knowing, all of the possible column names. This doesn't scale and won't work when e.g. pushing a file that contains sample names for column headers through a workflow. |
Thanks again! |
No description provided.