Converting __oc__ and __cc__ back to curly braces?
Hi, I'm creating a galaxy tool [0] for querying external SPARQL (the Semantic Web query language) endpoints to get back data in tabular formats. I run into a problem though, since SPARQL queries contain curly braces, and Galaxy obviously converts these to an internal representation __oc__ and __cc__ (I found the commit for this at [1]) My SPARQL query for testing looks like this: SELECT ?s ?p ?o WHERE { ?s ?p ?o } LIMIT 25 Thus, when I send this to my (python) script as a commmand line argument, the curly braces comes in galaxy's internal representation. Thus I was wondering if there is a way to get the braces in their correct format from galaxy, or if I should just go agead and convert them back in my own script? (i.e. will this behaviour be stable enough to rely on?) Best // Samuel [0] See the sparql_import.* files in https://github.com/samuell/galaxy_semwebtools [1] http://lists.bx.psu.edu/pipermail/galaxy-dev/2010-February/001837.html -- Developer at SNIC-UPPMAX www.uppmax.uu.se Developer at Dept of Pharm Biosciences www.farmbio.uu.se Twitter - twitter.com/samuellampa Blog - saml.rilspace.org G+ - gplus.to/saml
Hi Samuel, You can import and use the restore_text function from galaxy.lib.util to restore the characters. Alternatively, you may want to look at customizing the sanitizer you are using for the tool input, e.g. only sanitize the quote character that you are using around the command-line argument or even not sanitizing any characters if your python script can use a file ('configfile') as the input: http://wiki.galaxyproject.org/Admin/Tools/Tool%20Config%20Syntax#A.3Csanitiz... http://wiki.galaxyproject.org/Admin/Tools/Tool%20Config%20Syntax#A.3Cconfigf... Thanks for using Galaxy, Dan On Nov 16, 2012, at 1:29 PM, Samuel Lampa wrote:
Hi,
I'm creating a galaxy tool [0] for querying external SPARQL (the Semantic Web query language) endpoints to get back data in tabular formats.
I run into a problem though, since SPARQL queries contain curly braces, and Galaxy obviously converts these to an internal representation __oc__ and __cc__ (I found the commit for this at [1])
My SPARQL query for testing looks like this:
SELECT ?s ?p ?o WHERE { ?s ?p ?o } LIMIT 25
Thus, when I send this to my (python) script as a commmand line argument, the curly braces comes in galaxy's internal representation.
Thus I was wondering if there is a way to get the braces in their correct format from galaxy, or if I should just go agead and convert them back in my own script? (i.e. will this behaviour be stable enough to rely on?)
Best // Samuel
[0] See the sparql_import.* files in https://github.com/samuell/galaxy_semwebtools [1] http://lists.bx.psu.edu/pipermail/galaxy-dev/2010-February/001837.html
-- Developer at SNIC-UPPMAX www.uppmax.uu.se Developer at Dept of Pharm Biosciences www.farmbio.uu.se Twitter - twitter.com/samuellampa Blog - saml.rilspace.org G+ - gplus.to/saml
___________________________________________________________ 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:
Minor correction for the import, you could do: from galaxy.util import restore_text in a tool executed from Galaxy. On Nov 16, 2012, at 2:50 PM, Daniel Blankenberg wrote:
Hi Samuel,
You can import and use the restore_text function from galaxy.lib.util to restore the characters.
Alternatively, you may want to look at customizing the sanitizer you are using for the tool input, e.g. only sanitize the quote character that you are using around the command-line argument or even not sanitizing any characters if your python script can use a file ('configfile') as the input: http://wiki.galaxyproject.org/Admin/Tools/Tool%20Config%20Syntax#A.3Csanitiz... http://wiki.galaxyproject.org/Admin/Tools/Tool%20Config%20Syntax#A.3Cconfigf...
Thanks for using Galaxy,
Dan
On Nov 16, 2012, at 1:29 PM, Samuel Lampa wrote:
Hi,
I'm creating a galaxy tool [0] for querying external SPARQL (the Semantic Web query language) endpoints to get back data in tabular formats.
I run into a problem though, since SPARQL queries contain curly braces, and Galaxy obviously converts these to an internal representation __oc__ and __cc__ (I found the commit for this at [1])
My SPARQL query for testing looks like this:
SELECT ?s ?p ?o WHERE { ?s ?p ?o } LIMIT 25
Thus, when I send this to my (python) script as a commmand line argument, the curly braces comes in galaxy's internal representation.
Thus I was wondering if there is a way to get the braces in their correct format from galaxy, or if I should just go agead and convert them back in my own script? (i.e. will this behaviour be stable enough to rely on?)
Best // Samuel
[0] See the sparql_import.* files in https://github.com/samuell/galaxy_semwebtools [1] http://lists.bx.psu.edu/pipermail/galaxy-dev/2010-February/001837.html
-- Developer at SNIC-UPPMAX www.uppmax.uu.se Developer at Dept of Pharm Biosciences www.farmbio.uu.se Twitter - twitter.com/samuellampa Blog - saml.rilspace.org G+ - gplus.to/saml
___________________________________________________________ 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:
___________________________________________________________ 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:
On 11/16/2012 08:50 PM, Daniel Blankenberg wrote:
You can import and use the restore_text function from galaxy.lib.util to restore the characters.
Thanks! I guess this will be a good starter at least, although I might play a bit with the sanitizers as well, as you hint about below. Anyway, big thanks! // Samuel
participants (2)
-
Daniel Blankenberg
-
Samuel Lampa