Re: [galaxy-dev] preserving newlines in input parameters
Hello Jesse, Dam, Jesse van wrote, On 06/19/2012 01:27 PM: > I found a solution, it seemed that I made a stupid mistake somewhere. But the > following solution will work to preserve the original text in the edit field. > > Add the following to your parameter > > [...] > > Then I use the following code in ruby to decode it again > def unescape(val) > res = "" > escape = false > [ ... ] > > If you want to preserve tabs you will have to add them, but example should be > clear on how to do that. > Alternatively, You can use the undocumented "url_paste", "file_data" variables which are never sanitized (but like all undocumented things - use at your own risk) [1]. Also, It seems you want to give your use a big text area in which to write complicated text, a quicker solution might be to use a config file, and in your ruby script simply read the file - this preserves everything the user entered, with no extra work required (besides reading the file). This is a snippet from an AWK tool [2], that allows users to enter long AWK programs: === awk_wrapper.sh '$input1' '$output' '$awk_script' $url_paste === Galaxy will create a temporary file () and put whatever the user entered there - newlines and everything. -gordon [1]: undocumented non-sanitized variables: $ grep NEVER lib/galaxy/util/__init__.py # is NEVER_SANITIZE required now that sanitizing for tool parameters can be controlled on a per parameter basis and occurs via InputValueWrappers? NEVER_SANITIZE = ['file_data', 'url_paste', 'URL', 'filesystem_paths'] if key not in self.NEVER_SANITIZE and True not in [ key.endswith( "|%s" % nonsanitize_parameter ) for nonsanitize_parameter in self.NEVER_SANITIZE ]: #sanitize check both ungrouped and grouped parameters by name. Anything relying on NEVER_SANITIZE should be changed to not require this and NEVER_SANITIZE should be removed [2] AWK tool: http://hannonlab.cshl.edu/galaxy_unix_tools/download.html ___ Please keep all replies on the list by using "reply all" in your mail client. To manage your subscriptions to this and other Galaxy lists, please use the interface at: http://lists.bx.psu.edu/
Re: [galaxy-dev] preserving newlines in input parameters
I found a solution, it seemed that I made a stupid mistake somewhere. But the following solution will work to preserve the original text in the edit field. Add the following to your parameter I make use of to escape characters I use \ for \ and " and use & for the newline and carage return, because otherwise \n will reformatted to \\n once i get it inside ruby. Then I use the following code in ruby to decode it again def unescape(val) res = "" escape = false val.each_char do |char| if escape escape = false case char when '&' res += '&' when '\\' res += '\\' when 'n' res += "\n" when '\"' res += '\"' end else if char == '\\' || char == '&' escape = true else res += char end end end return res end If you want to preserve tabs you will have to add them, but example should be clear on how to do that. ___ Please keep all replies on the list by using "reply all" in your mail client. To manage your subscriptions to this and other Galaxy lists, please use the interface at: http://lists.bx.psu.edu/
Re: [galaxy-dev] preserving newlines in input parameters
On Tue, Jun 19, 2012 at 5:25 PM, Dam, Jesse van wrote: > I would like to preserve the newlines in the input parameters of my tool. What exactly are you hoping to get as the command line that Galaxy will execute? Peter ___ Please keep all replies on the list by using "reply all" in your mail client. To manage your subscriptions to this and other Galaxy lists, please use the interface at: http://lists.bx.psu.edu/
[galaxy-dev] preserving newlines in input parameters
I would like to preserve the newlines in the input parameters of my tool. I already found out that I can preserve the other characters such as ^,@ and more using the following xml code. But this makes it not possible to preserve newline characters, they are all still replaced by spaces. ___ Please keep all replies on the list by using "reply all" in your mail client. To manage your subscriptions to this and other Galaxy lists, please use the interface at: http://lists.bx.psu.edu/