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>
  <code file="function.py" /> 
  <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">
<tool file ="user/function.xml/>
</section>


thanks
___________________________________________________________
The Galaxy User list should be used for the discussion of
Galaxy analysis and other features on the public server
at usegalaxy.org.  Please keep all replies on the list by
using "reply all" in your mail client.  For discussion of
local Galaxy instances and the Galaxy source code, please
use the Galaxy Development list:

  http://lists.bx.psu.edu/listinfo/galaxy-dev

To manage your subscriptions to this and other Galaxy lists,
please use the interface at:

  http://lists.bx.psu.edu/

Reply via email to