1 new commit in galaxy-central:
https://bitbucket.org/galaxy/galaxy-central/changeset/c6e1ef62c40b/
changeset: c6e1ef62c40b
user: jgoecks
date: 2012-08-09 23:32:47
summary: Data providers: unified and comprehensive handling of differences between different chromosome naming schemes.
affected #: 1 file
diff -r 3b5db939aebe61addd6f0b8d0c14267cf16c4144 -r c6e1ef62c40b6c212210356fa59222b60645070b lib/galaxy/visualization/tracks/data_providers.py
--- a/lib/galaxy/visualization/tracks/data_providers.py
+++ b/lib/galaxy/visualization/tracks/data_providers.py
@@ -44,6 +44,21 @@
if read[ end_pos_index ] > max_high:
max_high = read[ end_pos_index ]
return max_low, max_high
+
+def _convert_between_ucsc_and_ensemble_naming( chrom ):
+ '''
+ Convert between UCSC chromosome ('chr1') naming conventions and Ensembl
+ naming conventions ('1')
+ '''
+ if chrom.startswith( 'chr' ):
+ # Convert from UCSC to Ensembl
+ return chrom[ 3: ]
+ else:
+ # Convert from Ensembl to UCSC
+ return 'chr' + chrom
+
+def _chrom_naming_matches( chrom1, chrom2 ):
+ return ( chrom1.startswith( 'chr' ) and chrom2.startswith( 'chr' ) ) or ( not chrom1.startswith( 'chr' ) and not chrom2.startswith( 'chr' ) )
class TracksDataProvider( object ):
""" Base class for tracks data providers. """
@@ -159,7 +174,7 @@
return filters
def get_default_max_vals( self ):
- return 5000;
+ return 5000
#
# -- Base mixins and providers --
@@ -262,12 +277,9 @@
tabix = ctabix.Tabixfile(bgzip_fname, index_filename=self.converted_dataset.file_name)
- # If chrom is not found in indexes, try removing the first three
- # characters (e.g. 'chr') and see if that works. This enables the
- # provider to handle chrome names defined as chrXXX and as XXX.
- chrom = str(chrom)
- if chrom not in tabix.contigs and chrom.startswith("chr") and (chrom[3:] in tabix.contigs):
- chrom = chrom[3:]
+ # If chrom not in data, try alternative.
+ if chrom not in tabix.contigs:
+ chrom = _convert_between_ucsc_and_ensemble_naming( chrom )
return tabix.fetch(reference=chrom, start=start, end=end)
@@ -409,11 +421,6 @@
rval.append( payload )
continue
- # Simpler way to add stuff, but type casting is not done.
- # Name, score, strand, thick start, thick end.
- #end = min( len( feature ), 8 )
- #payload.extend( feature[ 3:end ] )
-
# Name, strand, thick start, thick end.
if length >= 4:
payload.append(feature[3])
@@ -470,6 +477,14 @@
"""
def get_iterator( self, chrom=None, start=None, end=None ):
+ # Read first line in order to match chrom naming format.
+ line = source.readline()
+ dataset_chrom = line.split()[0]
+ if not _chrom_naming_matches( chrom, dataset_chrom ):
+ chrom = _convert_between_ucsc_and_ensemble_naming( chrom )
+ # Undo read.
+ source.seek( 0 )
+
def line_filter_iter():
for line in open( self.original_dataset.file_name ):
if line.startswith( "track" ) or line.startswith( "browser" ):
@@ -483,6 +498,7 @@
or ( end is not None and feature_end < start ):
continue
yield line
+
return line_filter_iter()
#
@@ -601,6 +617,14 @@
"""
def get_iterator( self, chrom, start, end ):
+ # Read first line in order to match chrom naming format.
+ line = source.readline()
+ dataset_chrom = line.split()[0]
+ if not _chrom_naming_matches( chrom, dataset_chrom ):
+ chrom = _convert_between_ucsc_and_ensemble_naming( chrom )
+ # Undo read.
+ source.seek( 0 )
+
def line_filter_iter():
for line in open( self.original_dataset.file_name ):
if line.startswith("#"):
@@ -616,6 +640,7 @@
if variant_chrom != chrom or variant_start > end or variant_end < start:
continue
yield line
+
return line_filter_iter()
class SummaryTreeDataProvider( TracksDataProvider ):
@@ -639,15 +664,11 @@
st = summary_tree_from_file( self.converted_dataset.file_name )
self.CACHE[filename] = st
- # If chrom is not found in blocks, try removing the first three
- # characters (e.g. 'chr') and see if that works. This enables the
- # provider to handle chrome names defined as chrXXX and as XXX.
- if chrom in st.chrom_blocks:
- pass
- elif chrom[3:] in st.chrom_blocks:
- chrom = chrom[3:]
- else:
- return None
+ # Look for chrom in tree using both naming conventions.
+ if chrom not in st.chrom_blocks:
+ chrom = _convert_between_ucsc_and_ensemble_naming( chrom )
+ if chrom not in st.chrom_blocks:
+ return None
# Get or compute level.
if level:
@@ -684,7 +705,7 @@
self.CACHE[filename] = st
# Check for data.
- return st.chrom_blocks.get(chrom, None) is not None or (chrom and st.chrom_blocks.get(chrom[3:], None) is not None)
+ return st.chrom_blocks.get(chrom, None) or st.chrom_blocks.get(_convert_between_ucsc_and_ensemble_naming(chrom), None)
class BamDataProvider( TracksDataProvider, FilterableMixin ):
"""
@@ -727,13 +748,11 @@
try:
data = bamfile.fetch(start=start, end=end, reference=chrom)
except ValueError, e:
- # Some BAM files do not prefix chromosome names with chr, try without
- if chrom.startswith( 'chr' ):
- try:
- data = bamfile.fetch( start=start, end=end, reference=chrom[3:] )
- except ValueError:
- return None
- else:
+ # Try alternative chrom naming.
+ chrom = _convert_between_ucsc_and_ensemble_naming( chrom )
+ try:
+ data = bamfile.fetch( start=start, end=end, reference=chrom )
+ except ValueError:
return None
# Write reads in region.
@@ -757,13 +776,11 @@
try:
data = bamfile.fetch(start=start, end=end, reference=chrom)
except ValueError, e:
- # Some BAM files do not prefix chromosome names with chr, try without
- if chrom.startswith( 'chr' ):
- try:
- data = bamfile.fetch( start=start, end=end, reference=chrom[3:] )
- except ValueError:
- return None
- else:
+ # Try alternative chrom naming.
+ chrom = _convert_between_ucsc_and_ensemble_naming( chrom )
+ try:
+ data = bamfile.fetch( start=start, end=end, reference=chrom )
+ except ValueError:
return None
return data
@@ -1034,12 +1051,9 @@
source = open( self.original_dataset.file_name )
index = Indexes( self.converted_dataset.file_name )
- # If chrom is not found in indexes, try removing the first three
- # characters (e.g. 'chr') and see if that works. This enables the
- # provider to handle chrome names defined as chrXXX and as XXX.
- chrom = str(chrom)
- if chrom not in index.indexes and chrom[3:] in index.indexes:
- chrom = chrom[3:]
+ if chrom not in index.indexes:
+ # Try alternative naming.
+ chrom = _convert_between_ucsc_and_ensemble_naming( chrom )
return index.find(chrom, start, end)
@@ -1091,6 +1105,14 @@
a file offset.
"""
source = open( self.original_dataset.file_name )
+
+ # Read first line in order to match chrom naming format.
+ line = source.readline()
+ dataset_chrom = line.split()[0]
+ if not _chrom_naming_matches( chrom, dataset_chrom ):
+ chrom = _convert_between_ucsc_and_ensemble_naming( chrom )
+ # Undo read.
+ source.seek( 0 )
def features_in_region_iter():
offset = 0
@@ -1100,6 +1122,7 @@
if feature.chrom == chrom and feature_end > start and feature_start < end:
yield feature, offset
offset += feature.raw_size
+
return features_in_region_iter()
def process_data( self, iterator, start_val=0, max_vals=None, **kwargs ):
Repository URL: https://bitbucket.org/galaxy/galaxy-central/
--
This is a commit notification from bitbucket.org. You are receiving
this because you have the service enabled, addressing the recipient of
this email.
1 new commit in galaxy-central:
https://bitbucket.org/galaxy/galaxy-central/changeset/1eab72ce0a48/
changeset: 1eab72ce0a48
user: greg
date: 2012-08-09 12:46:13
summary: Fix imports broken in 9f790bc90769 using patch from Bjorn Gruning.
affected #: 1 file
diff -r a10bb73f579386e67c52383b4c0722cb693d7cf9 -r 1eab72ce0a483dd8bb09e43d549b119879d5435d lib/galaxy/util/shed_util.py
--- a/lib/galaxy/util/shed_util.py
+++ b/lib/galaxy/util/shed_util.py
@@ -2,7 +2,8 @@
import galaxy.tools.data
from datetime import date, datetime, timedelta
from time import strftime, gmtime
-from galaxy import tools, util
+from galaxy import util
+from galaxy.tools import parameters
from galaxy.datatypes.checkers import *
from galaxy.util.json import *
from galaxy.tools.search import ToolBoxSearch
@@ -255,7 +256,7 @@
invalid_files_and_errors_tups = []
correction_msg = ''
for input_param in tool.input_params:
- if isinstance( input_param, tools.parameters.basic.SelectToolParameter ) and input_param.is_dynamic:
+ if isinstance( input_param, parameters.basic.SelectToolParameter ) and input_param.is_dynamic:
# If the tool refers to .loc files or requires an entry in the tool_data_table_conf.xml, make sure all requirements exist.
options = input_param.dynamic_options or input_param.options
if options:
Repository URL: https://bitbucket.org/galaxy/galaxy-central/
--
This is a commit notification from bitbucket.org. You are receiving
this because you have the service enabled, addressing the recipient of
this email.
1 new commit in galaxy-central:
https://bitbucket.org/galaxy/galaxy-central/changeset/a10bb73f5793/
changeset: a10bb73f5793
user: greg
date: 2012-08-08 22:15:06
summary: Fixes for setting versions for tools included in a repository in the tool shed.
affected #: 1 file
diff -r 6a7d9d3714e99f613fb8dbcdb709e7e2a2b813e0 -r a10bb73f579386e67c52383b4c0722cb693d7cf9 lib/galaxy/webapps/community/controllers/common.py
--- a/lib/galaxy/webapps/community/controllers/common.py
+++ b/lib/galaxy/webapps/community/controllers/common.py
@@ -122,7 +122,12 @@
else:
for tool_dict in tool_dicts:
# We have at least 2 changeset revisions to compare tool guids and tool ids.
- parent_id = get_parent_id( trans, id, tool_dict[ 'id' ], tool_dict[ 'version' ], tool_dict[ 'guid' ], changeset_revisions[ 0:index ] )
+ parent_id = get_parent_id( trans,
+ id,
+ tool_dict[ 'id' ],
+ tool_dict[ 'version' ],
+ tool_dict[ 'guid' ],
+ changeset_revisions[ 0:index ] )
tool_versions_dict[ tool_dict[ 'guid' ] ] = parent_id
if tool_versions_dict:
repository_metadata.tool_versions = tool_versions_dict
@@ -149,7 +154,8 @@
# Delete all repository_metadata records associated with the repository that have a changeset_revision that is not in changeset_revisions.
# We sometimes see multiple records with the same changeset revision value - no idea how this happens. We'll assume we can delete the older
# records, so we'll order by update_time descending and delete records that have the same changeset_revision we come across later..
- changeset_revisions_checked = []
+ changeset_revisions_checked = []
+ cleaned_changeset_revisions = []
for repository_metadata in trans.sa_session.query( trans.model.RepositoryMetadata ) \
.filter( trans.model.RepositoryMetadata.table.c.repository_id == trans.security.decode_id( id ) ) \
.order_by( trans.model.RepositoryMetadata.table.c.changeset_revision,
@@ -159,6 +165,9 @@
if can_delete:
trans.sa_session.delete( repository_metadata )
trans.sa_session.flush()
+ else:
+ cleaned_changeset_revisions.append( changeset_revision )
+ return cleaned_changeset_revisions
def compare_changeset_revisions( ancestor_changeset_revision, ancestor_metadata_dict, current_changeset_revision, current_metadata_dict ):
# The metadata associated with ancestor_changeset_revision is ancestor_metadata_dict. This changeset_revision is an ancestor of
# current_changeset_revision which is associated with current_metadata_dict. A new repository_metadata record will be created only
@@ -277,7 +286,7 @@
return file_path
return None
def create_or_update_repository_metadata( trans, id, repository, changeset_revision, metadata_dict ):
- downloadable = 'datatypes' in metadata_dict or 'tools' in metadata_dict or 'workflows' in metadata_dict
+ downloadable = is_downloadable( metadata_dict )
repository_metadata = get_repository_metadata_by_changeset_revision( trans, id, changeset_revision )
if repository_metadata:
repository_metadata.metadata = metadata_dict
@@ -289,6 +298,7 @@
downloadable=downloadable )
trans.sa_session.add( repository_metadata )
trans.sa_session.flush()
+ return repository_metadata
def generate_clone_url( trans, repository_id ):
"""Generate the URL for cloning a repository."""
repository = get_repository( trans, repository_id )
@@ -562,6 +572,8 @@
util.send_mail( frm, to, subject, body, trans.app.config )
except Exception, e:
log.exception( "An error occurred sending a tool shed repository update alert by email." )
+def is_downloadable( metadata_dict ):
+ return 'datatypes' in metadata_dict or 'tools' in metadata_dict or 'workflows' in metadata_dict
def load_tool( trans, config_file ):
"""Load a single tool from the file named by `config_file` and return an instance of `Tool`."""
# Parse XML configuration file and get the root element
@@ -797,7 +809,7 @@
elif comparison == 'not equal and not subset':
metadata_changeset_revision = ancestor_changeset_revision
metadata_dict = ancestor_metadata_dict
- create_or_update_repository_metadata( trans, id, repository, metadata_changeset_revision, metadata_dict )
+ repository_metadata = create_or_update_repository_metadata( trans, id, repository, metadata_changeset_revision, metadata_dict )
changeset_revisions.append( metadata_changeset_revision )
ancestor_changeset_revision = current_changeset_revision
ancestor_metadata_dict = current_metadata_dict
@@ -809,7 +821,7 @@
metadata_changeset_revision = current_changeset_revision
metadata_dict = current_metadata_dict
# We're at the end of the change log.
- create_or_update_repository_metadata( trans, id, repository, metadata_changeset_revision, metadata_dict )
+ repository_metadata = create_or_update_repository_metadata( trans, id, repository, metadata_changeset_revision, metadata_dict )
changeset_revisions.append( metadata_changeset_revision )
ancestor_changeset_revision = None
ancestor_metadata_dict = None
@@ -820,7 +832,7 @@
metadata_dict = ancestor_metadata_dict
if not ctx.children():
# We're at the end of the change log.
- create_or_update_repository_metadata( trans, id, repository, metadata_changeset_revision, metadata_dict )
+ repository_metadata = create_or_update_repository_metadata( trans, id, repository, metadata_changeset_revision, metadata_dict )
changeset_revisions.append( metadata_changeset_revision )
ancestor_changeset_revision = None
ancestor_metadata_dict = None
@@ -830,10 +842,9 @@
except:
pass
# Delete all repository_metadata records for this repository that do not have a changeset_revision value in changeset_revisions.
- clean_repository_metadata( trans, id, changeset_revisions )
+ cleaned_changeset_revisions = clean_repository_metadata( trans, id, changeset_revisions )
# Set tool version information for all downloadable changeset revisions.
- downloadable_changeset_revisions = [ rm.changeset_revision for rm in repository.downloadable_revisions ]
- add_repository_metadata_tool_versions( trans, id, downloadable_changeset_revisions )
+ add_repository_metadata_tool_versions( trans, id, cleaned_changeset_revisions )
def set_repository_metadata( trans, repository, content_alert_str='', **kwd ):
"""
Set metadata using the repository's current disk files, returning specific error messages (if any) to alert the repository owner that the changeset
@@ -846,23 +857,22 @@
repo = hg.repository( get_configured_ui(), repo_dir )
metadata_dict, invalid_file_tups = generate_metadata_for_changeset_revision( trans.app, repo_dir, repository_clone_url )
if metadata_dict:
+ downloadable = is_downloadable( metadata_dict )
repository_metadata = None
if new_tool_metadata_required( trans, repository, metadata_dict ) or new_workflow_metadata_required( trans, repository, metadata_dict ):
# Create a new repository_metadata table row.
- repository_metadata = trans.model.RepositoryMetadata( repository.id, repository.tip, metadata_dict )
- trans.sa_session.add( repository_metadata )
- try:
- trans.sa_session.flush()
- # If this is the first record stored for this repository, see if we need to send any email alerts.
- if len( repository.downloadable_revisions ) == 1:
- handle_email_alerts( trans, repository, content_alert_str='', new_repo_alert=True, admin_only=False )
- except TypeError, e:
- message = "Unable to save metadata for this repository, exception: %s" % str( e )
- status = 'error'
+ repository_metadata = create_or_update_repository_metadata( trans,
+ trans.security.encode_id( repository.id ),
+ repository,
+ repository.tip,
+ metadata_dict )
+ # If this is the first record stored for this repository, see if we need to send any email alerts.
+ if len( repository.downloadable_revisions ) == 1:
+ handle_email_alerts( trans, repository, content_alert_str='', new_repo_alert=True, admin_only=False )
else:
repository_metadata = get_latest_repository_metadata( trans, repository.id )
if repository_metadata:
- downloadable = 'datatypes' in metadata_dict or 'tools' in metadata_dict or 'workflows' in metadata_dict
+ downloadable = is_downloadable( metadata_dict )
# Update the last saved repository_metadata table row.
repository_metadata.changeset_revision = repository.tip
repository_metadata.metadata = metadata_dict
@@ -871,11 +881,22 @@
trans.sa_session.flush()
else:
# There are no tools in the repository, and we're setting metadata on the repository tip.
- repository_metadata = trans.model.RepositoryMetadata( repository.id, repository.tip, metadata_dict )
- trans.sa_session.add( repository_metadata )
- trans.sa_session.flush()
+ repository_metadata = create_or_update_repository_metadata( trans,
+ trans.security.encode_id( repository.id ),
+ repository,
+ repository.tip,
+ metadata_dict )
if 'tools' in metadata_dict and repository_metadata and status != 'error':
- add_repository_metadata_tool_versions( trans, trans.security.encode_id( repository.id ), [ repository_metadata.changeset_revision ] )
+ # Set tool versions on the new downloadable change set. The order of the list of changesets is critical, so we use the repo's changelog.
+ downloadable_changeset_revisions = [ rm.changeset_revision for rm in repository.downloadable_revisions ]
+ changeset_revisions = []
+ for changeset in repo.changelog:
+ changeset_revision = str( repo.changectx( changeset ) )
+ if changeset_revision in downloadable_changeset_revisions:
+ changeset_revisions.append( changeset_revision )
+ # Now append the latest changeset_revision we just updated above.
+ changeset_revisions.append( repository_metadata.changeset_revision )
+ add_repository_metadata_tool_versions( trans, trans.security.encode_id( repository.id ), changeset_revisions )
elif len( repo ) == 1 and not invalid_file_tups:
message = "Revision '%s' includes no tools, datatypes or exported workflows for which metadata can " % str( repository.tip )
message += "be defined so this revision cannot be automatically installed into a local Galaxy instance."
Repository URL: https://bitbucket.org/galaxy/galaxy-central/
--
This is a commit notification from bitbucket.org. You are receiving
this because you have the service enabled, addressing the recipient of
this email.
1 new commit in galaxy-central:
https://bitbucket.org/galaxy/galaxy-central/changeset/6a7d9d3714e9/
changeset: 6a7d9d3714e9
user: greg
date: 2012-08-08 20:46:59
summary: Apply changes to rendering tool help to the tool shed's version of the tool form mako template so tools can be displayed again in the tool shed.
affected #: 1 file
diff -r 9af69e5a6db262ab5c277674c42cf0081259d0de -r 6a7d9d3714e99f613fb8dbcdb709e7e2a2b813e0 templates/webapps/community/repository/tool_form.mako
--- a/templates/webapps/community/repository/tool_form.mako
+++ b/templates/webapps/community/repository/tool_form.mako
@@ -186,12 +186,15 @@
<div class="toolHelp"><div class="toolHelpBody"><%
+ tool_help = tool.help
+ # Help is Mako template, so render using current static path.
+ tool_help = tool_help.render( static_path=h.url_for( '/static' ) )
# Convert to unicode to display non-ascii characters.
- if type( tool.help ) is not unicode:
- tool.help = unicode( tool.help, 'utf-8')
+ if type( tool_help ) is not unicode:
+ tool_help = unicode( tool_help, 'utf-8')
%>
- ${tool.help}
- </div>
+ ${tool_help}
+ </div></div>
%endif
%else:
Repository URL: https://bitbucket.org/galaxy/galaxy-central/
--
This is a commit notification from bitbucket.org. You are receiving
this because you have the service enabled, addressing the recipient of
this email.
1 new commit in galaxy-central:
https://bitbucket.org/galaxy/galaxy-central/changeset/9af69e5a6db2/
changeset: 9af69e5a6db2
user: carlfeberhard
date: 2012-08-08 20:39:40
summary: fix for missing tool-data/shared/ucsc/publicbuilds.txt (related to test failure on functional.test_get_data.UploadData.test_0020_upload_file)
affected #: 1 file
diff -r 9f790bc90769df7a4f84f103707bdd8ceaf1115d -r 9af69e5a6db262ab5c277674c42cf0081259d0de buildbot_setup.sh
--- a/buildbot_setup.sh
+++ b/buildbot_setup.sh
@@ -68,8 +68,13 @@
datatypes_conf.xml.sample
universe_wsgi.ini.sample
tool_data_table_conf.xml.sample
+migrated_tools_conf.xml.sample
+tool-data/shared/ensembl/builds.txt.sample
+tool-data/shared/igv/igv_build_sites.txt.sample
+tool-data/shared/ncbi/builds.txt.sample
+tool-data/shared/rviewer/rviewer_build_sites.txt.sample
tool-data/shared/ucsc/builds.txt.sample
-migrated_tools_conf.xml.sample
+tool-data/shared/ucsc/publicbuilds.txt.sample
"
DIRS="
Repository URL: https://bitbucket.org/galaxy/galaxy-central/
--
This is a commit notification from bitbucket.org. You are receiving
this because you have the service enabled, addressing the recipient of
this email.
1 new commit in galaxy-central:
https://bitbucket.org/galaxy/galaxy-central/changeset/68d253239882/
changeset: 68d253239882
user: natefoo
date: 2012-08-08 17:12:42
summary: Remove contrib/multiprocess.sh since run.sh can run all of the processes itself now.
affected #: 1 file
diff -r 480b8c0003f1ab6fa78f88bd7854cf978f2ed575 -r 68d253239882008ee143fd46d946d1a8a828d21e contrib/multiproccess.sh
--- a/contrib/multiproccess.sh
+++ /dev/null
@@ -1,26 +0,0 @@
-#!/bin/bash
-
-# copy this script to the top level galaxy directory and modify the following
-# for your environment
-
-web_server_names=(web{0..2}) # server names: web0 web1 web2
-runner_server_names=(runner0) # server name: runner0
-
-web_config='universe_wsgi.webapp.ini'
-runner_config='universe_wsgi.runner.ini'
-
-# actually do the requested action
-
-if [ -z "$1" ]; then
- echo "usage: multiprocess.sh <--daemon|--stop-daemon>"
- exit 1
-fi
-
-for server_name in ${web_server_names[@]}; do
- echo "[$server_name]"
- python ./scripts/paster.py serve $web_config --server-name=$server_name --pid-file=$server_name.pid --log-file=$server_name.log $@
-done
-for server_name in ${runner_server_names[@]}; do
- echo "[$server_name]"
- python ./scripts/paster.py serve $runner_config --server-name=$server_name --pid-file=$server_name.pid --log-file=$server_name.log $@
-done
Repository URL: https://bitbucket.org/galaxy/galaxy-central/
--
This is a commit notification from bitbucket.org. You are receiving
this because you have the service enabled, addressing the recipient of
this email.