Question: Database Function
0
gravatar for La Chi
6.8 years ago by
La Chi60
La Chi60 wrote:
hi , i have created a script which calls a database function(sub_id) and this function returns multiple columns , say its return 12 columns in database , but when i created its tool(function) in galaxy , i am able to return only 1 column(username) in galaxy tool which is not desirable result for me. i want to know how can i return all column from my database function(sub_id) and print its result in separate file(bed format) which should be shown history panel , here is my code function.py file import sys, os.path, logging from galaxy import eggs import pkg_resources from galaxy.model import * from sqlalchemy import * def load_db_values():     pkg_resources.require( "psycopg2" )     engine = create_engine('postgresql://postgres:@132.100.1.1:5432/users')     connection = engine.connect()     result_set = connection.execute( "select * from sub_id(5,10,10)" )     db = []     for row in result_set:         db += [(row ['username'],str(row[ 'userid' ]), False),]           connection.close()     return db def __main__():     columns = [int(x) for x in sys.argv[1].strip().split(',')]     for col in columns:         print col if __name__ == "__main__": __main__() function.xml file <tool id="FA" name="function" version="2.0.0">   <description>function</description>   <command interpreter="python">function.py $cols </command>     <inputs>     <param name="cols" type="select" multiple="true" display="checkboxes"    ="" label="Start" help="any help" dynamic_options="load_db_values()"    =""  ="">     <validator type="no_options" message="You must pick at least one value."/>     </param>   </inputs>  <outputs>    <data format="bed" name="out_file1"  =""/>   </outputs> </tool> function.py and function.xml files are located in galaxy- dist/tools/user tool_config <section name="Function" id="FA">
galaxy • 695 views
ADD COMMENTlink written 6.8 years ago by La Chi60
Please log in to add an answer.

Help
Access

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.
Powered by Biostar version 16.09
Traffic: 179 users visited in the last hour