Re: [galaxy-dev] Inform tool interface with data specific to selected dataset

2014-05-09 Thread Björn Grüning

Hi Eric,

the following should work, but is a real hack and not recommended, I think.

https://galaxy-dist.readthedocs.org/en/latest/_modules/galaxy/tools/parameters/dynamic_options.html

code file=filter_genome_from_file.py
param name   = a
   label  = one input
   format = data
   type   = select
   dynamic_options = get_genomes_from_b($input_b) /

Hope that will work for you.
Bjoern


Am 09.05.2014 16:42, schrieb Eric Rasche:

Howdy All,

I have a set of tools in two parts; the first part builds some databases and
prepares some data structures, the second tool plots a subset of the data in the
data structure. Specifically, the data in the structures are named genomes. The
second tools needs to know which genomes, and I'd like to allow the user to be
able to select from a list rather than typing in manually.

Essentially what I'd like to be able to do is create a set of options for an
input type=select from the results of executing a perl/python script. Is
there any way to do this as of now? (ugly hacks are OK as this is a private 
server)

--
Eric Rasche
Programmer II
Center for Phage Technology
Texas AM University
College Station, TX 77843
404-692-2048 tel:4046922048
e...@tamu.edu mailto:e...@tamu.edu



___
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/

To search Galaxy mailing lists use the unified search at:
   http://galaxyproject.org/search/mailinglists/


___
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/

To search Galaxy mailing lists use the unified search at:
 http://galaxyproject.org/search/mailinglists/


Re: [galaxy-dev] Inform tool interface with data specific to selected dataset

2014-05-09 Thread Eric Rasche
Hi Björn,

Brilliant, thank you. That should be exactly what I need. Good to know all of 
these dynamic options filters exist.

09.05.2014, 15:54, Björn Grüning bjoern.gruen...@gmail.com:
 Hi Eric,

 the following should work, but is a real hack and not recommended, I think.

 https://galaxy-dist.readthedocs.org/en/latest/_modules/galaxy/tools/parameters/dynamic_options.html

 code file=filter_genome_from_file.py
 param name   = a
 label  = one input
 format = data
 type   = select
 dynamic_options = get_genomes_from_b($input_b) /

 Hope that will work for you.
 Bjoern

 Am 09.05.2014 16:42, schrieb Eric Rasche:

  Howdy All,

  I have a set of tools in two parts; the first part builds some databases and
  prepares some data structures, the second tool plots a subset of the data 
 in the
  data structure. Specifically, the data in the structures are named genomes. 
 The
  second tools needs to know which genomes, and I'd like to allow the user to 
 be
  able to select from a list rather than typing in manually.

  Essentially what I'd like to be able to do is create a set of options for an
  input type=select from the results of executing a perl/python script. Is
  there any way to do this as of now? (ugly hacks are OK as this is a private 
 server)

  --
  Eric Rasche
  Programmer II
  Center for Phage Technology
  Texas AM University
  College Station, TX 77843
  404-692-2048 tel:4046922048
  e...@tamu.edu mailto:e...@tamu.edu

  ___
  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/

  To search Galaxy mailing lists use the unified search at:
 http://galaxyproject.org/search/mailinglists/

-- 
Eric Rasche
Programmer II
Center for Phage Technology
Texas AM Univesity
College Station, TX 77843
Ph: 4046922048
___
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/

To search Galaxy mailing lists use the unified search at:
  http://galaxyproject.org/search/mailinglists/

Re: [galaxy-dev] Inform tool interface with data specific to selected dataset

2014-05-09 Thread Dooley, Damion
Hello, Eric,

If the dynamic filters approach doesn't work out I can send you an approach 
that worked for me.  It involves creating a tool-generated html report that 
contains a form which provides selection choices; and the form is set to submit 
to a 2nd tool of your choice tool (it contains the necessary fields to prime 
the tool).  Not sure if it works on every breed of galaxy out there though.

d.
___
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/

To search Galaxy mailing lists use the unified search at:
  http://galaxyproject.org/search/mailinglists/


Re: [galaxy-dev] Inform tool interface with data specific to selected dataset

2014-05-09 Thread Igor Topcin
Hi Damion,
Would you mind sharing your approach with us all?
Thanks!
Igor
On May 9, 2014 1:51 PM, Dooley, Damion damion.doo...@bccdc.ca wrote:

 Hello, Eric,

 If the dynamic filters approach doesn't work out I can send you an
 approach that worked for me.  It involves creating a tool-generated html
 report that contains a form which provides selection choices; and the form
 is set to submit to a 2nd tool of your choice tool (it contains the
 necessary fields to prime the tool).  Not sure if it works on every breed
 of galaxy out there though.

 d.
 ___
 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/

 To search Galaxy mailing lists use the unified search at:
   http://galaxyproject.org/search/mailinglists/

___
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/

To search Galaxy mailing lists use the unified search at:
  http://galaxyproject.org/search/mailinglists/

Re: [galaxy-dev] Inform tool interface with data specific to selected dataset

2014-05-09 Thread Dooley, Damion
(in_file) as f_in:
for line in f_in:
rowdata = line.split('\t')
self.lookup['select_row'] +=1
tdTags = ''
for (col, field) in 
enumerate(self.display_columns):
lookup['value'] = rowdata[col]

if (col == 0):
tdTags += 'tdinput 
type=checkbox name=select value=%(select_row)s /%(value)s/td' % 
self.lookup
else:
tdTags += 'td%(value)s/td' 
% self.lookup

fp_out.write(\n\t\t\ttr%s/tr % tdTags)
...

fp_out.write(HTML_REPORT_FOOTER_FILE)


Tool B:

To keep it simple this one just does a single output dataset but I can show a 
multiple output datset one, one for each set of query hits selected above if 
you want.  ' force_history_refresh=True ' is supposed to refresh the history 
list after this executes all of its file writing but for some reason that 
doesn't seem to work on my galaxy.

 tool id=bccdcSelectSubset name=Select subsets 
force_history_refresh=True
command interpreter=python
select_subset.py $input $output1 $output1.id $__new_file_path__ 
$incl_excl $select
/command
inputs
param name=input type=data format=tabular 
label=Numbered tabular input file/
param name=incl_excl type=select format=text 
label=Include or exclude selection?
option value=1Include selection/option
option value=0Exclude selection/option
/param
param name=select type=select multiple=true 
display=checkboxes label=Select lines below
options from_dataset=input
column name=name index=0/
column name=value index=-1/
/options
/param
/inputs
outputs
data name=output1 format=tabular metadata_source=input 
label=$tool.name on data $input.hid/
/outputs
help

.. class:: infomark

**What it does**

This tool produces a tabular file with a subset of the lines in its input 
tabular file.
/help
/tool

And the python:
'''
python select_subset.py $input $output $incl_excl $select
'''

def stop_err( msg ):
sys.stderr.write(%s\n % msg)
sys.exit(1)

import sys

try:
input, output, incl_excl, select = sys.argv[1:]
except:
stop_err('you must provide the arguments input, output, incl_excl and 
select.')

lines = {}
try:
lines = dict([(int(num), '') for num in select.split(',')])
except:
stop_err('Did you remember to number the input dataset?')

include = bool(int(incl_excl))
if include:
print 'Including selected lines...'
else:
print 'Excluding selected lines...'

f_out = open(output, 'w')
with open(input) as f_in:
for line in f_in:
cols = line.split('\t')
try:
num = int(cols[-1])
except:
stop_err('Did you remember to number the input dataset?')
if include:
if num in lines:
f_out.write('\t'.join(cols[:-1])+'\n')
else:
if not num in lines:
f_out.write('\t'.join(cols[:-1])+'\n')
f_in.close()
f_out.close()

print 'Done.'



From: Igor Topcin [igortop...@gmail.com]
Sent: Friday, May 09, 2014 1:05 PM
To: Dooley, Damion
Cc: galaxy-dev@lists.bx.psu.edu
Subject: Re: [galaxy-dev] Inform tool interface with data specific to selected 
dataset

Hi Damion,
Would you mind sharing your approach with us all?
Thanks!
Igor

On May 9, 2014 1:51 PM, Dooley, Damion 
damion.doo...@bccdc.camailto:damion.doo...@bccdc.ca wrote:
Hello, Eric,

If the dynamic filters approach doesn't work out I can send you an approach 
that worked for me.  It involves creating a tool-generated html report that 
contains a form which provides selection choices; and the form is set to submit 
to a 2nd tool of your choice tool (it contains the necessary fields to prime 
the tool).  Not sure if it works on every breed of galaxy out there though.

d.
___
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/

To search Galaxy mailing lists use the unified search at:
  http://galaxyproject.org/search/mailinglists/