galaxy-dev
Threads by month
- ----- 2024 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2023 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2022 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2021 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2020 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2019 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2018 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2017 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2016 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2015 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2014 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2013 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2012 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2011 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2010 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2009 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2008 -----
- December
- November
- October
- September
- August
November 2009
- 26 participants
- 233 discussions
details: http://www.bx.psu.edu/hg/galaxy/rev/840255033ab0
changeset: 2978:840255033ab0
user: Nate Coraor <nate(a)bx.psu.edu>
date: Fri Nov 06 14:36:36 2009 -0500
description:
Remove tool conf typo
diffstat:
tool_conf.xml.sample | 1 -
1 files changed, 0 insertions(+), 1 deletions(-)
diffs (11 lines):
diff -r b08d426dc57f -r 840255033ab0 tool_conf.xml.sample
--- a/tool_conf.xml.sample Fri Nov 06 14:23:21 2009 -0500
+++ b/tool_conf.xml.sample Fri Nov 06 14:36:36 2009 -0500
@@ -128,7 +128,6 @@
<tool file="visualization/genetrack_indexer.xml" />
<tool file="visualization/genetrack_peak_prediction.xml" />
</section>
- </section>
<section name="Regional Variation" id="regVar">
<tool file="regVariation/windowSplitter.xml" />
<tool file="regVariation/featureCounter.xml" />
1
0
details: http://www.bx.psu.edu/hg/galaxy/rev/b08d426dc57f
changeset: 2977:b08d426dc57f
user: Nate Coraor <nate(a)bx.psu.edu>
date: Fri Nov 06 14:23:21 2009 -0500
description:
Fix for GeneTrack egg
diffstat:
scripts/scramble/scripts/GeneTrack.py | 18 ++++++++++++------
1 files changed, 12 insertions(+), 6 deletions(-)
diffs (33 lines):
diff -r 4a7f9fdead89 -r b08d426dc57f scripts/scramble/scripts/GeneTrack.py
--- a/scripts/scramble/scripts/GeneTrack.py Fri Nov 06 14:22:44 2009 -0500
+++ b/scripts/scramble/scripts/GeneTrack.py Fri Nov 06 14:23:21 2009 -0500
@@ -35,17 +35,23 @@
sys.argv.append( "--no-svn-revision" )
sys.argv.append( "bdist_egg" )
-print "scramble.py: Creating setup.py for GeneTrack"
-setup_py = """from setuptools import setup, find_packages
+if not os.access( 'setup.py', os.F_OK ):
+ print "scramble.py: Creating setup.py for GeneTrack"
+ setup_py = """from os import walk
+from os.path import join
+from setuptools import setup, find_packages
+def walk_files( top ):
+ for dir, dirs, files in walk( top ):
+ yield( dir, [ join( dir, f ) for f in files ] )
setup(
name = "GeneTrack",
version = "2.0.0-beta-1",
- package_data = {'':["*.*"]},
- packages = find_packages(),
- zip_safe = True,
+ packages = ['genetrack','genetrack.scripts'],
+ data_files = [ f for f in walk_files('tests') ],
+ zip_safe = False
)
"""
-open( 'setup.py', 'w' ).write( setup_py )
+ open( 'setup.py', 'w' ).write( setup_py )
# do it
1
0
07 Nov '09
details: http://www.bx.psu.edu/hg/galaxy/rev/b54c37f53d53
changeset: 2979:b54c37f53d53
user: Kelly Vincent <kpvincent(a)bx.psu.edu>
date: Fri Nov 06 16:52:00 2009 -0500
description:
Commented out second test for SAM-to-BAM so tests will pass, because it relies on using a built-in dbkey that doesn't exist in builds.txt
diffstat:
tools/samtools/sam_to_bam.xml | 5 +++--
1 files changed, 3 insertions(+), 2 deletions(-)
diffs (23 lines):
diff -r 840255033ab0 -r b54c37f53d53 tools/samtools/sam_to_bam.xml
--- a/tools/samtools/sam_to_bam.xml Fri Nov 06 14:36:36 2009 -0500
+++ b/tools/samtools/sam_to_bam.xml Fri Nov 06 16:52:00 2009 -0500
@@ -36,16 +36,17 @@
<tests>
<test>
<param name="indexSource" value="history" />
- <param name="input1" value="sam_to_bam_in1.sam" ftype="sam" />
+ <param name="input1" value="sam_to_bam_in1.sam" ftype="sam" dbkey="chrM" />
<param name="ref_file" value="chrM.fa" ftype="fasta" />
<output name="output1" file="sam_to_bam_out1.bam" />
</test>
+<!-- chrM is not a built-in dbkey (in the builds.txt list) so can't be tested
<test>
<param name="indexSource" value="built_in" />
<param name="input1" value="sam_to_bam_in2.sam" ftype="sam" dbkey="chrM" />
- <param name="ref_file" value="chrM.fa" ftype="fasta" />
<output name="output1" file="sam_to_bam_out2.bam" />
</test>
+-->
</tests>
<help>
1
0
07 Nov '09
details: http://www.bx.psu.edu/hg/galaxy/rev/f520e80ac09c
changeset: 2980:f520e80ac09c
user: jeremy goecks <jeremy.goecks(a)emory.edu>
date: Fri Nov 06 19:04:13 2009 -0500
description:
Refactored grid code to (a) generalize numerous column types and (b) fully support multiple, arbitrary, multi-column categorical and free-text queries. Python code provides support for TextColumn and TagColumn objects, and grids_common.mako provides support for programmatically creating free text and categorical filtering UIs. History and HDA grids have been updated to use the refactored code.
diffstat:
lib/galaxy/model/__init__.py | 2 +-
lib/galaxy/web/controllers/dataset.py | 63 ++-------------
lib/galaxy/web/controllers/history.py | 129 +++++---------------------------
lib/galaxy/web/controllers/tag.py | 4 +-
lib/galaxy/web/framework/helpers/grids.py | 131 +++++++++++++++++++++++++++++++-
static/scripts/jquery.wymeditor.js | 92 ++++++++++++++++++++++-
static/wymeditor/lang/en.js | 6 +-
static/wymeditor/skins/galaxy/icons.png |
static/wymeditor/skins/galaxy/skin.css | 1 +
templates/dataset/grid.mako | 41 +---------
templates/grid_common.mako | 129 ++++++++++++++++++++++++++++++++
templates/history/grid.mako | 100 +-----------------------
12 files changed, 394 insertions(+), 304 deletions(-)
diffs (990 lines):
diff -r b54c37f53d53 -r f520e80ac09c lib/galaxy/model/__init__.py
--- a/lib/galaxy/model/__init__.py Fri Nov 06 16:52:00 2009 -0500
+++ b/lib/galaxy/model/__init__.py Fri Nov 06 19:04:13 2009 -0500
@@ -246,7 +246,7 @@
# This needs to be a list
return [ hda for hda in self.datasets if not hda.dataset.deleted ]
def get_display_name( self ):
- ## History name can be either a string or a unicode object. If string, convert to unicode object assuming 'utf-8' format.
+ """ History name can be either a string or a unicode object. If string, convert to unicode object assuming 'utf-8' format. """
history_name = self.name
if isinstance(history_name, str):
history_name = unicode(history_name, 'utf-8')
diff -r b54c37f53d53 -r f520e80ac09c lib/galaxy/web/controllers/dataset.py
--- a/lib/galaxy/web/controllers/dataset.py Fri Nov 06 16:52:00 2009 -0500
+++ b/lib/galaxy/web/controllers/dataset.py Fri Nov 06 19:04:13 2009 -0500
@@ -1,7 +1,6 @@
import logging, os, string, shutil, re, socket, mimetypes, smtplib, urllib
from galaxy.web.base.controller import *
-from galaxy.tags.tag_handler import TagHandler
from galaxy.web.framework.helpers import time_ago, iff, grids
from galaxy import util, datatypes, jobs, web, model
from cgi import escape, FieldStorage
@@ -49,55 +48,7 @@
class HistoryColumn( grids.GridColumn ):
def get_value( self, trans, grid, hda):
return hda.history.name
-
- class StatusColumn( grids.GridColumn ):
- def get_value( self, trans, grid, hda ):
- if hda.deleted:
- return "deleted"
- return ""
- def get_link( self, trans, grid, hda ):
- return None
- class TagsColumn( grids.GridColumn ):
- def __init__(self, col_name, key, filterable):
- grids.GridColumn.__init__(self, col_name, key=key, filterable=filterable)
- # Tags cannot be sorted.
- self.sortable = False
- self.tag_elt_id_gen = 0
- def get_value( self, trans, grid, hda ):
- self.tag_elt_id_gen += 1
- elt_id="tagging-elt" + str( self.tag_elt_id_gen )
- div_elt = "<div id=%s></div>" % elt_id
- return div_elt + trans.fill_template( "/tagging_common.mako", trans=trans, tagged_item=hda,
- elt_id = elt_id, in_form="true", input_size="20", tag_click_fn="add_tag_to_grid_filter" )
- def filter( self, db_session, query, column_filter ):
- """ Modify query to include only hdas with tags in column_filter. """
- if column_filter == "All":
- pass
- elif column_filter:
- # Parse filter to extract multiple tags.
- tag_handler = TagHandler()
- raw_tags = tag_handler.parse_tags( column_filter.encode("utf-8") )
- for name, value in raw_tags.items():
- tag = tag_handler.get_tag_by_name( db_session, name )
- if tag:
- query = query.filter( model.HistoryDatasetAssociation.tags.any( tag_id=tag.id ) )
- if value:
- query = query.filter( model.HistoryDatasetAssociation.tags.any( value=value.lower() ) )
- else:
- # Tag doesn't exist; unclear what to do here, but the literal thing to do is add the criterion, which
- # will then yield a query that returns no results.
- query = query.filter( model.HistoryDatasetAssociation.tags.any( user_tname=name ) )
- return query
- def get_accepted_filters( self ):
- """ Returns a list of accepted filters for this column. """
- accepted_filter_labels_and_vals = { "All": "All" }
- accepted_filters = []
- for label, val in accepted_filter_labels_and_vals.items():
- args = { self.key: val }
- accepted_filters.append( grids.GridColumnFilter( label, args) )
- return accepted_filters
-
class StatusColumn( grids.GridColumn ):
def get_value( self, trans, grid, hda ):
if hda.deleted:
@@ -118,19 +69,25 @@
template='/dataset/grid.mako'
default_sort_key = "-create_time"
columns = [
- grids.GridColumn( "Name", key="name",
+ grids.TextColumn( "Name", key="name", model_class=model.HistoryDatasetAssociation,
# Link name to dataset's history.
- link=( lambda item: iff( item.history.deleted, None, dict( operation="switch", id=item.id ) ) ) ),
+ link=( lambda item: iff( item.history.deleted, None, dict( operation="switch", id=item.id ) ) ), filterable="advanced" ),
HistoryColumn( "History", key="history",
link=( lambda item: iff( item.history.deleted, None, dict( operation="switch_history", id=item.id ) ) ) ),
- TagsColumn( "Tags", key="tags", filterable=True ),
+ grids.TagsColumn( "Tags", "tags", model.HistoryDatasetAssociation, model.HistoryDatasetAssociationTagAssociation, filterable="advanced" ),
StatusColumn( "Status", key="deleted", attach_popup=False ),
grids.GridColumn( "Created", key="create_time", format=time_ago ),
grids.GridColumn( "Last Updated", key="update_time", format=time_ago ),
]
+ columns.append(
+ grids.MulticolFilterColumn(
+ "Search",
+ cols_to_filter=[ columns[0], columns[2] ],
+ key="free-text-search", visible=False, filterable="default" )
+ )
operations = []
standard_filters = []
- default_filter = dict( deleted="False", tags="All" )
+ default_filter = dict( name="All", deleted="False", tags="All" )
preserve_state = False
use_paging = True
num_rows_per_page = 50
diff -r b54c37f53d53 -r f520e80ac09c lib/galaxy/web/controllers/history.py
--- a/lib/galaxy/web/controllers/history.py Fri Nov 06 16:52:00 2009 -0500
+++ b/lib/galaxy/web/controllers/history.py Fri Nov 06 19:04:13 2009 -0500
@@ -2,7 +2,6 @@
from galaxy.web.framework.helpers import time_ago, iff, grids
from galaxy import util
from galaxy.model.mapping import desc
-from galaxy.model import History
from galaxy.model.orm import *
from galaxy.util.json import *
from galaxy.util.odict import odict
@@ -19,30 +18,10 @@
class HistoryListGrid( grids.Grid ):
# Custom column types
- class NameColumn( grids.GridColumn ):
- def __init( self, key, link, attach_popup, filterable ):
- grids.GridColumn.__init__(self, key, link, attach_popup)
-
- def get_value( self, trans, grid, history ):
+ class NameColumn( grids.TextColumn ):
+ def get_value(self, trans, grid, history):
return history.get_display_name()
- def filter( self, db_session, query, column_filter ):
- """ Modify query to filter histories by name. """
- if column_filter == "All":
- pass
- elif column_filter:
- query = query.filter( func.lower( History.name ).like( "%" + column_filter.lower() + "%" ) )
- return query
- def get_accepted_filters( self ):
- """ Returns a list of accepted filters for this column. """
- accepted_filter_labels_and_vals = odict()
- accepted_filter_labels_and_vals["FREETEXT"] = "FREETEXT"
- accepted_filters = []
- for label, val in accepted_filter_labels_and_vals.iteritems():
- args = { self.key: val }
- accepted_filters.append( grids.GridColumnFilter( label, args) )
- return accepted_filters
-
class DatasetsByStateColumn( grids.GridColumn ):
def get_value( self, trans, grid, history ):
rval = []
@@ -53,6 +32,7 @@
else:
rval.append( '' )
return rval
+
class StatusColumn( grids.GridColumn ):
def get_value( self, trans, grid, history ):
if history.deleted:
@@ -66,44 +46,6 @@
if item.users_shared_with or item.importable:
return dict( operation="sharing" )
return None
-
- class TagsColumn( grids.GridColumn ):
- def __init__( self, col_name, key, filterable ):
- grids.GridColumn.__init__(self, col_name, key=key, filterable=filterable)
- # Tags cannot be sorted.
- self.sortable = False
- self.tag_elt_id_gen = 0
- def get_value( self, trans, grid, history ):
- self.tag_elt_id_gen += 1
- elt_id="tagging-elt" + str( self.tag_elt_id_gen )
- div_elt = "<div id=%s></div>" % elt_id
- return div_elt + trans.fill_template( "/tagging_common.mako", trans=trans, tagged_item=history,
- elt_id = elt_id, in_form="true", input_size="20", tag_click_fn="add_tag_to_grid_filter" )
- def filter( self, db_session, query, column_filter ):
- """ Modify query to filter histories by tag. """
- if column_filter == "All":
- pass
- elif column_filter:
- # Parse filter to extract multiple tags.
- tag_handler = TagHandler()
- raw_tags = tag_handler.parse_tags( column_filter.encode("utf-8") )
- for name, value in raw_tags.items():
- if name:
- # Search for tag names.
- query = query.filter( History.tags.any( func.lower( model.HistoryTagAssociation.user_tname ).like( "%" + name.lower() + "%" ) ) )
- if value:
- # Search for tag values.
- query = query.filter( History.tags.any( func.lower( model.HistoryTagAssociation.user_value ).like( "%" + value.lower() + "%" ) ) )
- return query
- def get_accepted_filters( self ):
- """ Returns a list of accepted filters for this column. """
- accepted_filter_labels_and_vals = odict()
- accepted_filter_labels_and_vals["FREETEXT"] = "FREETEXT"
- accepted_filters = []
- for label, val in accepted_filter_labels_and_vals.iteritems():
- args = { self.key: val }
- accepted_filters.append( grids.GridColumnFilter( label, args) )
- return accepted_filters
class DeletedColumn( grids.GridColumn ):
def get_accepted_filters( self ):
@@ -122,12 +64,12 @@
pass
elif column_filter:
if column_filter == "private":
- query = query.filter( History.users_shared_with == None )
- query = query.filter( History.importable == False )
+ query = query.filter( model.History.users_shared_with == None )
+ query = query.filter( model.History.importable == False )
elif column_filter == "shared":
- query = query.filter( History.users_shared_with != None )
+ query = query.filter( model.History.users_shared_with != None )
elif column_filter == "importable":
- query = query.filter( History.importable == True )
+ query = query.filter( model.History.importable == True )
return query
def get_accepted_filters( self ):
""" Returns a list of accepted filters for this column. """
@@ -141,43 +83,6 @@
args = { self.key: val }
accepted_filters.append( grids.GridColumnFilter( label, args) )
return accepted_filters
-
- class FreeTextSearchColumn( grids.GridColumn ):
- def filter( self, db_session, query, column_filter ):
- """ Modify query to search tags and history names. """
- if column_filter == "All":
- pass
- elif column_filter:
- # Build tags filter.
- tag_handler = TagHandler()
- raw_tags = tag_handler.parse_tags( column_filter.encode("utf-8") )
- tags_filter = None
- for name, value in raw_tags.items():
- if name:
- # Search for tag names.
- tags_filter = History.tags.any( func.lower( model.HistoryTagAssociation.user_tname ).like( "%" + name.lower() + "%" ) )
- if value:
- # Search for tag values.
- tags_filter = and_( tags_filter, func.lower( History.tags.any( model.HistoryTagAssociation.user_value ).like( "%" + value.lower() + "%" ) ) )
-
- # Build history name filter.
- history_name_filter = func.lower( History.name ).like( "%" + column_filter.lower() + "%" )
-
- # Apply filters to query.
- if tags_filter:
- query = query.filter( or_( tags_filter, history_name_filter ) )
- else:
- query = query.filter( history_name_filter )
- return query
- def get_accepted_filters( self ):
- """ Returns a list of accepted filters for this column. """
- accepted_filter_labels_and_vals = odict()
- accepted_filter_labels_and_vals["FREETEXT"] = "FREETEXT"
- accepted_filters = []
- for label, val in accepted_filter_labels_and_vals.iteritems():
- args = { self.key: val }
- accepted_filters.append( grids.GridColumnFilter( label, args) )
- return accepted_filters
# Grid definition
title = "Saved Histories"
@@ -185,19 +90,25 @@
template='/history/grid.mako'
default_sort_key = "-create_time"
columns = [
- NameColumn( "Name", key="name",
+ NameColumn( "Name", key="name", model_class=model.History,
link=( lambda history: iff( history.deleted, None, dict( operation="switch", id=history.id ) ) ),
- attach_popup=True, filterable=True ),
+ attach_popup=True, filterable="advanced" ),
DatasetsByStateColumn( "Datasets (by state)", ncells=4 ),
- TagsColumn( "Tags", key="tags", filterable=True),
+ grids.TagsColumn( "Tags", "tags", model.History, model.HistoryTagAssociation, filterable="advanced"),
StatusColumn( "Status", attach_popup=False ),
grids.GridColumn( "Created", key="create_time", format=time_ago ),
grids.GridColumn( "Last Updated", key="update_time", format=time_ago ),
# Columns that are valid for filtering but are not visible.
- DeletedColumn( "Deleted", key="deleted", visible=False, filterable=True ),
- SharingColumn( "Shared", key="shared", visible=False, filterable=True ),
- FreeTextSearchColumn( "Search", key="free-text-search", visible=False ) # Not filterable because it's the default search.
+ DeletedColumn( "Deleted", key="deleted", visible=False, filterable="advanced" ),
+ SharingColumn( "Shared", key="shared", visible=False, filterable="advanced" ),
]
+ columns.append(
+ grids.MulticolFilterColumn(
+ "Search",
+ cols_to_filter=[ columns[0], columns[2] ],
+ key="free-text-search", visible=False, filterable="default" )
+ )
+
operations = [
grids.GridOperation( "Switch", allow_multiple=False, condition=( lambda item: not item.deleted ) ),
grids.GridOperation( "Share", condition=( lambda item: not item.deleted ) ),
@@ -464,7 +375,7 @@
return
ac_data = ""
- for history in trans.sa_session.query( History ).filter_by( user=user ).filter( func.lower( History.name ) .like(q.lower() + "%") ):
+ for history in trans.sa_session.query( model.History ).filter_by( user=user ).filter( func.lower( model.History.name ) .like(q.lower() + "%") ):
ac_data = ac_data + history.name + "\n"
return ac_data
diff -r b54c37f53d53 -r f520e80ac09c lib/galaxy/web/controllers/tag.py
--- a/lib/galaxy/web/controllers/tag.py Fri Nov 06 16:52:00 2009 -0500
+++ b/lib/galaxy/web/controllers/tag.py Fri Nov 06 19:04:13 2009 -0500
@@ -105,7 +105,7 @@
# Build select statement.
cols_to_select = [ item_tag_assoc_class.table.c.tag_id, func.count('*') ]
- from_obj = item_tag_assoc_class.table.join(item_class.table).join(Tag)
+ from_obj = item_tag_assoc_class.table.join(item_class.table).join(Tag.table)
where_clause = and_(self._get_column_for_filtering_item_by_user_id(item_class)==trans.get_user().id,
Tag.table.c.name.like(q + "%"))
order_by = [ func.count("*").desc() ]
@@ -154,7 +154,7 @@
# Build select statement.
cols_to_select = [ item_tag_assoc_class.table.c.value, func.count('*') ]
- from_obj = item_tag_assoc_class.table.join(item_class.table).join(Tag)
+ from_obj = item_tag_assoc_class.table.join(item_class.table).join(Tag.table)
where_clause = and_(self._get_column_for_filtering_item_by_user_id(item_class)==trans.get_user().id,
Tag.table.c.id==tag.id,
item_tag_assoc_class.table.c.value.like(tag_value + "%"))
diff -r b54c37f53d53 -r f520e80ac09c lib/galaxy/web/framework/helpers/grids.py
--- a/lib/galaxy/web/framework/helpers/grids.py Fri Nov 06 16:52:00 2009 -0500
+++ b/lib/galaxy/web/framework/helpers/grids.py Fri Nov 06 19:04:13 2009 -0500
@@ -1,6 +1,7 @@
from galaxy.model import *
from galaxy.model.orm import *
+from galaxy.tags.tag_handler import TagHandler
from galaxy.web import url_for
from galaxy.util.json import from_json_string, to_json_string
@@ -87,18 +88,51 @@
column_filter = kwargs.get( "f-" + column.key )
elif column.key in base_filter:
column_filter = base_filter.get( column.key )
-
+
+ # Method (1) combines a mix of strings and lists of strings into a single string and (2) attempts to de-jsonify all strings.
+ def from_json_string_recurse(item):
+ decoded_list = []
+ if isinstance( item, basestring):
+ try:
+ # Not clear what we're decoding, so recurse to ensure that we catch everything.
+ decoded_item = from_json_string( item )
+ if isinstance( decoded_item, list):
+ decoded_list = from_json_string_recurse( decoded_item )
+ else:
+ decoded_list = [ str( decoded_item ) ]
+ except ValueError:
+ decoded_list = [ str( item ) ]
+ elif isinstance( item, list):
+ return_val = []
+ for element in item:
+ a_list = from_json_string_recurse( element )
+ decoded_list = decoded_list + a_list
+ return decoded_list
+
# If column filter found, apply it.
if column_filter is not None:
+ # TextColumns may have a mix of json and strings.
+ if isinstance( column, TextColumn ):
+ column_filter = from_json_string_recurse( column_filter )
+ if len( column_filter ) == 1:
+ column_filter = column_filter[0]
# Update query.
query = column.filter( trans.sa_session, query, column_filter )
# Upate current filter dict.
cur_filter_dict[ column.key ] = column_filter
- # Carry filter along to newly generated urls; make sure filter is a string so
+ # Carry filter along to newly generated urls; make sure filter is a string so
# that we can encode to UTF-8 and thus handle user input to filters.
- if not isinstance( column_filter, basestring ):
- column_filter = unicode(column_filter)
- extra_url_args[ "f-" + column.key ] = column_filter.encode("utf-8")
+ if isinstance( column_filter, list ):
+ # Filter is a list; process each item.
+ for filter in column_filter:
+ if not isinstance( filter, basestring ):
+ filter = unicode( filter ).encode("utf-8")
+ extra_url_args[ "f-" + column.key ] = to_json_string( column_filter )
+ else:
+ # Process singleton filter.
+ if not isinstance( column_filter, basestring ):
+ column_filter = unicode(column_filter)
+ extra_url_args[ "f-" + column.key ] = column_filter.encode("utf-8")
# Process sort arguments.
sort_key = sort_order = None
@@ -218,9 +252,12 @@
return query
class GridColumn( object ):
- def __init__( self, label, key=None, method=None, format=None, link=None, attach_popup=False, visible=True, ncells=1, filterable=False ):
+ def __init__( self, label, key=None, model_class=None, method=None, format=None, link=None, attach_popup=False, visible=True, ncells=1,
+ # Valid values for filterable are ['default', 'advanced', None]
+ filterable=None ):
self.label = label
self.key = key
+ self.model_class = model_class
self.method = method
self.format = format
self.link = link
@@ -265,6 +302,88 @@
args = { self.key: val }
accepted_filters.append( GridColumnFilter( val, args) )
return accepted_filters
+
+# Generic column that employs freetext and, hence, supports freetext, case-independent filtering.
+class TextColumn( GridColumn ):
+ def filter( self, db_session, query, column_filter ):
+ """ Modify query to filter using free text, case independence. """
+ if column_filter == "All":
+ pass
+ elif column_filter:
+ query = query.filter( self.get_filter( column_filter ) )
+ return query
+ def get_filter( self, column_filter ):
+ """ Returns a SQLAlchemy criterion derived from column_filter. """
+ # This is a pretty ugly way to get the key attribute of model_class. TODO: Can this be fixed?
+ model_class_key_field = eval( "self.model_class." + self.key )
+
+ if isinstance( column_filter, basestring ):
+ return func.lower( model_class_key_field ).like( "%" + column_filter.lower() + "%" )
+ elif isinstance( column_filter, list ):
+ composite_filter = True
+ for filter in column_filter:
+ composite_filter = and_( composite_filter, func.lower( model_class_key_field ).like( "%" + filter.lower() + "%" ) )
+ return composite_filter
+
+# Generic column that supports tagging.
+class TagsColumn( TextColumn ):
+ def __init__( self, col_name, key, model_class, model_tag_association_class, filterable ):
+ GridColumn.__init__(self, col_name, key=key, model_class=model_class, filterable=filterable)
+ self.model_tag_association_class = model_tag_association_class
+ # Tags cannot be sorted.
+ self.sortable = False
+ self.tag_elt_id_gen = 0
+ def get_value( self, trans, grid, item ):
+ self.tag_elt_id_gen += 1
+ elt_id="tagging-elt" + str( self.tag_elt_id_gen )
+ div_elt = "<div id=%s></div>" % elt_id
+ return div_elt + trans.fill_template( "/tagging_common.mako", trans=trans, tagged_item=item,
+ elt_id = elt_id, in_form="true", input_size="20", tag_click_fn="add_tag_to_grid_filter" )
+ def filter( self, db_session, query, column_filter ):
+ """ Modify query to filter model_class by tag. Multiple filters are ANDed. """
+ if column_filter == "All":
+ pass
+ elif column_filter:
+ query = query.filter( self.get_filter( column_filter ) )
+ return query
+ def get_filter( self, column_filter ):
+ # Parse filter to extract multiple tags.
+ tag_handler = TagHandler()
+ if isinstance( column_filter, list ):
+ # Collapse list of tags into a single string; this is redundant but effective. TODO: fix this by iterating over tags.
+ column_filter = ",".join( column_filter )
+ raw_tags = tag_handler.parse_tags( column_filter.encode("utf-8") )
+ filter = True
+ for name, value in raw_tags.items():
+ if name:
+ # Search for tag names.
+ filter = and_( filter, self.model_class.tags.any( func.lower( self.model_tag_association_class.user_tname ).like( "%" + name.lower() + "%" ) ) )
+ if value:
+ # Search for tag values.
+ filter = and_( filter, self.model_class.tags.any( func.lower( self.model_tag_association_class.user_value ).like( "%" + value.lower() + "%" ) ) )
+ return filter
+
+# Column that performs multicolumn filtering.
+class MulticolFilterColumn( TextColumn ):
+ def __init__( self, col_name, cols_to_filter, key, visible, filterable="default" ):
+ GridColumn.__init__( self, col_name, key=key, visible=visible, filterable=filterable)
+ self.cols_to_filter = cols_to_filter
+ def filter( self, db_session, query, column_filter ):
+ """ Modify query to filter model_class by tag. Multiple filters are ANDed. """
+ if column_filter == "All":
+ return query
+ if isinstance( column_filter, list):
+ composite_filter = True
+ for filter in column_filter:
+ part_composite_filter = False
+ for column in self.cols_to_filter:
+ part_composite_filter = or_( part_composite_filter, column.get_filter( filter ) )
+ composite_filter = and_( composite_filter, part_composite_filter )
+ else:
+ composite_filter = False
+ for column in self.cols_to_filter:
+ composite_filter = or_( composite_filter, column.get_filter( column_filter ) )
+ return query.filter( composite_filter )
class GridOperation( object ):
def __init__( self, label, key=None, condition=None, allow_multiple=True, allow_popup=True, target=None, url_args=None ):
diff -r b54c37f53d53 -r f520e80ac09c static/scripts/jquery.wymeditor.js
--- a/static/scripts/jquery.wymeditor.js Fri Nov 06 16:52:00 2009 -0500
+++ b/static/scripts/jquery.wymeditor.js Fri Nov 06 19:04:13 2009 -0500
@@ -295,6 +295,66 @@
});
+/*
+ Galaxy code that integrates into the WYM Editor.
+ */
+var Galaxy =
+{
+ /*
+ Galaxy constants for WYM Editor:
+ TOOLS - A string replaced by the galaxy toolbar's HTML.
+ TOOLS_ITEMS - A string replaced by the galaxy toolbar items.
+ INSERT_HISTORY - Command: open the insert history dialog.
+ INSERT_DATASET - Command: open the insert dataset dialog.
+ DIALOG_HISTORY - A dialog to insert a history.
+ DIALOG_DATASET - A dialog to insert a dataset.
+ */
+ TOOLS : "{Galaxy_Tools}",
+ TOOLS_ITEMS : "{Galaxy_Tools_Items}",
+ INSERT_HISTORY : "InsertHistory",
+ INSERT_DATASET : "InsertDataset",
+ DIALOG_HISTORY : "DialogHistory",
+ DIALOG_DATASET : "DialogDataset",
+
+ // Tool items overview.
+ toolsItems: [
+ {'name': "InsertHistory", 'title': 'History', 'css': 'galaxy_tools_insert_history_link'},
+ {'name': "InsertDataset", 'title': 'Dataset', 'css': 'galaxy_dataset'}
+ ],
+
+ // Tools HTML.
+ toolsHtml: "<div class='wym_tools wym_section'>"
+ + "<h2>" + this.TOOLS + "</h2>"
+ + "<ul>"
+ + this.TOOLS_ITEMS
+ + "</ul>"
+ + "</div>",
+
+ // Insert history dialog.
+ dialogHistoryHtml: "<body class='wym_dialog wym_dialog_history'"
+ + " onload='WYMeditor.INIT_DIALOG(" + WYMeditor.INDEX + ")'"
+ + ">"
+ + "<form>"
+ + "<fieldset>"
+ + "<input type='hidden' class='wym_dialog_type' value='"
+ + this.DIALOG_HISTORY
+ + "' />"
+ + "<legend>{Link}</legend>"
+ + "<div class='row'>"
+ + "<label>{Title}</label>"
+ + "<input type='text' class='wym_title' value='' size='40' />"
+ + "</div>"
+ + "<div class='row row-indent'>"
+ + "<input class='wym_submit' type='button'"
+ + " value='{Add}' />"
+ + "<input class='wym_cancel' type='button'"
+ + "value='{Cancel}' />"
+ + "</div>"
+ + "</fieldset>"
+ + "</form>"
+ + "</body>",
+};
+
/********** JQUERY **********/
@@ -354,6 +414,7 @@
+ "<div class='wym_area_right'>"
+ WYMeditor.CONTAINERS
+ WYMeditor.CLASSES
+ + Galaxy.TOOLS
+ "</div>"
+ "<div class='wym_area_main'>"
+ WYMeditor.HTML
@@ -384,6 +445,8 @@
+ "<h2>{Tools}</h2>"
+ "<ul>"
+ WYMeditor.TOOLS_ITEMS
+ // Add Galaxy Tools.
+ + Galaxy.TOOLS_ITEMS
+ "</ul>"
+ "</div>",
@@ -758,6 +821,7 @@
boxHtml = h.replaceAll(boxHtml, WYMeditor.LOGO, this._options.logoHtml);
boxHtml = h.replaceAll(boxHtml, WYMeditor.TOOLS, this._options.toolsHtml);
+ boxHtml = h.replaceAll(boxHtml, Galaxy.TOOLS, Galaxy.toolsHtml);
boxHtml = h.replaceAll(boxHtml, WYMeditor.CONTAINERS,this._options.containersHtml);
boxHtml = h.replaceAll(boxHtml, WYMeditor.CLASSES, this._options.classesHtml);
boxHtml = h.replaceAll(boxHtml, WYMeditor.HTML, this._options.htmlHtml);
@@ -781,6 +845,24 @@
}
boxHtml = h.replaceAll(boxHtml, WYMeditor.TOOLS_ITEMS, sTools);
+
+ // Construct Galaxy tools list.
+ var galaxyTools = eval(Galaxy.toolsItems);
+ sTools = "";
+ for(var i = 0; i < galaxyTools.length; i++) {
+ var galaxyTool = galaxyTools[i];
+ if(galaxyTool.name && galaxyTool.title) {
+ var sTool = this._options.toolsItemHtml;
+ var sTool = h.replaceAll(sTool, WYMeditor.TOOL_NAME, galaxyTool.name);
+ sTool = h.replaceAll(sTool, WYMeditor.TOOL_TITLE, this._options.stringDelimiterLeft
+ + galaxyTool.title
+ + this._options.stringDelimiterRight);
+ sTool = h.replaceAll(sTool, WYMeditor.TOOL_CLASS, galaxyTool.css);
+ sTools += sTool;
+ }
+ }
+
+ boxHtml = h.replaceAll(boxHtml, Galaxy.TOOLS_ITEMS, sTools);
//construct classes list
var aClasses = eval(this._options.classesItems);
@@ -947,6 +1029,10 @@
this.dialog(WYMeditor.PREVIEW, this._options.dialogFeaturesPreview);
break;
+ case Galaxy.INSERT_HISTORY:
+ this.dialog(Galaxy.DIALOG_HISTORY);
+ break;
+
default:
this._exec(cmd);
break;
@@ -1153,7 +1239,6 @@
* @description Opens a dialog box
*/
WYMeditor.editor.prototype.dialog = function( dialogType, dialogFeatures, bodyHtml ) {
-
var features = dialogFeatures || this._wym._options.dialogFeatures;
var wDialog = window.open('', 'dialog', features);
@@ -1178,11 +1263,13 @@
case(WYMeditor.PREVIEW):
sBodyHtml = this._options.dialogPreviewHtml;
break;
+ case(Galaxy.DIALOG_HISTORY):
+ sBodyHtml = Galaxy.dialogHistoryHtml;
+ break;
default:
sBodyHtml = bodyHtml;
}
-
var h = WYMeditor.Helper;
//construct the dialog
@@ -1197,7 +1284,6 @@
dialogHtml = h.replaceAll(dialogHtml, WYMeditor.INDEX, this._index);
dialogHtml = this.replaceStrings(dialogHtml);
-
var doc = wDialog.document;
doc.write(dialogHtml);
doc.close();
diff -r b54c37f53d53 -r f520e80ac09c static/wymeditor/lang/en.js
--- a/static/wymeditor/lang/en.js Fri Nov 06 16:52:00 2009 -0500
+++ b/static/wymeditor/lang/en.js Fri Nov 06 19:04:13 2009 -0500
@@ -40,6 +40,10 @@
Containers: 'Containers',
Classes: 'Classes',
Status: 'Status',
- Source_Code: 'Source code'
+ Source_Code: 'Source code',
+
+ // Galaxy replacements.
+ History: 'History',
+ Dataset: 'Dataset',
};
diff -r b54c37f53d53 -r f520e80ac09c static/wymeditor/skins/galaxy/icons.png
Binary file static/wymeditor/skins/galaxy/icons.png has changed
diff -r b54c37f53d53 -r f520e80ac09c static/wymeditor/skins/galaxy/skin.css
--- a/static/wymeditor/skins/galaxy/skin.css Fri Nov 06 16:52:00 2009 -0500
+++ b/static/wymeditor/skins/galaxy/skin.css Fri Nov 06 19:04:13 2009 -0500
@@ -109,6 +109,7 @@
.wym_skin_galaxy .wym_buttons li.wym_tools_paste a { background-position: 0 -552px;}
.wym_skin_galaxy .wym_buttons li.wym_tools_html a { background-position: 0 -193px;}
.wym_skin_galaxy .wym_buttons li.wym_tools_preview a { background-position: 0 -408px;}
+ .wym_skin_galaxy .wym_buttons li.galaxy_tools_insert_history_link a { background-position: 0 -622px;}
/*DECORATION*/
.wym_skin_galaxy .wym_section h2 { background: #f0f0f0; border: solid gray; border-width: 0 0 1px;}
diff -r b54c37f53d53 -r f520e80ac09c templates/dataset/grid.mako
--- a/templates/dataset/grid.mako Fri Nov 06 16:52:00 2009 -0500
+++ b/templates/dataset/grid.mako Fri Nov 06 19:04:13 2009 -0500
@@ -167,43 +167,12 @@
</style>
</%def>
-<div class="grid-header">
- <h2>${grid.title}</h2>
+<%namespace file="../grid_common.mako" import="*" />
- ## Print grid filter.
- <form name="dataset_actions" action="javascript:add_tag_to_grid_filter($('#input-tag-filter').attr('value'))" method="get" >
- <strong>Filter: </strong>
- %for column in grid.columns:
- %if column.filterable:
- <span> by ${column.label.lower()}:</span>
- ## For now, include special case to handle tags.
- %if column.key == "tags":
- %if cur_filter_dict[column.key] != "All":
- <span class="filter" "style='font-style: italic'">
- ${cur_filter_dict[column.key]}
- </span>
- <span>|</span>
- %endif
- <input id="input-tag-filter" name="f-tags" type="text" value="" size="15"/>
- <span>|</span>
- %endif
-
- ## Handle other columns.
- %for i, filter in enumerate( column.get_accepted_filters() ):
- %if i > 0:
- <span>|</span>
- %endif
- %if cur_filter_dict[column.key] == filter.args[column.key]:
- <span class="filter" "style='font-style: italic'">${filter.label}</span>
- %else:
- <span class="filter"><a href="${url( filter.get_url_args() )}">${filter.label}</a></span>
- %endif
- %endfor
- <span> </span>
- %endif
- %endfor
- </form>
-</div>
+## Print grid header.
+${render_grid_filters()}
+
+## Print grid.
<form name="dataset_actions" action="${url()}" method="post" >
<table class="grid">
<thead>
diff -r b54c37f53d53 -r f520e80ac09c templates/grid_common.mako
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/templates/grid_common.mako Fri Nov 06 19:04:13 2009 -0500
@@ -0,0 +1,129 @@
+<%! from galaxy.web.framework.helpers.grids import TextColumn, GridColumnFilter %>
+
+## Render a filter UI for a grid column. Filter is rendered as a table row.
+<%def name="render_grid_column_filter(column)">
+ <tr>
+ <%
+ column_label = column.label
+ if column.filterable == "advanced":
+ column_label = column_label.lower()
+ %>
+ <td align="left" style="padding-left: 10px">${column_label}:</td>
+ <td>
+ %if isinstance(column, TextColumn):
+ <form name="history_actions" action="${url( dict() )}"
+ method="get" >
+ ## Carry forward filtering criteria with hidden inputs.
+ %for temp_column in grid.columns:
+ %if temp_column.key in cur_filter_dict:
+ <% value = cur_filter_dict[ temp_column.key ] %>
+ %if value != "All":
+ <%
+ if isinstance( temp_column, TextColumn ):
+ value = h.to_json_string( value )
+ %>
+ <input type="hidden" id="${temp_column.key}" name="f-${temp_column.key}" value='${value}'/>
+ %endif
+ %endif
+ %endfor
+
+ ## Print current filtering criteria and links to delete.
+ %if column.key in cur_filter_dict:
+ <% column_filter = cur_filter_dict[column.key] %>
+ %if isinstance( column_filter, basestring ):
+ %if column_filter != "All":
+ <span style="font-style: italic">${cur_filter_dict[column.key]}</span>
+ <% filter_all = GridColumnFilter( "", { column.key : "All" } ) %>
+ <a href="${url( filter_all.get_url_args() )}"><img src="${h.url_for('/static/images/delete_tag_icon_gray.png')}"/></a>
+ |
+ %endif
+ %elif isinstance( column_filter, list ):
+ %for i, filter in enumerate( column_filter ):
+ %if i > 0:
+ ,
+ %endif
+ <span style="font-style: italic">${filter}</span>
+ <%
+ new_filter = list( column_filter )
+ del new_filter[ i ]
+ new_column_filter = GridColumnFilter( "", { column.key : h.to_json_string( new_filter ) } )
+ %>
+ <a href="${url( new_column_filter.get_url_args() )}"><img src="${h.url_for('/static/images/delete_tag_icon_gray.png')}"/></a>
+ %endfor
+
+ %endif
+ %endif
+ <span><input id="input-${column.key}-filter" name="f-${column.key}" type="text" value="" size="15"/></span>
+ </form>
+ %else:
+ %for i, filter in enumerate( column.get_accepted_filters() ):
+ %if i > 0:
+ <span>|</span>
+ %endif
+ %if cur_filter_dict[column.key] == filter.args[column.key]:
+ <span class="filter" style="font-style: italic">${filter.label}</span>
+ %else:
+ <span class="filter"><a href="${url( filter.get_url_args() )}">${filter.label}</a></span>
+ %endif
+ %endfor
+ %endif
+ </td>
+ </tr>
+</%def>
+
+## Print grid search/filtering UI.
+<%def name="render_grid_filters()">
+ <div class="grid-header">
+ <h2>${grid.title}</h2>
+
+ ## Default search.
+ <div>
+ <table><tr>
+ <td>
+ <table>
+ %for column in grid.columns:
+ %if column.filterable == "default":
+ ${render_grid_column_filter(column)}
+ %endif
+ %endfor
+ </table>
+ </td>
+ <td>
+ ##|
+ ##<% filter_all = GridColumnFilter( "", { column.key : "All" } ) %>
+ ##<a href="${url( filter_all.get_url_args() )}">Clear All</a>
+ | <a href="" onclick="javascript:$('#more-search-options').slideToggle('fast');return false;">Advanced Search</a>
+ </td>
+ </tr></table>
+ </div>
+
+
+ ## Advanced search.
+ <div id="more-search-options" style="display: none; padding-top: 5px">
+ <table style="border: 1px solid gray;">
+ <tr><td style="text-align: left" colspan="100">
+ Advanced Search |
+ <a href=""# onclick="javascript:$('#more-search-options').slideToggle('fast');return false;">Close</a> |
+ ## Link to clear all filters.
+ <%
+ no_filter = GridColumnFilter("Clear All", default_filter_dict)
+ %>
+ <a href="${url( no_filter.get_url_args() )}">${no_filter.label}</a>
+ </td></tr>
+ %for column in grid.columns:
+ %if column.filterable == "advanced":
+ ## Show div if current filter has value that is different from the default filter.
+ %if column.key in cur_filter_dict and column.key in default_filter_dict and \
+ cur_filter_dict[column.key] != default_filter_dict[column.key]:
+ <script type="text/javascript">
+ $('#more-search-options').css("display", "block");
+ </script>
+ %endif
+
+ ${render_grid_column_filter(column)}
+ %endif
+ %endfor
+ </table>
+ </div>
+ </div>
+</%def>
\ No newline at end of file
diff -r b54c37f53d53 -r f520e80ac09c templates/history/grid.mako
--- a/templates/history/grid.mako Fri Nov 06 16:52:00 2009 -0500
+++ b/templates/history/grid.mako Fri Nov 06 19:04:13 2009 -0500
@@ -1,4 +1,4 @@
-<%! from galaxy.web.framework.helpers.grids import GridColumnFilter %>
+<%! from galaxy.web.framework.helpers.grids import TextColumn, GridColumnFilter %>
<%inherit file="/base.mako"/>
<%def name="title()">${grid.title}</%def>
@@ -153,98 +153,12 @@
</style>
</%def>
-<div class="grid-header">
- <h2>${grid.title}</h2>
-
- ## Search box and more options filter at top of grid.
- <div>
- ## Grid search. TODO: use more elegant way to get free text search column.
- <% column = grid.columns[-1] %>
- <% use_form = False %>
- %for i, filter in enumerate( column.get_accepted_filters() ):
- %if i > 0:
- <span>|</span>
- %endif
- %if column.key in cur_filter_dict and cur_filter_dict[column.key] == filter.args[column.key]:
- <span class="filter" "style='font-style: italic'">${filter.label}</span>
- %elif filter.label == "FREETEXT":
- <form name="history_actions"
- action="javascript:add_condition_to_grid_filter($('#input-${column.key}-filter').attr('name'),$('#input-${column.key}-filter').attr('value'),false)"
- method="get" >
- ${column.label}:
- %if column.key in cur_filter_dict and cur_filter_dict[column.key] != "All":
- <span style="font-style: italic">${cur_filter_dict[column.key]}</span>
- <% filter_all = GridColumnFilter( "", { column.key : "All" } ) %>
- <a href="${url( filter_all.get_url_args() )}"><img src="${h.url_for('/static/images/delete_tag_icon_gray.png')}"/></a>
- |
- %endif
- <span><input id="input-${column.key}-filter" name="${column.key}" type="text" value="" size="15"/></span>
- <% use_form = True %>
- %else:
- <span class="filter"><a href="${url( filter.get_url_args() )}">${filter.label}</a></span>
- %endif
- %endfor
- | <a href="" onclick="javascript:$('#more-search-options').slideToggle('fast');return false;">Advanced Search</a>
- %if use_form:
- </form>
- %endif
- </div>
-
- ## Advanced Search
- <div id="more-search-options" style="display: none; padding-top: 5px">
- <table style="border: 1px solid gray;">
- <tr><td style="text-align: left" colspan="100">
- Advanced Search |
- <a href=""# onclick="javascript:$('#more-search-options').slideToggle('fast');return false;">Close</a> |
- ## Link to clear all filters.
- <%
- no_filter = GridColumnFilter("Clear All", default_filter_dict)
- %>
- <a href="${url( no_filter.get_url_args() )}">${no_filter.label}</a>
- </td></tr>
- %for column in grid.columns:
- %if column.filterable:
- <tr>
- ## Show div if current filter has value that is different from the default filter.
- %if cur_filter_dict[column.key] != default_filter_dict[column.key]:
- <script type="text/javascript">
- $('#more-search-options').css("display", "block");
- </script>
- %endif
- <td style="padding-left: 10px">${column.label.lower()}:</td>
- <td>
- <% use_form = False %>
- %for i, filter in enumerate( column.get_accepted_filters() ):
- %if i > 0:
- <span>|</span>
- %endif
- %if cur_filter_dict[column.key] == filter.args[column.key]:
- <span class="filter" style="font-style: italic">${filter.label}</span>
- %elif filter.label == "FREETEXT":
- <form name="history_actions" action="javascript:add_condition_to_grid_filter($('#input-${column.key}-filter').attr('name'),$('#input-${column.key}-filter').attr('value'),true)"
- method="get" >
- %if column.key in cur_filter_dict and cur_filter_dict[column.key] != "All":
- <span style="font-style: italic">${cur_filter_dict[column.key]}</span>
- <% filter_all = GridColumnFilter( "", { column.key : "All" } ) %>
- <a href="${url( filter_all.get_url_args() )}"><img src="${h.url_for('/static/images/delete_tag_icon_gray.png')}"/></a>
- |
- %endif
- <span><input id="input-${column.key}-filter" name="${column.key}" type="text" value="" size="15"/></span>
- <% use_form = True %>
- %else:
- <span class="filter"><a href="${url( filter.get_url_args() )}">${filter.label}</a></span>
- %endif
- %endfor
- %if use_form:
- </form>
- %endif
- </td>
- </tr>
- %endif
- %endfor
- </table>
- </div>
-</div>
+<%namespace file="../grid_common.mako" import="*" />
+
+## Print grid header.
+${render_grid_filters()}
+
+## Print grid.
<form name="history_actions" action="${url()}" method="post" >
<input type="hidden" name="page" value="${cur_page_num}">
<table class="grid">
1
0
details: http://www.bx.psu.edu/hg/galaxy/rev/4a7f9fdead89
changeset: 2976:4a7f9fdead89
user: Nate Coraor <nate(a)bx.psu.edu>
date: Fri Nov 06 14:22:44 2009 -0500
description:
Add Genetrack tools and display site
diffstat:
lib/galaxy/datatypes/tracks.py | 22 +-
lib/galaxy/web/controllers/genetrack.py | 293 --------------------------
tool-data/shared/genetrack/genetrack_sites.txt | 8 +-
tool_conf.xml.sample | 3 +
tools/visualization/genetrack.py | 189 -----------------
tools/visualization/genetrack.xml | 72 ------
tools/visualization/genetrack_code.py | 12 -
tools/visualization/genetrack_indexer.py | 39 +++
tools/visualization/genetrack_indexer.xml | 54 ++++
tools/visualization/genetrack_peak_prediction.py | 40 +++
tools/visualization/genetrack_peak_prediction.xml | 59 +++++
universe_wsgi.ini.sample | 3 +-
12 files changed, 214 insertions(+), 580 deletions(-)
diffs (871 lines):
diff -r 411b53d32b78 -r 4a7f9fdead89 lib/galaxy/datatypes/tracks.py
--- a/lib/galaxy/datatypes/tracks.py Fri Nov 06 09:57:05 2009 -0500
+++ b/lib/galaxy/datatypes/tracks.py Fri Nov 06 14:22:44 2009 -0500
@@ -20,26 +20,26 @@
class GeneTrack( data.Binary ):
file_ext = "genetrack"
- MetadataElement( name="hdf", default="data.hdf", desc="HDF DB", readonly=True, visible=True, no_value=0 )
- MetadataElement( name="sqlite", default="features.sqlite", desc="SQLite Features DB", readonly=True, visible=True, no_value=0 )
+ MetadataElement( name="genetrack", default="data.genetrack", desc="HDF index", readonly=True, visible=True, no_value=0 )
MetadataElement( name="label", default="Custom", desc="Track Label", readonly=True, visible=True, no_value="Custom" )
def __init__(self, **kwargs):
super( GeneTrack, self ).__init__( **kwargs )
- self.add_display_app( 'genetrack', 'View in GeneTrack', '', 'genetrack_link' )
+ self.add_display_app( 'genetrack', 'View in', '', 'genetrack_link' )
def get_display_links( self, dataset, type, app, base_url, target_frame='galaxy_main', **kwd ):
return data.Binary.get_display_links( self, dataset, type, app, base_url, target_frame=target_frame, **kwd )
def genetrack_link( self, hda, type, app, base_url ):
ret_val = []
if hda.has_data:
- # Get the disk file name
+ # Get the disk file name and data id
file_name = hda.dataset.get_file_name()
+ data_id = hda.dataset.id
# Make it secure
- a = hmac_new( app.config.tool_secret, file_name )
- b = binascii.hexlify( file_name )
- encoded_file_name = "%s:%s" % ( a, b )
- for site_name, site_url in util.get_genetrack_sites():
- if site_name in app.config.genetrack_display_sites:
- link = "%s?filename=%s" % ( site_url, encoded_file_name )
- ret_val.append( ( site_name, link ) )
+ hashkey = hmac_new( app.config.tool_secret, file_name )
+ encoded = binascii.hexlify( file_name )
+ for name, url in util.get_genetrack_sites():
+ if name.lower() in app.config.genetrack_display_sites:
+ # send both parameters filename and hashkey
+ link = "%s?filename=%s&hashkey=%s&id=%s&GALAXY_URL=%s" % ( url, encoded, hashkey, data_id, base_url )
+ ret_val.append( ( name, link ) )
return ret_val
diff -r 411b53d32b78 -r 4a7f9fdead89 lib/galaxy/web/controllers/genetrack.py
--- a/lib/galaxy/web/controllers/genetrack.py Fri Nov 06 09:57:05 2009 -0500
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,293 +0,0 @@
-import time, glob, os, sys
-from itertools import cycle
-from mako import exceptions
-from mako.template import Template
-from mako.lookup import TemplateLookup
-from galaxy.web.base.controller import *
-from galaxy.util.hash_util import *
-
-try:
- import pkg_resources
- pkg_resources.require("GeneTrack")
- import atlas
- from atlas import sql
- from atlas import hdf
- from atlas import util as atlas_utils
- from atlas.web import formlib, feature_query, feature_filter
- from atlas.web import label_cache as atlas_label_cache
- from atlas.plotting.const import *
- from atlas.plotting.tracks import prefab
- from atlas.plotting.tracks import chart
- from atlas.plotting import tracks
-except Exception, exc:
- raise ControllerUnavailable("GeneTrack could not import a required dependency: %s" % str(exc))
-
-pkg_resources.require( "Paste" )
-import paste.httpexceptions
-
-# Database helpers
-SHOW_LABEL_LIMIT = 10000
-
-def list_labels(session):
- """
- Returns a list of labels that will be plotted in order.
- """
- labels = sql.Label
- query = session.query(labels).order_by("-id")
- return query
-
-def open_databases( conf ):
- """
- A helper function that returns handles to the hdf and sql databases
- """
- db = hdf.hdf_open( conf.HDF_DATABASE, mode='r' )
- session = sql.get_session( conf.SQL_URI )
- return db, session
-
-def hdf_query(db, name, param, autosize=False ):
- """
- Schema specific hdf query.
- Note that returns data as columns not rows.
- """
- if not hdf.has_node(db=db, name=name):
- atlas.warn( 'missing label %s' % name )
- return [], [], [], []
- data = hdf.GroupData( db=db, name=name)
- istart, iend = data.get_indices(label=param.chrom, start=param.start, stop=param.end)
- table = data.get_table(label=param.chrom)
- if autosize:
- # attempts to reduce the number of points
- size = len( table.cols.ix[istart:iend] )
- step = max( [1, size/1200] )
- else:
- step = 1
-
- ix = table.cols.ix[istart:iend:step].tolist()
- wx = table.cols.wx[istart:iend:step].tolist()
- cx = table.cols.cx[istart:iend:step].tolist()
- ax = table.cols.ax[istart:iend:step].tolist()
- return ix, wx, cx, ax
-
-# Chart helpers
-def build_tracks( param, conf, data_label, fit_label, pred_label, strand, show=False ):
- """
- Builds tracks
- """
- # gets all the labels for a fast lookup
- label_cache = atlas_label_cache( conf )
-
- # get database handles for hdf and sql
- db, session = open_databases( conf )
-
- # fetching x and y coordinates for bar and fit (line) for
- # each strand plus (p), minus (m), all (a)
- bix, bpy, bmy, bay = hdf_query( db=db, name=data_label, param=param )
- fix, fpy, fmy, fay = hdf_query( db=db, name=fit_label, param=param )
-
- # close the hdf database
- db.close()
-
- # get all features within the range
- all = feature_query( session=session, param=param )
-
- # draws the barchart and the nucleosome chart below it
- if strand == 'composite':
- bar = prefab.composite_bartrack( fix=fix, fay=fay, bix=bix, bay=bay, param=param)
- else:
- bar = prefab.twostrand_bartrack( fix=fix, fmy=fmy, fpy=fpy, bix=bix, bmy=bmy, bpy=bpy, param=param)
-
- charts = list()
- charts.append( bar )
-
- return charts
-
-def feature_chart(param=None, session=None, label=None, label_dict={}, color=cycle( [LIGHT, WHITE] ) ):
- all = feature_filter(feature_query(session=session, param=param), name=label, kdict=label_dict)
- flipped = []
- for feature in all:
- if feature.strand == "-":
- feature.start, feature.end = feature.end, feature.start
- flipped.append(feature)
- opts = track_options(
- xscale=param.xscale, w=param.width, fgColor=PURPLE,
- show_labels=param.show_labels, ylabel=str(label),
- bgColor=color.next()
- )
- return [
- tracks.split_tracks(features=flipped, options=opts, split=param.show_labels, track_type='vector')
- ]
-
-def consolidate_charts( charts, param ):
- # create the multiplot
- opt = chart_options( w=param.width )
- multi = chart.MultiChart(options=opt, charts=charts)
- return multi
-
-# SETUP Track Builders
-import functools
-def twostrand_tracks( param=None, conf=None ):
- return build_tracks( data_label=conf.LABEL, fit_label=conf.FIT_LABEL, pred_label=conf.PRED_LABEL, param=param, conf=conf, strand='twostrand')
-def composite_tracks( param=None, conf=None ):
- return build_tracks( data_label=conf.LABEL, fit_label=conf.FIT_LABEL, pred_label=conf.PRED_LABEL, param=param, conf=conf, strand='composite')
-
-class BaseConf( object ):
- """
- Fake web_conf for atlas.
- """
- IMAGE_DIR = "static/genetrack/plots/"
- LEVELS = [str(x) for x in [ 50, 100, 250, 500, 1000, 2500, 5000, 10000, 20000, 50000, 100000, 200000 ]]
- ZOOM_LEVELS = zip(LEVELS, LEVELS)
- PLOT_SETUP = [
- ('comp-id', 'Composite' , 'genetrack/index.html', composite_tracks ),
- ('two-id' , 'Two Strand', 'genetrack/index.html', twostrand_tracks ),
- ]
- PLOT_CHOICES = [ (id, name) for (id, name, page, func) in PLOT_SETUP ]
- PLOT_MAPPER = dict( [ (id, (page, func)) for (id, name, page, func) in PLOT_SETUP ] )
-
- def __init__(self, **kwds):
- for key,value in kwds.items():
- setattr( self, key, value)
-
-class WebRoot(BaseController):
- @web.expose
- def search(self, trans, word='', dataset_id=None, submit=''):
- """
- Default search page
- """
- data = trans.sa_session.query( trans.app.model.HistoryDatasetAssociation ).get( dataset_id )
- if not data:
- raise paste.httpexceptions.HTTPRequestRangeNotSatisfiable( "Invalid reference dataset id: %s." % str( dataset_id ) )
- # the main configuration file
- conf = BaseConf(
- TITLE = "<i>%s</i>: %s" % (data.metadata.dbkey, data.metadata.label),
- HDF_DATABASE = os.path.join( data.extra_files_path, data.metadata.hdf ),
- SQL_URI = "sqlite:///%s" % os.path.join( data.extra_files_path, data.metadata.sqlite ),
- LABEL = data.metadata.label,
- FIT_LABEL = "%s-SIGMA-%d" % (data.metadata.label, 20),
- PRED_LABEL = "PRED-%s-SIGMA-%d" % (data.metadata.label, 20),
- )
-
- param = atlas.Param( word=word )
-
- # search for a given
- try:
- session = sql.get_session( conf.SQL_URI )
- except:
- return trans.fill_template_mako('genetrack/invalid.html', dataset_id=dataset_id)
-
- if param.word:
- def search_query( word, text ):
- query = session.query(sql.Feature).filter( "name LIKE :word or freetext LIKE :text" ).params(word=word, text=text)
- query = list(query[:20])
- return query
-
- # a little heuristics to match most likely target
- targets = [
- (param.word+'%', 'No match'), # match beginning
- ('%'+param.word+'%', 'No match'), # match name anywhere
- ('%'+param.word+'%', '%'+param.word+'%'), # match json anywhere
- ]
- for word, text in targets:
- query = search_query( word=word, text=text)
- if query:
- break
- else:
- query = []
-
- return trans.fill_template_mako('genetrack/search.html', param=param, query=query, dataset_id=dataset_id)
-
- @web.expose
- def index(self, trans, dataset_id=None, **kwds):
- """
- Main request handler
- """
- color = cycle( [LIGHT, WHITE] )
- data = trans.sa_session.query( trans.app.model.HistoryDatasetAssociation ).get( dataset_id )
- if not data:
- raise paste.httpexceptions.HTTPRequestRangeNotSatisfiable( "Invalid reference dataset id: %s." % str( dataset_id ) )
- # the main configuration file
- conf = BaseConf(
- TITLE = "<i>%s</i>: %s" % (data.metadata.dbkey, data.metadata.label),
- HDF_DATABASE = os.path.join( data.extra_files_path, data.metadata.hdf ),
- SQL_URI = "sqlite:///%s" % os.path.join( data.extra_files_path, data.metadata.sqlite ),
- LABEL = data.metadata.label,
- FIT_LABEL = "%s-SIGMA-%d" % (data.metadata.label, 20),
- PRED_LABEL = "PRED-%s-SIGMA-%d" % (data.metadata.label, 20),
- )
-
- try:
- session = sql.get_session( conf.SQL_URI )
- except:
- return trans.fill_template_mako('genetrack/invalid.html', dataset_id=dataset_id)
-
- if os.path.exists( conf.HDF_DATABASE ):
- db = hdf.hdf_open( conf.HDF_DATABASE, mode='r' )
- conf.CHROM_FIELDS = [(x,x) for x in hdf.GroupData(db=db, name=conf.LABEL).labels]
- db.close()
- else:
- query = session.execute(sql.select([sql.feature_table.c.chrom]).distinct())
- conf.CHROM_FIELDS = [(x.chrom,x.chrom) for x in query]
-
- # generate a new form based on the configuration
- form = formlib.main_form( conf )
-
- # clear the tempdir every once in a while
- atlas_utils.clear_tempdir( dir=conf.IMAGE_DIR, days=1, chance=10)
-
- incoming = form.defaults()
- incoming.update( kwds )
-
- # manage the zoom and pan requests
- incoming = formlib.zoom_change( kdict=incoming, levels=conf.LEVELS)
- incoming = formlib.pan_view( kdict=incoming )
-
- # process the form
- param = atlas.Param( **incoming )
- form.process( incoming )
-
- if kwds and form.isSuccessful():
- # adds the sucessfull parameters
- param.update( form.values() )
-
- # if it was a search word not a number go to search page
- try:
- center = int( param.feature )
- except ValueError:
- # go and search for these
- return trans.response.send_redirect( web.url_for( controller='genetrack', action='search', word=param.feature, dataset_id=dataset_id ) )
-
- param.width = min( [2000, int(param.img_size)] )
- param.xscale = [ param.start, param.end ]
- param.show_labels = ( param.end - param.start ) <= SHOW_LABEL_LIMIT
-
- # get the template and the function used to generate the tracks
- tmpl_name, track_maker = conf.PLOT_MAPPER[param.plot]
-
- # check against a hash, display an image that already exists if it was previously created.
- hash = new_secure_hash()
- hash.update(str(dataset_id))
- for key in sorted(kwds.keys()):
- hash.update(str(kwds[key]))
- fname = "%s.png" % hash.hexdigest()
- fpath = os.path.join(conf.IMAGE_DIR, fname)
-
- charts = []
- param.fname = fname
-
- # The SHA1 hash should uniquely identify the qs that created the plot...
- if os.path.exists(fpath):
- os.utime(fpath, (time.time(), time.time()))
- return trans.fill_template_mako(tmpl_name, conf=conf, form=form, param=param, dataset_id=dataset_id)
-
- # If the hashed filename doesn't exist, create it.
- if track_maker is not None and os.path.exists( conf.HDF_DATABASE ):
- # generate the fit track
- charts = track_maker( param=param, conf=conf )
-
- for label in list_labels( session ):
- charts.extend( feature_chart(param=param, session=session, label=label.name, label_dict={label.name:label.id}, color=color))
-
- track_chart = consolidate_charts( charts, param )
- track_chart.save(fname=fpath)
-
- return trans.fill_template_mako(tmpl_name, conf=conf, form=form, param=param, dataset_id=dataset_id)
diff -r 411b53d32b78 -r 4a7f9fdead89 tool-data/shared/genetrack/genetrack_sites.txt
--- a/tool-data/shared/genetrack/genetrack_sites.txt Fri Nov 06 09:57:05 2009 -0500
+++ b/tool-data/shared/genetrack/genetrack_sites.txt Fri Nov 06 14:22:44 2009 -0500
@@ -1,3 +1,7 @@
# GeneTrack sites
-main http://www.genetrack.org/
-test http://www.test.genetrack.org/
+#
+# The key(s) should be added to universe_wsgi.ini as the value of
+# genetrack_display_sites
+#
+# key site url
+psu_galaxy http://genetrack.g2.bx.psu.edu/galaxy
diff -r 411b53d32b78 -r 4a7f9fdead89 tool_conf.xml.sample
--- a/tool_conf.xml.sample Fri Nov 06 09:57:05 2009 -0500
+++ b/tool_conf.xml.sample Fri Nov 06 14:22:44 2009 -0500
@@ -125,6 +125,9 @@
<tool file="visualization/GMAJ.xml" />
<tool file="visualization/LAJ.xml" />
<tool file="visualization/build_ucsc_custom_track.xml" />
+ <tool file="visualization/genetrack_indexer.xml" />
+ <tool file="visualization/genetrack_peak_prediction.xml" />
+ </section>
</section>
<section name="Regional Variation" id="regVar">
<tool file="regVariation/windowSplitter.xml" />
diff -r 411b53d32b78 -r 4a7f9fdead89 tools/visualization/genetrack.py
--- a/tools/visualization/genetrack.py Fri Nov 06 09:57:05 2009 -0500
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,189 +0,0 @@
-#!/usr/bin/env python
-"""
-Run GeneTrack(atlas) with a faked conf file to generate GeneTrack data files.
-
-usage: %prog
- -l, --label=N: Data label for fit curve/peak plot
- -1, --fits=N/N/N/N/N,...: Data files (interval format) for fit curve/peak plot
- -2, --feats=N:M/N/N/N/N/N,...: Data files (interval format) for features.
- -d, --data=N: Output path for hdf5 and sqlite databases.
- -o, --output=N: Output path for export file.
-"""
-from galaxy import eggs
-import pkg_resources
-pkg_resources.require("GeneTrack")
-pkg_resources.require("bx-python")
-
-import commands as oscommands
-from atlas import commands
-from atlas import sql
-from bx.cookbook import doc_optparse
-from bx.intervals import io
-
-import os
-import tempfile
-from functools import partial
-
-SIGMA = 20
-WIDTH = 5 * SIGMA
-EXCLUSION_ZONE = 147
-
-def main(label, fit, feats, data_dir, output):
- os.mkdir(data_dir)
- conf = DummyConf(
- __name__=label,
- CLOBBER = True,
- DATA_SIZE = 3*10**6,
- MINIMUM_PEAK_SIZE = 0.1,
- LOADER_ENABLED = False,
- FITTER_ENABLED = False,
- PREDICTOR_ENABLED = False,
- EXPORTER_ENABLED = False,
- LOADER = loader,
- FITTER = fitter,
- PREDICTOR = predictor,
- EXPORTER = partial( commands.exporter, formatter=commands.bed_formatter),
- HDF_DATABASE = os.path.join( data_dir, "data.hdf" ),
- SQL_URI = "sqlite:///%s" % os.path.join( data_dir, "features.sqlite" ),
- SIGMA = SIGMA,
- WIDTH = WIDTH,
- DATA_LABEL = label,
- FIT_LABEL = "%s-SIGMA-%d" % ( label,SIGMA ),
- PEAK_LABEL = "PRED-%s-SIGMA-%d" % ( label,SIGMA ),
- EXCLUSION_ZONE = EXCLUSION_ZONE,
- LEFT_SHIFT = EXCLUSION_ZONE / 2,
- RIGHT_SHIFT = EXCLUSION_ZONE / 2,
- EXPORT_LABELS = [ "PRED-%s-SIGMA-%d" % ( label,SIGMA ) ],
- EXPORT_DIR = os.path.join( data_dir ),
- DATA_FILE=fit and fit[1] or None,
- fit=fit,
- feats=feats,
- )
- if fit:
- # Turn on fit processing.
- conf.LOADER_ENABLED = True,
- conf.FITTER_ENABLED = True,
- conf.PREDICTOR_ENABLED = True,
- conf.EXPORTER_ENABLED = True,
- for feat in feats:
- load_feature_files(conf, feats)
- commands.execute(conf)
- outname = "%s.%s.txt" % (conf.__name__, conf.EXPORT_LABELS[0] )
- if os.path.exists( os.path.join(data_dir, outname) ):
- os.rename( os.path.join(data_dir, outname), output)
-
-# mod454 seems to be a module without a package. The necessary funcitons are
-# stubbed out here until I'm sure of their final home. INS
-
-def loader( conf ):
- from atlas import hdf
- from mod454.schema import Mod454Schema as Schema
- last_chrom = table = None
- db = hdf.hdf_open( conf.HDF_DATABASE, mode='a', title='HDF database')
- gp = hdf.create_group( db=db, name=conf.DATA_LABEL, desc='data group', clobber=conf.CLOBBER )
- fit_meta = conf.fit[2]
- # iterate over the file and insert into table
- for line in open( conf.fit[1], "r" ):
- if line.startswith("chrom"): continue #Skip possible header
- if line.startswith("#"): continue
- fields = line.rstrip('\r\n').split('\t')
- chrom = fields[fit_meta.chromCol]
- if chrom != last_chrom:
- if table: table.flush()
- table = hdf.create_table( db=db, name=chrom, where=gp, schema=Schema, clobber=False )
- last_chrom = chrom
- try:
- position = int(fields[fit_meta.positionCol])
- forward = float(fields[fit_meta.forwardCol])
- reverse = fit_meta.reverseCol > -1 and float(fields[fit_meta.reverseCol]) or 0.0
- row = ( position, forward, reverse, forward+reverse, )
- table.append( [ row ] )
- except ValueError:
- # Ignore bad lines
- pass
- table.flush()
- db.close()
-
-def fitter( conf ):
- from mod454.fitter import fitter as mod454_fitter
- return mod454_fitter( conf )
-
-def predictor( conf ):
- from mod454.predictor import predictor as mod454_predictor
- return mod454_predictor( conf )
-
-def load_feature_files( conf, feats):
- """
- Loads features from file names
- """
- engine = sql.get_engine( conf.SQL_URI )
- sql.drop_indices(engine)
- conn = engine.connect()
- for label, fname, col_spec in feats:
- label_id = sql.make_label(engine, name=label, clobber=False)
- reader = io.NiceReaderWrapper( open(fname,"r"),
- chrom_col=col_spec.chromCol,
- start_col=col_spec.startCol,
- end_col=col_spec.endCol,
- strand_col=col_spec.strandCol,
- fix_strand=False )
- values = list()
- for interval in reader:
- print interval
- if not type( interval ) is io.GenomicInterval: continue
- row = {'label_id':label_id,
- 'name':col_spec.nameCol == -1 and "%s-%s" % (str(interval.start), str(interval.end)) or interval.fields[col_spec.nameCol],
- 'altname':"",
- 'chrom':interval.chrom,
- 'start':interval.start,
- 'end':interval.end,
- 'strand':interval.strand,
- 'value':0,
- 'freetext':""}
- values.append(row)
- insert = sql.feature_table.insert()
- conn.execute( insert, values)
- conn.close()
- sql.create_indices(engine)
-
-
-class Bunch( object ):
- def __init__(self, **kwargs):
- for key,value in kwargs.items():
- setattr( self, key, value )
-
-class DummyConf( Bunch ):
- """
- Fake conf module for genetrack/atlas.
- """
- pass
-
-if __name__ == "__main__":
- options, args = doc_optparse.parse( __doc__ )
- try:
- label = options.label
- if options.fits:
- fit_name, fit_meta = options.fits.split(':')[0], [int(x)-1 for x in options.fits.split(':')[1:]]
- fit_meta = Bunch(chromCol=fit_meta[0], positionCol=fit_meta[1], forwardCol=fit_meta[2], reverseCol=fit_meta[3])
- fit = ( label, fit_name, fit_meta, )
- else:
- fit = []
- # split apart the string into nested lists, preserves order
- if options.feats:
- feats = [ (
- feat_label,
- fname,
- Bunch(chromCol=int(chromCol)-1, startCol=int(startCol)-1, endCol=int(endCol)-1,
- strandCol=int(strandCol)-1, nameCol=int(nameCol)-1),
- )
- for feat_label, fname, chromCol, startCol, endCol, strandCol, nameCol
- in ( feat.split(':') for feat in options.feats.split(',') if len(feat) > 0 )]
- else:
- feats = []
- data_dir = options.data
- output = options.output
- except:
- doc_optparse.exception()
-
- main(label, fit, feats, data_dir, output)
-
diff -r 411b53d32b78 -r 4a7f9fdead89 tools/visualization/genetrack.xml
--- a/tools/visualization/genetrack.xml Fri Nov 06 09:57:05 2009 -0500
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,73 +0,0 @@
-<tool id="genetrack1" name="GeneTrack">
-
- <description>Track creator/viewer</description>
-
- <code file="genetrack_code.py">
- <hook exec_after_process="exec_after_process" />
- </code>
-
- <command interpreter="python">
- genetrack.py -l $data_label
- #if not str($fit_data) == "None"
- -1
- ${fit_data}:${fit_data.metadata.chromCol}:${fit_data.metadata.positionCol}:${fit_data.metadata.forwardCol}:${fit_data.metadata.reverseCol}
- #end if
- #if $feature_data
- -2
- #end if
- #for $data in $feature_data
- ${data.name}:${data.input}:${data.input.metadata.chromCol}:${data.input.metadata.startCol}:${data.input.metadata.endCol}:${data.input.metadata.strandCol}:${data.input.metadata.nameCol},
- #end for
- -d ${genetrack.files_path}
- -o ${bed_out}
- </command>
-
- <inputs>
- <param name="data_label" type="text" label="Track Label" size="50">
- <validator type="regex" message="Please name the track with only alphanumeric characters.">[a-zA-Z0-9]{1,25}</validator>
- </param>
- <param name="fit_data" type="data" format="coverage" label="Coverage Dataset (optional)" optional="true" />
- <repeat name="feature_data" title="Features">
- <param name="input" type="data" format="interval" label="Dataset" />
- <param name="name" type="text" label="Feature Type (mRNA, ESTs, ORFs, etc.)" size="25">
- <validator type="regex" message="Please name the feature with only alphanumeric characters.">[a-zA-Z0-9]{1,25}</validator>
- </param>
- </repeat>
- </inputs>
-
- <outputs>
- <data format="genetrack" name="genetrack" />
- <data format="bed" name="bed_out" />
- </outputs>
-
- <requirements>
- <requirement type="python-module">tables</requirement>
- <requirement type="python-module">atlas</requirement>
- <requirement type="python-module">pychartdir</requirement>
- <requirement type="python-module">numpy</requirement>
- </requirements>
- <help>
-This tool takes the input Fit Data and creates a peak and curve plot
-showing the reads and fitness on each base pair. Features can be
-plotted below as tracks. Fit data is coverage output from tools like
-the Lastz tool. Features are simply interval datasets that may be
-plotted as tracks below the optional fit data. Both the fit data and
-feature datasets are optional, but at least one of either is required
-to generate a track.
-
------
-
-**Syntax**
-
-- **Track Label** is the name of the generated track.
-
-- **Fit Data** is the dataset to calculate coverage/reads across
- base pairs and generate a curve. This is optional, and tracks may
- be created simply showing features.
-
-- **Features** are datasets (interval format) to be plotted as tracks.
- These are also optional, but at least 1 feature track or 1 fit
- data is required to generate a track.
-
-</help>
-</tool>
diff -r 411b53d32b78 -r 4a7f9fdead89 tools/visualization/genetrack_code.py
--- a/tools/visualization/genetrack_code.py Fri Nov 06 09:57:05 2009 -0500
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,12 +0,0 @@
-import os
-from galaxy import eggs
-from galaxy import jobs
-from galaxy.tools.parameters import DataToolParameter
-
-def exec_after_process(app, inp_data, out_data, param_dict, tool=None, stdout=None, stderr=None):
- """
- Copy data_label to genetrack.metadata.label
- """
- out_data['genetrack'].metadata.label = param_dict['data_label']
- out_data['genetrack'].info = "Use the link below to view the custom track."
- out_data['bed_out'].info = ""
diff -r 411b53d32b78 -r 4a7f9fdead89 tools/visualization/genetrack_indexer.py
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/tools/visualization/genetrack_indexer.py Fri Nov 06 14:22:44 2009 -0500
@@ -0,0 +1,39 @@
+#!/usr/bin/env python
+
+"""
+Wraps genetrack.scripts.tabs2genetrack so the tool can be executed from Galaxy.
+
+usage: %prog input output shift
+"""
+
+import sys
+from galaxy import eggs
+import pkg_resources
+pkg_resources.require( "GeneTrack" )
+
+from genetrack.scripts import tabs2genetrack
+from genetrack import logger
+
+if __name__ == "__main__":
+
+ parser = tabs2genetrack.option_parser()
+
+ options, args = parser.parse_args()
+
+ # uppercase the format
+ options.format = options.format.upper()
+
+ if options.format not in ('BED', 'GFF'):
+ sys.stdout = sys.stderr
+ parser.print_help()
+ sys.exit(-1)
+
+ logger.disable(options.verbosity)
+
+ # missing file names
+ if not (options.inpname and options.outname and options.format):
+ parser.print_help()
+ sys.exit(-1)
+ else:
+ tabs2genetrack.transform(inpname=options.inpname, outname=options.outname,\
+ format=options.format, shift=options.shift, index=options.index)
diff -r 411b53d32b78 -r 4a7f9fdead89 tools/visualization/genetrack_indexer.xml
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/tools/visualization/genetrack_indexer.xml Fri Nov 06 14:22:44 2009 -0500
@@ -0,0 +1,54 @@
+<tool id="bed2genetrack" name="Visualize BED file">
+
+ <description> - creates a visualization from a bed file</description>
+
+ <command interpreter="python">
+ genetrack_indexer.py -i $input -o $output -s $shift -v 0 -f BED -x
+ </command>
+
+ <inputs>
+
+ <param format="bed" name="input" type="data" help="Input data">
+ <label>Select input bed file</label>
+ </param>
+
+ <param name="shift" size="4" type="integer" value="0" help="distance in basepairs">
+ <label>Shift at 5' end</label>
+ </param>
+
+ <!-- this parameter is currently not used, may not be feasible to use it
+ <param name="coverage" type="select" label="Full coverage">
+ <option value="no">NO</option>
+ <option value="yes">YES</option>
+ </param>
+ -->
+
+ </inputs>
+
+ <outputs>
+ <data format="genetrack" name="output" />
+ </outputs>
+
+<help>
+**Help**
+
+This tool will create a visualization of the bed file that is selected.
+
+**Parameters**
+
+- **Shift at 5' end** should be used when the location of interest is at a fixed distance from
+ the 5' end for **all sequenced fragments**!
+
+ For example if the sequenced sample consists
+ mono-nucleosomal DNA (146bp) we should expect that
+ each nucleosome midpoint is located at 73 bp from the 5' end of the fragment.
+ Therefore we would enter 73 as the shift parameter. Once corrected the reads
+ on each strand will coincide and indicate the actual midpoints
+ of the nucleosomes.
+
+ When shifting the averaging process in GeneTrack is able correct for longer or shorter
+ than expected fragment sizes as long as the errors are reasonably random.
+
+</help>
+
+</tool>
diff -r 411b53d32b78 -r 4a7f9fdead89 tools/visualization/genetrack_peak_prediction.py
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/tools/visualization/genetrack_peak_prediction.py Fri Nov 06 14:22:44 2009 -0500
@@ -0,0 +1,40 @@
+#!/usr/bin/env python
+
+"""
+Wraps genetrack.scripts.peakpred so the tool can be executed from Galaxy.
+
+usage: %prog input output level sigma mode exclusion strand
+"""
+
+import sys
+from galaxy import eggs
+import pkg_resources
+pkg_resources.require( "GeneTrack" )
+
+from genetrack.scripts import peakpred
+from genetrack import logger
+
+if __name__ == "__main__":
+
+ parser = peakpred.option_parser()
+
+ options, args = parser.parse_args()
+
+ logger.disable(options.verbosity)
+
+ from genetrack import conf
+
+ # trigger test mode
+ if options.test:
+ options.inpname = conf.testdata('test-hdflib-input.gtrack')
+ options.outname = conf.testdata('predictions.bed')
+
+ # missing input file name
+ if not options.inpname and not options.outname:
+ parser.print_help()
+ else:
+ print 'Sigma = %s' % options.sigma
+ print 'Minimum peak = %s' % options.level
+ print 'Peak-to-peak = %s' % options.exclude
+
+ peakpred.predict(options.inpname, options.outname, options)
diff -r 411b53d32b78 -r 4a7f9fdead89 tools/visualization/genetrack_peak_prediction.xml
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/tools/visualization/genetrack_peak_prediction.xml Fri Nov 06 14:22:44 2009 -0500
@@ -0,0 +1,59 @@
+<tool id="predict2genetrack" name="Peak predictor">
+
+ <description> - generates peak predictions from an index file</description>
+
+ <command interpreter="python">
+ genetrack_peak_prediction.py -i $input -o $output --level=$level --sigma=$sigma --mode=$mode --exclusion=$exclusion --strand=$strand -v 0
+ </command>
+
+ <inputs>
+
+ <param format="genetrack" name="input" type="data" help="Input data" label="Select input data"/>
+
+ <param name="method" type="select" label="Smoothing method" help="The function used to average nearby read values">
+ <option value="gauss">Gaussian kernel</option>
+ <!-- <option value="yes">Moving averages</option> -->
+ </param>
+
+ <param name="sigma" size="4" type="integer" value="10" label="Smoothing factor" help="The interval over which each read is averaged" />
+
+
+ <param name="mode" type="select" label="Peak prediction" help="Peak prediction method">
+ <option value="nolap">Maximal non-overlapping</option>
+ <!-- <option value="above">Above a threshold</option> -->
+ <option value="all">All peaks</option>
+ </param>
+
+ <param name="exclusion" type="integer" size="4" value="0" help="The minimal distance between peaks" label="Peak-to-peak distance">
+ </param>
+
+ <param name="level" size="4" type="float" value="1" label="Threshold" help="Return only peaks above this value" />
+
+ <param name="strand" type="select" label="Strands" help="Combine strand data or predict on each strand separately">
+ <option value="all">Merge strands</option>
+ <!-- <option value="yes1">Above a threshold</option> -->
+ <option value="two">Separate strands</option>
+ </param>
+
+ </inputs>
+
+ <outputs>
+ <data format="bed" name="output" />
+ </outputs>
+
+<help>
+**Help**
+
+This tool will generate genome wide peak prediction from an index file.
+
+**Parameters**
+
+- **Smoothing method** the function used to average nearby values
+
+- **Smoothing value** the factor used in the method
+
+- **Prediction method** the function used to average nearby values
+
+</help>
+
+</tool>
diff -r 411b53d32b78 -r 4a7f9fdead89 universe_wsgi.ini.sample
--- a/universe_wsgi.ini.sample Fri Nov 06 09:57:05 2009 -0500
+++ b/universe_wsgi.ini.sample Fri Nov 06 14:22:44 2009 -0500
@@ -93,7 +93,8 @@
# Comma separated list of UCSC / gbrowse / GeneTrack browsers to use for viewing
ucsc_display_sites = main,test,archaea,ucla
gbrowse_display_sites = main,test,tair
-genetrack_display_sites = main,test
+# Define your GeneTrack servers in tool-data/shared/genetrack/genetrack_sites.txt
+#genetrack_display_sites =
# Serving static files (needed if running standalone)
static_enabled = True
1
0
07 Nov '09
details: http://www.bx.psu.edu/hg/galaxy/rev/52c3fa925dac
changeset: 2972:52c3fa925dac
user: Kanwei Li <kanwei(a)gmail.com>
date: Thu Nov 05 17:25:56 2009 -0500
description:
trackster: using overlapping tiles, fix feature names being cut off on the left
diffstat:
static/scripts/trackster.js | 29 +++++++++++++++++------------
static/trackster.css | 17 +++--------------
2 files changed, 20 insertions(+), 26 deletions(-)
diffs (142 lines):
diff -r 9561573441a4 -r 52c3fa925dac static/scripts/trackster.js
--- a/static/scripts/trackster.js Thu Nov 05 16:28:38 2009 -0500
+++ b/static/scripts/trackster.js Thu Nov 05 17:25:56 2009 -0500
@@ -189,8 +189,12 @@
if ( cached ) {
// console.log("cached tile " + tile_index);
var tile_low = tile_index * DENSITY * resolution;
+ var left = ( tile_low - low ) * w_scale;
+ if (this.left_offset) {
+ left -= this.left_offset;
+ }
cached.css( {
- left: ( tile_low - low ) * w_scale
+ left: left
});
// Our responsibility to move the element to the new parent
parent_element.append( cached );
@@ -364,6 +368,7 @@
this.showing_labels = false;
this.vertical_gap = 10;
this.base_color = "#2C3143";
+ this.left_offset = 200;
};
$.extend( FeatureTrack.prototype, TiledTrack.prototype, {
init: function() {
@@ -462,9 +467,9 @@
new_canvas.css({
position: "absolute",
top: 0,
- left: ( tile_low - this.view.low ) * w_scale
+ left: ( tile_low - this.view.low ) * w_scale - this.left_offset
});
- new_canvas.get(0).width = width;
+ new_canvas.get(0).width = width + this.left_offset;
new_canvas.get(0).height = height;
// console.log(( tile_low - this.view.low ) * w_scale, tile_index, w_scale);
var ctx = new_canvas.get(0).getContext("2d");
@@ -487,11 +492,11 @@
}
if (!this.showing_labels) {
// Non-detail levels
- ctx.fillRect(f_start, y_center + 5, f_end - f_start, 1);
+ ctx.fillRect(f_start + this.left_offset, y_center + 5, f_end - f_start, 1);
} else {
// Showing labels, blocks, details
- if (ctx.fillText) {
- ctx.fillText(feature.name, f_start - 1, y_center + 8);
+ if (ctx.fillText && feature.start > tile_low) {
+ ctx.fillText(feature.name, f_start - 1 + this.left_offset, y_center + 8);
// ctx.fillText(commatize(feature.start), f_start - 1, y_center + 8);
}
var blocks = feature.blocks;
@@ -503,7 +508,7 @@
} else if (feature.strand == "-") {
ctx.fillStyle = LEFT_STRAND;
}
- ctx.fillRect(f_start, y_center, f_end - f_start, 10);
+ ctx.fillRect(f_start + this.left_offset, y_center, f_end - f_start, 10);
ctx.fillStyle = this.base_color;
}
@@ -511,11 +516,11 @@
var block = blocks[k],
block_start = Math.floor( Math.max(0, (block[0] - tile_low) * w_scale) ),
block_end = Math.ceil( Math.min(width, (block[1] - tile_low) * w_scale) );
-
+ if (block_start > block_end) { continue; }
// Draw the block
thickness = 5;
y_start = 3;
- ctx.fillRect(block_start, y_center + y_start, block_end - block_start, thickness);
+ ctx.fillRect(block_start + this.left_offset, y_center + y_start, block_end - block_start, thickness);
if (thick_start && (block_start < thick_end || block_end > thick_start) ) {
thickness = 9;
@@ -523,7 +528,7 @@
var block_thick_start = Math.max(block_start, thick_start),
block_thick_end = Math.min(block_end, thick_end);
- ctx.fillRect(block_thick_start, y_center + y_start, block_thick_end - block_thick_start, thickness);
+ ctx.fillRect(block_thick_start + this.left_offset, y_center + y_start, block_thick_end - block_thick_start, thickness);
}
}
@@ -531,14 +536,14 @@
// If there are no blocks, we treat the feature as one big exon
thickness = 9;
y_start = 1;
- ctx.fillRect(f_start, y_center + y_start, f_end - f_start, thickness);
+ ctx.fillRect(f_start + this.left_offset, y_center + y_start, f_end - f_start, thickness);
if ( feature.strand ) {
if (feature.strand == "+") {
ctx.fillStyle = RIGHT_STRAND_INV;
} else if (feature.strand == "-") {
ctx.fillStyle = LEFT_STRAND_INV;
}
- ctx.fillRect(f_start, y_center, f_end - f_start, 10);
+ ctx.fillRect(f_start + this.left_offset, y_center, f_end - f_start, 10);
ctx.fillStyle = this.base_color;
}
}
diff -r 9561573441a4 -r 52c3fa925dac static/trackster.css
--- a/static/trackster.css Thu Nov 05 16:28:38 2009 -0500
+++ b/static/trackster.css Thu Nov 05 17:25:56 2009 -0500
@@ -25,7 +25,9 @@
font-size: 100%;
}
-/*canvas{ border-right: 1px solid red; } /* debugging */
+/*canvas{
+ border-left: 1px solid green;
+ border-right: 1px solid red; } /* debugging */
#nav {
padding: 0.5em 0;
background:#cccccc;
@@ -35,8 +37,6 @@
color:#333;font-weight:bold;
}
-
-
#nav-controls {
text-align: center;
}
@@ -51,17 +51,6 @@
-moz-border-radius: 1em;
}
-/*
-#low {
- margin-left: 0.1em;
- float: left;
-}
-#high {
- margin-right: 0.1em;
- float: right;
-}
-*/
-
#overview {
width: 100%;
margin: 0px;
1
0
details: http://www.bx.psu.edu/hg/galaxy/rev/071f12d75369
changeset: 2973:071f12d75369
user: James Taylor <james(a)jamestaylor.org>
date: Thu Nov 05 17:55:14 2009 -0500
description:
Fix for tools with multiple tests
diffstat:
test/functional/test_toolbox.py | 50 +++++++++++-------------
1 files changed, 23 insertions(+), 27 deletions(-)
diffs (104 lines):
diff -r 52c3fa925dac -r 071f12d75369 test/functional/test_toolbox.py
--- a/test/functional/test_toolbox.py Thu Nov 05 17:25:56 2009 -0500
+++ b/test/functional/test_toolbox.py Thu Nov 05 17:55:14 2009 -0500
@@ -10,11 +10,11 @@
class ToolTestCase( TwillTestCase ):
"""Abstract test case that runs tests based on a `galaxy.tools.test.ToolTest`"""
- def do_it( self ):
+ def do_it( self, testdef ):
# If the test generation had an error, raise
- if self.testdef.error:
- if self.testdef.exception:
- raise self.testdef.exception
+ if testdef.error:
+ if testdef.exception:
+ raise testdef.exception
else:
raise Exception( "Test parse failure" )
# Start with a new history
@@ -31,13 +31,13 @@
if len( self.get_history_as_data_list() ) > 0:
raise AssertionError("ToolTestCase.do_it failed")
# Upload any needed files
- for fname, extra in self.testdef.required_files:
+ for fname, extra in testdef.required_files:
self.upload_file( fname, ftype=extra.get( 'ftype', 'auto' ), dbkey=extra.get( 'dbkey', 'hg17' ) )
print "Uploaded file: ", fname, ", ftype: ", extra.get( 'ftype', 'auto' ), ", extra: ", extra
# We need to handle the case where we've uploaded a valid compressed file since the upload
# tool will have uncompressed it on the fly.
all_inputs = {}
- for name, value, _ in self.testdef.inputs:
+ for name, value, _ in testdef.inputs:
if value:
for end in [ '.zip', '.gz' ]:
if value.endswith( end ):
@@ -46,27 +46,25 @@
all_inputs[ name ] = value
# See if we have a grouping.Repeat element
repeat_name = None
- for input_name, input_value in self.testdef.tool.inputs_by_page[0].items():
+ for input_name, input_value in testdef.tool.inputs_by_page[0].items():
if isinstance( input_value, grouping.Repeat ):
repeat_name = input_name
break
# Do the first page
- page_inputs = self.__expand_grouping(self.testdef.tool.inputs_by_page[0], all_inputs)
+ page_inputs = self.__expand_grouping(testdef.tool.inputs_by_page[0], all_inputs)
# Run the tool
- self.run_tool( self.testdef.tool.id, repeat_name=repeat_name, **page_inputs )
+ self.run_tool( testdef.tool.id, repeat_name=repeat_name, **page_inputs )
print "page_inputs (0)", page_inputs
# Do other pages if they exist
- for i in range( 1, self.testdef.tool.npages ):
- page_inputs = self.__expand_grouping(self.testdef.tool.inputs_by_page[i], all_inputs)
+ for i in range( 1, testdef.tool.npages ):
+ page_inputs = self.__expand_grouping(testdef.tool.inputs_by_page[i], all_inputs)
self.submit_form( **page_inputs )
print "page_inputs (%i)" % i, page_inputs
# Check the result
- assert len( self.testdef.outputs ) == 1, "ToolTestCase does not deal with multiple outputs properly yet."
- for name, file in self.testdef.outputs:
+ assert len( testdef.outputs ) == 1, "ToolTestCase does not deal with multiple outputs properly yet."
+ for name, file in testdef.outputs:
self.verify_dataset_correctness( file )
self.delete_history( id=self.security.encode_id( latest_history.id ) )
- def shortDescription( self ):
- return self.name
def __expand_grouping( self, tool_inputs, declared_inputs, prefix='' ):
expanded_inputs = {}
@@ -103,15 +101,6 @@
expanded_inputs[value.name] = declared_inputs[value.name]
return expanded_inputs
-def get_case( testdef, name ):
- """Dynamically generate a `ToolTestCase` for `testdef`"""
- n = "TestForTool_" + testdef.tool.id.replace( ' ', '_' )
- s = ( ToolTestCase, )
- def test_tool( self ):
- self.do_it()
- d = dict( testdef=testdef, test_tool=test_tool, name=name )
- return new.classobj( n, s, d )
-
def build_tests():
"""
If the module level variable `toolbox` is set, generate `ToolTestCase`
@@ -125,7 +114,14 @@
for i, tool_id in enumerate( toolbox.tools_by_id ):
tool = toolbox.tools_by_id[ tool_id ]
if tool.tests:
+ # Create a new subclass of ToolTestCase dynamically adding methods
+ # names test_tool_XXX that run each test defined in the tool.
+ n = "TestForTool_" + tool.id.replace( ' ', '_' )
+ s = ( ToolTestCase, )
+ d = dict()
for j, testdef in enumerate( tool.tests ):
- name = "%s ( %s ) > %s" % ( tool.name, tool.id, testdef.name )
- testcase = get_case( testdef, name )
- G[ testcase.__name__ ] = testcase
+ def test_tool( self ):
+ self.do_it( testdef )
+ test_tool.__doc__ = "%s ( %s ) > %s" % ( tool.name, tool.id, testdef.name )
+ d['test_tool_%06d' % j] = test_tool
+ G[ n ] = new.classobj( n, s, d )
1
0
07 Nov '09
details: http://www.bx.psu.edu/hg/galaxy/rev/12518f99a2a7
changeset: 2974:12518f99a2a7
user: James Taylor <james(a)jamestaylor.org>
date: Fri Nov 06 00:25:02 2009 -0500
description:
Fix closure in creation of generated test methods, otherwise the last testdef is used for every test
diffstat:
test/functional/test_toolbox.py | 11 +++++++----
1 files changed, 7 insertions(+), 4 deletions(-)
diffs (19 lines):
diff -r 071f12d75369 -r 12518f99a2a7 test/functional/test_toolbox.py
--- a/test/functional/test_toolbox.py Thu Nov 05 17:55:14 2009 -0500
+++ b/test/functional/test_toolbox.py Fri Nov 06 00:25:02 2009 -0500
@@ -120,8 +120,11 @@
s = ( ToolTestCase, )
d = dict()
for j, testdef in enumerate( tool.tests ):
- def test_tool( self ):
- self.do_it( testdef )
- test_tool.__doc__ = "%s ( %s ) > %s" % ( tool.name, tool.id, testdef.name )
- d['test_tool_%06d' % j] = test_tool
+ def make_test_method( td ):
+ def test_tool( self ):
+ self.do_it( td )
+ return test_tool
+ m = make_test_method( testdef )
+ m.__doc__ = "%s ( %s ) > %s" % ( tool.name, tool.id, testdef.name )
+ d['test_tool_%06d' % j] = m
G[ n ] = new.classobj( n, s, d )
1
0
07 Nov '09
details: http://www.bx.psu.edu/hg/galaxy/rev/411b53d32b78
changeset: 2975:411b53d32b78
user: Kelly Vincent <kpvincent(a)bx.psu.edu>
date: Fri Nov 06 09:57:05 2009 -0500
description:
Fixed BWA wrapper tests (inputs need to be specified fastqsanger because there's no longer a sniff method for that type)
diffstat:
tools/sr_mapping/bwa_wrapper.xml | 18 +++++++++---------
1 files changed, 9 insertions(+), 9 deletions(-)
diffs (70 lines):
diff -r 12518f99a2a7 -r 411b53d32b78 tools/sr_mapping/bwa_wrapper.xml
--- a/tools/sr_mapping/bwa_wrapper.xml Fri Nov 06 00:25:02 2009 -0500
+++ b/tools/sr_mapping/bwa_wrapper.xml Fri Nov 06 09:57:05 2009 -0500
@@ -161,7 +161,7 @@
<param name="refGenomeSource" value="indexed" />
<param name="indices" value="phiX" />
<param name="sPaired" value="single" />
- <param name="input1" value="bwa_wrapper_in1.fastq" />
+ <param name="input1" value="bwa_wrapper_in1.fastq" ftype="fastqsanger" />
<param name="source_select" value="pre_set" />
<param name="suppressHeader" value="true" />
<output name="output" file="bwa_wrapper_out0.sam" ftype="sam" />
@@ -171,7 +171,7 @@
<param name="refGenomeSource" value="history" />
<param name="ownFile" value="phiX.fa" />
<param name="sPaired" value="single" />
- <param name="input1" value="bwa_wrapper_in0.fastq" />
+ <param name="input1" value="bwa_wrapper_in0.fastq" ftype="fastqsanger" />
<param name="source_select" value="pre_set" />
<param name="suppressHeader" value="true" />
<output name="output" file="bwa_wrapper_out0b.sam" ftype="sam" />
@@ -181,7 +181,7 @@
<param name="refGenomeSource" value="indexed" />
<param name="indices" value="phiX" />
<param name="sPaired" value="single" />
- <param name="input1" value="bwa_wrapper_in2.fastq" />
+ <param name="input1" value="bwa_wrapper_in2.fastq" ftype="fastqsanger" />
<param name="source_select" value="full" />
<param name="maxEditDist" value="0" />
<param name="fracMissingAligns" value="0.04" />
@@ -208,8 +208,8 @@
<param name="refGenomeSource" value="indexed" />
<param name="indices" value="phiX" />
<param name="sPaired" value="paired" />
- <param name="input1" value="bwa_wrapper_in3.fastq" />
- <param name="input2" value="bwa_wrapper_in4.fastq" />
+ <param name="input1" value="bwa_wrapper_in3.fastq" ftype="fastqsanger" />
+ <param name="input2" value="bwa_wrapper_in4.fastq" ftype="fastqsanger" />
<param name="source_select" value="full" />
<param name="maxEditDist" value="0" />
<param name="fracMissingAligns" value="0.04" />
@@ -236,7 +236,7 @@
<param name="refGenomeSource" value="indexed" />
<param name="indices" value="phiX" />
<param name="sPaired" value="single" />
- <param name="input1" value="bwa_wrapper_in1.fastq" />
+ <param name="input1" value="bwa_wrapper_in1.fastq" ftype="fastqsanger" />
<param name="source_select" value="full" />
<param name="maxEditDist" value="0" />
<param name="fracMissingAligns" value="0.04" />
@@ -263,8 +263,8 @@
<param name="refGenomeSource" value="indexed" />
<param name="indices" value="phiX" />
<param name="sPaired" value="paired" />
- <param name="input1" value="bwa_wrapper_in5.fastq" />
- <param name="input2" value="bwa_wrapper_in6.fastq" />
+ <param name="input1" value="bwa_wrapper_in5.fastq" ftype="fastqsanger" />
+ <param name="input2" value="bwa_wrapper_in6.fastq" ftype="fastqsanger" />
<param name="source_select" value="full" />
<param name="maxEditDist" value="0" />
<param name="fracMissingAligns" value="0.04" />
@@ -285,7 +285,7 @@
<param name="maxOccurPairing" value="100000" />
<param name="suppressHeader" value="true" />
<output name="output" file="bwa_wrapper_out4.sam" ftype="sam" />
- </test>
+ </test>
</tests>
<help>
1
0
07 Nov '09
details: http://www.bx.psu.edu/hg/galaxy/rev/731875ce0a36
changeset: 2970:731875ce0a36
user: rc
date: Thu Nov 05 14:19:45 2009 -0500
description:
Refactored the new address functional test
diffstat:
lib/galaxy/web/controllers/user.py | 4 ++++
test/base/twilltestcase.py | 17 +++++++++++++++++
test/functional/test_forms_and_requests.py | 8 +-------
3 files changed, 22 insertions(+), 7 deletions(-)
diffs (66 lines):
diff -r c6a8bd78357a -r 731875ce0a36 lib/galaxy/web/controllers/user.py
--- a/lib/galaxy/web/controllers/user.py Thu Nov 05 10:39:59 2009 -0500
+++ b/lib/galaxy/web/controllers/user.py Thu Nov 05 14:19:45 2009 -0500
@@ -680,6 +680,8 @@
widget=TextField( 'institution', 40, '' ) ) )
widgets.append(dict(label='Address Line 1',
widget=TextField( 'address1', 40, '' ) ) )
+ widgets.append(dict(label='Address Line 2',
+ widget=TextField( 'address2', 40, '' ) ) )
widgets.append(dict(label='City',
widget=TextField( 'city', 40, '' ) ) )
widgets.append(dict(label='State',
@@ -762,6 +764,8 @@
widget=TextField( 'institution', 40, user_address.institution ) ) )
widgets.append(dict(label='Address Line 1',
widget=TextField( 'address1', 40, user_address.address ) ) )
+ widgets.append(dict(label='Address Line 2',
+ widget=TextField( 'address2', 40, '' ) ) )
widgets.append(dict(label='City',
widget=TextField( 'city', 40, user_address.city ) ) )
widgets.append(dict(label='State',
diff -r c6a8bd78357a -r 731875ce0a36 test/base/twilltestcase.py
--- a/test/base/twilltestcase.py Thu Nov 05 10:39:59 2009 -0500
+++ b/test/base/twilltestcase.py Thu Nov 05 14:19:45 2009 -0500
@@ -1281,6 +1281,23 @@
tc.fv( "1", "comment", comment )
tc.submit( "add_event_button" )
self.check_page_for_string( new_state_name )
+ def add_user_address( self, user_id, address_dict ):
+ self.home()
+ self.visit_url( "%s/user/new_address?admin_view=False&user_id=%i" % ( self.url, user_id ) )
+ self.check_page_for_string( 'New address' )
+ for field_name, value in address_dict.items():
+ tc.fv( "1", field_name, value )
+ tc.submit( "save_new_address_button" )
+ self.check_page_for_string( 'Address <b>%s</b> has been added' % address_dict[ 'short_desc' ] )
+ def add_user_address_as_admin( self, user_id, address_dict ):
+ self.home()
+ self.visit_url( "%s/user/new_address?admin_view=True&user_id=%i" % ( self.url, user_id ) )
+ self.check_page_for_string( 'New address' )
+ for field_name, value in address_dict.items():
+ tc.fv( "1", field_name, value )
+ tc.submit( "save_new_address_button" )
+ self.check_page_for_string( 'Address <b>%s</b> has been added' % address_dict[ 'short_desc' ] )
+
# Library stuff
def create_library( self, name='Library One', description='This is Library One' ):
"""Create a new library"""
diff -r c6a8bd78357a -r 731875ce0a36 test/functional/test_forms_and_requests.py
--- a/test/functional/test_forms_and_requests.py Thu Nov 05 10:39:59 2009 -0500
+++ b/test/functional/test_forms_and_requests.py Thu Nov 05 14:19:45 2009 -0500
@@ -168,13 +168,7 @@
# create address
self.logout()
self.login( email='test1(a)bx.psu.edu' )
- self.home()
- url_str = '%s/user/new_address?short_desc=%s&name=%s&institution=%s&address1=%s&address2=%s&city=%s&state=%s&postal_code=%s&country=%s&phone=%s' \
- % ( self.url, address1[ 'short_desc' ], address1[ 'name' ], address1[ 'institution' ],
- address1[ 'address1' ], address1[ 'address2' ], address1[ 'city' ], address1[ 'state' ],
- address1[ 'postal_code' ], address1[ 'country' ], address1[ 'phone' ] )
- self.visit_url( url_str )
- self.check_page_for_string( 'Address <b>%s</b> has been added' % address1[ 'short_desc' ] )
+ self.add_user_address( regular_user1.id, address1 )
global regular_user
regular_user = sa_session.query( galaxy.model.User ) \
.filter( galaxy.model.User.table.c.email=='test1(a)bx.psu.edu' ) \
1
0