galaxy-commits
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
June 2011
- 1 participants
- 136 discussions
commit/galaxy-central: greg: Change many tool shed methods to use the mercurial api. Fix 2 bugs introduced when email alerts were added - unauthenticated users can once again browse categories / repositories.
by Bitbucket 28 Jun '11
by Bitbucket 28 Jun '11
28 Jun '11
1 new changeset in galaxy-central:
http://bitbucket.org/galaxy/galaxy-central/changeset/dca79f6fb1ec/
changeset: dca79f6fb1ec
user: greg
date: 2011-06-28 16:24:49
summary: Change many tool shed methods to use the mercurial api. Fix 2 bugs introduced when email alerts were added - unauthenticated users can once again browse categories / repositories.
affected #: 11 files (14.7 KB)
--- a/.hgignore Mon Jun 27 17:25:32 2011 -0400
+++ b/.hgignore Tue Jun 28 10:24:49 2011 -0400
@@ -13,6 +13,7 @@
# Database stuff
database/beaker_sessions
+database/community_files
database/compiled_templates
database/files
database/pbs
--- a/lib/galaxy/webapps/community/controllers/common.py Mon Jun 27 17:25:32 2011 -0400
+++ b/lib/galaxy/webapps/community/controllers/common.py Tue Jun 28 10:24:49 2011 -0400
@@ -1,15 +1,13 @@
-import os, tarfile, tempfile, shutil, string, socket
+import os, string, socket, logging
from time import strftime
from datetime import *
from galaxy.util.json import from_json_string, to_json_string
from galaxy.web.base.controller import *
from galaxy.webapps.community import model
from galaxy.model.orm import *
-from galaxy.web.framework.helpers import time_ago, iff, grids
-from galaxy.web.form_builder import SelectField
from galaxy.model.item_attrs import UsesItemRatings
from mercurial import hg, ui
-import logging
+
log = logging.getLogger( __name__ )
email_alert_template = """
@@ -81,42 +79,9 @@
def get_user( trans, id ):
"""Get a user from the database"""
return trans.sa_session.query( trans.model.User ).get( trans.security.decode_id( id ) )
-def hg_add( trans, current_working_dir, cloned_repo_dir ):
- # Add files to a cloned repository. If they're already tracked, this should do nothing.
- os.chdir( cloned_repo_dir )
- os.system( 'hg add > /dev/null 2>&1' )
- os.chdir( current_working_dir )
-def hg_clone( trans, repository, current_working_dir ):
- # Make a clone of a repository in a temporary location.
- repo_dir = repository.repo_path
- tmp_dir = tempfile.mkdtemp()
- tmp_archive_dir = os.path.join( tmp_dir, 'tmp_archive_dir' )
- if not os.path.exists( tmp_archive_dir ):
- os.makedirs( tmp_archive_dir )
- cmd = "hg clone %s > /dev/null 2>&1" % os.path.abspath( repo_dir )
- os.chdir( tmp_archive_dir )
- os.system( cmd )
- os.chdir( current_working_dir )
- cloned_repo_dir = os.path.join( tmp_archive_dir, 'repo_%d' % repository.id )
- return tmp_dir, cloned_repo_dir
-def hg_commit( commit_message, current_working_dir, cloned_repo_dir ):
- # Commit a change set to a cloned repository.
- if not commit_message:
- commit_message = "No commit message"
- os.chdir( cloned_repo_dir )
- os.system( "hg commit -m '%s' > /dev/null 2>&1" % commit_message )
- os.chdir( current_working_dir )
-def hg_push( trans, repository, current_working_dir, cloned_repo_dir ):
- # Push a change set from a cloned repository to a master repository.
+def handle_email_alerts( trans, repository ):
repo_dir = repository.repo_path
repo = hg.repository( ui.ui(), repo_dir )
- # We want these change sets to be associated with the owner of the repository, so we'll
- # set the HGUSER environment variable accordingly.
- os.environ[ 'HGUSER' ] = trans.user.username
- cmd = "hg push %s > /dev/null 2>&1" % os.path.abspath( repo_dir )
- os.chdir( cloned_repo_dir )
- os.system( cmd )
- os.chdir( current_working_dir )
smtp_server = trans.app.config.smtp_server
if smtp_server and repository.email_alerts:
# Send email alert to users that want them.
@@ -152,20 +117,23 @@
try:
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 hg_remove( file_path, current_working_dir, cloned_repo_dir ):
- # Remove a file path from a cloned repository. Since mercurial doesn't track
- # directories (only files), directories are automatically removed when they
- # become empty.
- abs_file_path = os.path.join( cloned_repo_dir, file_path )
- if os.path.exists( abs_file_path ):
- cmd = 'hg remove %s > /dev/null 2>&1' % file_path
- os.chdir( cloned_repo_dir )
- os.system( cmd )
- os.chdir( current_working_dir )
+ log.exception( "An error occurred sending a tool shed repository update alert by email." )
def update_for_browsing( repository, current_working_dir ):
# Make a copy of a repository's files for browsing.
repo_dir = repository.repo_path
os.chdir( repo_dir )
os.system( 'hg update > /dev/null 2>&1' )
os.chdir( current_working_dir )
+ """
+ # TODO: the following is useful if the repository files somehow include missing or
+ # untracked files. If this happens, we can enhance the following to clean things up.
+ # We're not currently doing any cleanup though since so far none of the repositories
+ # have problematic files for browsing.
+ # Get the tip change set.
+ repo = hg.repository( ui.ui(), repo_dir )
+ for changeset in repo.changelog:
+ ctx = repo.changectx( changeset )
+ ctx_parent = ctx.parents()[0]
+ break
+ modified, added, removed, deleted, unknown, ignored, clean = repo.status( node1=ctx_parent.node(), node2=ctx.node() )
+ """
--- a/lib/galaxy/webapps/community/controllers/repository.py Mon Jun 27 17:25:32 2011 -0400
+++ b/lib/galaxy/webapps/community/controllers/repository.py Tue Jun 28 10:24:49 2011 -0400
@@ -12,7 +12,7 @@
from galaxy.util.json import from_json_string, to_json_string
from galaxy.model.orm import *
from common import *
-from mercurial import hg, ui, patch
+from mercurial import hg, ui, patch, commands
log = logging.getLogger( __name__ )
@@ -117,7 +117,7 @@
model.User.table.c.email == column_filter ) )
class EmailAlertsColumn( grids.TextColumn ):
def get_value( self, trans, grid, repository ):
- if repository.email_alerts and trans.user.email in from_json_string( repository.email_alerts ):
+ if trans.user and repository.email_alerts and trans.user.email in from_json_string( repository.email_alerts ):
return 'yes'
return ''
# Grid definition
@@ -373,53 +373,18 @@
# allow_push = test
# name = convert_characters1
# push_ssl = False
- # Upon repository creation, only the owner can push to it ( allow_push setting ),
- # and since we support both http and https, we set push_ssl to False to override
+ # Since we support both http and https, we set push_ssl to False to override
# the default (which is True) in the mercurial api.
- hgrc_file = os.path.abspath( os.path.join( repository.repo_path, ".hg", "hgrc" ) )
- output = open( hgrc_file, 'w' )
- output.write( '[web]\n' )
- output.write( 'allow_push = %s\n' % repository.user.username )
- output.write( 'name = %s\n' % repository.name )
- output.write( 'push_ssl = false\n' )
- output.flush()
- output.close()
- def __get_allow_push( self, repository ):
- # TODO: Use the mercurial api to handle this
- hgrc_file = os.path.abspath( os.path.join( repository.repo_path, ".hg", "hgrc" ) )
- config = ConfigParser.ConfigParser()
- config.read( hgrc_file )
- for option in config.options( "web" ):
- if option == 'allow_push':
- return config.get( "web", option )
- raise Exception( "Repository %s missing allow_push entry under the [web] option in it's hgrc file." % repository.name )
- def __set_allow_push( self, repository, usernames, remove_auth='' ):
- """
- # TODO: Use the mercurial api to handle this, something like the following:
- items = repo.ui.configitems( section, untrusted=False )
- push_section = repo.ui.config( 'hgrc', 'allow_push' )
- for XXX (in name you want to add):
- repo.ui.updateconfig( section=extensions_section, name='XXX', value='YYY' )
- """
- hgrc_file = os.path.abspath( os.path.join( repository.repo_path, ".hg", "hgrc" ) )
- fh, fn = tempfile.mkstemp()
- for i, line in enumerate( open( hgrc_file ) ):
- if line.startswith( 'allow_push' ):
- value = line.split( ' = ' )[1].rstrip( '\n' )
- if remove_auth:
- current_usernames = value.split( ',' )
- new_usernames = []
- for current_username in current_usernames:
- if current_username != remove_auth:
- new_usernames.append( current_username )
- new_usernames = ','.join( new_usernames )
- line = 'allow_push = %s\n' % new_usernames
- else:
- value = '%s,%s\n' % ( value, usernames )
- line = 'allow_push = %s' % value
- os.write( fh, line )
- os.close( fh )
- shutil.move( fn, hgrc_file )
+ repo = hg.repository( ui.ui(), path=repository.repo_path )
+ fp = repo.opener( 'hgrc', 'wb' )
+ fp.write( '[paths]\n' )
+ fp.write( 'default = .\n' )
+ fp.write( 'default-push = .\n' )
+ fp.write( '[web]\n' )
+ fp.write( 'allow_push = %s\n' % repository.user.username )
+ fp.write( 'name = %s\n' % repository.name )
+ fp.write( 'push_ssl = false\n' )
+ fp.close()
@web.expose
def browse_repository( self, trans, id, **kwd ):
params = util.Params( kwd )
@@ -428,14 +393,8 @@
commit_message = util.restore_text( params.get( 'commit_message', 'Deleted selected files' ) )
repository = get_repository( trans, id )
repo = hg.repository( ui.ui(), repository.repo_path )
- # Our current support for browsing a repository requires copies of the
- # repository files to be in the repository root directory. We do the
- # following to ensure the latest files are being browsed.
current_working_dir = os.getcwd()
- repo_dir = repository.repo_path
- os.chdir( repo_dir )
- os.system( 'hg update > /dev/null 2>&1' )
- os.chdir( current_working_dir )
+ update_for_browsing( repository, current_working_dir )
return trans.fill_template( '/webapps/community/repository/browse_repository.mako',
repo=repo,
repository=repository,
@@ -449,9 +408,8 @@
status = params.get( 'status', 'done' )
commit_message = util.restore_text( params.get( 'commit_message', 'Deleted selected files' ) )
repository = get_repository( trans, id )
- _ui = ui.ui()
repo_dir = repository.repo_path
- repo = hg.repository( _ui, repo_dir )
+ repo = hg.repository( ui.ui(), repo_dir )
selected_files_to_delete = util.restore_text( params.get( 'selected_files_to_delete', '' ) )
if params.get( 'select_files_to_delete_button', False ):
if selected_files_to_delete:
@@ -459,25 +417,19 @@
current_working_dir = os.getcwd()
# Get the current repository tip.
tip = repo[ 'tip' ]
- # Clone the repository to a temporary location.
- tmp_dir, cloned_repo_dir = hg_clone( trans, repository, current_working_dir )
- # Delete the selected files from the repository.
- cloned_repo = hg.repository( _ui, cloned_repo_dir )
for selected_file in selected_files_to_delete:
- selected_file_path = selected_file.split( 'repo_%d' % repository.id )[ 1 ].lstrip( '/' )
- hg_remove( selected_file_path, current_working_dir, cloned_repo_dir )
+ repo_file = os.path.abspath( selected_file )
+ commands.remove( repo.ui, repo, repo_file )
# Commit the change set.
if not commit_message:
commit_message = 'Deleted selected files'
- hg_commit( commit_message, current_working_dir, cloned_repo_dir )
- # Push the change set from the cloned repository to the master repository.
- hg_push( trans, repository, current_working_dir, cloned_repo_dir )
- # Remove the temporary directory containing the cloned repository.
- shutil.rmtree( tmp_dir )
+ # Commit the changes.
+ commands.commit( repo.ui, repo, repo_dir, message=commit_message )
+ handle_email_alerts( trans, repository )
# Update the repository files for browsing.
update_for_browsing( repository, current_working_dir )
# Get the new repository tip.
- repo = hg.repository( _ui, repo_dir )
+ repo = hg.repository( ui.ui(), repo_dir )
if tip != repo[ 'tip' ]:
message = "The selected files were deleted from the repository."
else:
@@ -508,7 +460,7 @@
else:
email_alerts = []
user = trans.user
- if params.get( 'receive_email_alerts_button', False ):
+ if user and params.get( 'receive_email_alerts_button', False ):
flush_needed = False
if alerts_checked:
if user.email not in email_alerts:
@@ -523,7 +475,7 @@
if flush_needed:
trans.sa_session.add( repository )
trans.sa_session.flush()
- checked = alerts_checked or user.email in email_alerts
+ checked = alerts_checked or ( user and user.email in email_alerts )
alerts_check_box = CheckboxField( 'alerts', checked=checked )
return trans.fill_template( '/webapps/community/repository/view_repository.mako',
repo=repo,
@@ -592,7 +544,7 @@
user = trans.sa_session.query( trans.model.User ).get( trans.security.decode_id( user_id ) )
usernames.append( user.username )
usernames = ','.join( usernames )
- self.__set_allow_push( repository, usernames, remove_auth=remove_auth )
+ repository.set_allow_push( usernames, remove_auth=remove_auth )
elif params.get( 'receive_email_alerts_button', False ):
flush_needed = False
if alerts_checked:
@@ -610,7 +562,10 @@
trans.sa_session.flush()
if error:
status = 'error'
- current_allow_push_list = self.__get_allow_push( repository ).split( ',' )
+ if repository.allow_push:
+ current_allow_push_list = repository.allow_push.split( ',' )
+ else:
+ current_allow_push_list = []
allow_push_select_field = self.__build_allow_push_select_field( trans, current_allow_push_list )
checked = alerts_checked or user.email in email_alerts
alerts_check_box = CheckboxField( 'alerts', checked=checked )
--- a/lib/galaxy/webapps/community/controllers/upload.py Mon Jun 27 17:25:32 2011 -0400
+++ b/lib/galaxy/webapps/community/controllers/upload.py Tue Jun 28 10:24:49 2011 -0400
@@ -2,8 +2,8 @@
from galaxy.web.base.controller import *
from galaxy.model.orm import *
from galaxy.datatypes.checkers import *
-from common import get_categories, get_repository, hg_add, hg_clone, hg_commit, hg_push, hg_remove, update_for_browsing
-from mercurial import hg, ui
+from common import *
+from mercurial import hg, ui, commands
log = logging.getLogger( __name__ )
@@ -31,30 +31,10 @@
uncompress_file = util.string_as_bool( params.get( 'uncompress_file', 'true' ) )
remove_repo_files_not_in_tar = util.string_as_bool( params.get( 'remove_repo_files_not_in_tar', 'true' ) )
uploaded_file = None
- upload_point = params.get( 'upload_point', None )
- if upload_point is not None:
- # The value of upload_point will be something like: database/community_files/000/repo_12/1.bed
- if os.path.exists( upload_point ):
- if os.path.isfile( upload_point ):
- # Get the parent directory
- upload_point, not_needed = os.path.split( upload_point )
- # Now the value of uplaod_point will be something like: database/community_files/000/repo_12/
- upload_point = upload_point.split( 'repo_%d' % repository.id )[ 1 ]
- if upload_point:
- upload_point = upload_point.lstrip( '/' )
- upload_point = upload_point.rstrip( '/' )
- # Now the value of uplaod_point will be something like: /
- if upload_point == '/':
- upload_point = None
- else:
- # Must have been an error selecting something that didn't exist, so default to repository root
- # TODO: throw an exception????
- upload_point = None
- else:
- # Default to repository root
- upload_point = None
+ upload_point = self.__get_upload_point( repository, **kwd )
+ # Get the current repository tip.
+ tip = repo[ 'tip' ]
if params.get( 'upload_button', False ):
- ctx = repo.changectx( "tip" )
current_working_dir = os.getcwd()
file_data = params.get( 'file_data', '' )
if file_data == '':
@@ -66,12 +46,6 @@
uploaded_file_name = uploaded_file.name
uploaded_file_filename = file_data.filename
if uploaded_file:
- # Our current support for browsing repo contents requires a copy of the
- # repository files in the repo root directory. To eliminate these copies,
- # we update the repo, passing the "-r null" flag.
- os.chdir( repo_dir )
- os.system( 'hg update -r null > /dev/null 2>&1' )
- os.chdir( current_working_dir )
isgzip = False
isbz2 = False
if uncompress_file:
@@ -79,10 +53,9 @@
if not isgzip:
isbz2 = is_bz2( uploaded_file_name )
ok = True
- files_to_commit = []
# Determine what we have - a single file or an archive
try:
- if uncompress_file:
+ if ( isgzip or isbz2 ) and uncompress_file:
# Open for reading with transparent compression.
tar = tarfile.open( uploaded_file_name, 'r:*' )
else:
@@ -91,125 +64,52 @@
except tarfile.ReadError, e:
tar = None
istar = False
- if repository.is_new:
- if istar:
- # We have an archive ( a tarball ) in a new repository.
- ok, message = self.__check_archive( tar )
- if ok:
- tar.extractall( path=repo_dir )
- tar.close()
- uploaded_file.close()
- for root, dirs, files in os.walk( repo_dir, topdown=False ):
- # Don't visit .hg directories and don't include hgrc files in commit.
- if not root.find( '.hg' ) >= 0 and not root.find( 'hgrc' ) >= 0:
- if '.hg' in dirs:
- # Don't visit .hg directories
- dirs.remove( '.hg' )
- if 'hgrc' in files:
- # Don't include hgrc files in commit - should be impossible
- # since we don't visit .hg dirs, but just in case...
- files.remove( 'hgrc' )
- for name in files:
- relative_root = root.split( 'repo_%d' % repository.id )[ 1 ].lstrip ( '/' )
- if upload_point is not None:
- file_path = os.path.join( relative_root, upload_point, name )
- else:
- file_path = os.path.join( relative_root, name )
- # Check if the file is tracked and make it tracked if not.
- repo_contains = file_path in [ i for i in ctx.manifest() ]
- if not repo_contains:
- # Add the file to the dirstate
- repo.dirstate.add( file_path )
- files_to_commit.append( file_path )
- else:
- tar.close()
+ if istar:
+ ok, message, files_to_remove = self.upload_tar( trans,
+ repository,
+ tar,
+ uploaded_file,
+ upload_point,
+ remove_repo_files_not_in_tar,
+ commit_message )
+ else:
+ if ( isgzip or isbz2 ) and uncompress_file:
+ uploaded_file_filename = self.uncompress( repository, uploaded_file_name, uploaded_file_filename, isgzip, isbz2 )
+ if upload_point is not None:
+ full_path = os.path.abspath( os.path.join( repo_dir, upload_point, uploaded_file_filename ) )
else:
- # We have a single file in a new repository.
- if uncompress_file and ( isgzip or isbz2 ):
- uploaded_file_filename = self.uncompress( repository, uploaded_file_name, uploaded_file_filename, isgzip, isbz2 )
- if upload_point is not None:
- full_path = os.path.abspath( os.path.join( upload_point, uploaded_file_filename ) )
- file_path = os.path.join( upload_point, uploaded_file_filename )
- else:
- full_path = os.path.abspath( os.path.join( repo_dir, uploaded_file_filename ) )
- file_path = os.path.join( uploaded_file_filename )
- shutil.move( uploaded_file_name, full_path )
- repo.dirstate.add( file_path )
- files_to_commit.append( file_path )
- else:
- # We have a repository that is not new (it contains files).
- if uncompress_file and ( isgzip or isbz2 ):
- uploaded_file_filename = self.uncompress( repository, uploaded_file_name, uploaded_file_filename, isgzip, isbz2 )
- # Get the current repository tip.
- tip = repo[ 'tip' ]
- # Clone the repository to a temporary location.
- tmp_dir, cloned_repo_dir = hg_clone( trans, repository, current_working_dir )
- # Move the uploaded files to the upload_point within the cloned repository.
- files_to_remove = self.__move_to_upload_point( repository,
- upload_point,
- uploaded_file,
- uploaded_file_name,
- uploaded_file_filename,
- cloned_repo_dir,
- istar,
- tar,
- remove_repo_files_not_in_tar )
- if remove_repo_files_not_in_tar and files_to_remove:
- # Remove files in the repository (relative to the upload point)
- # that are not in the uploaded archive.
- for repo_file in files_to_remove:
- hg_remove( repo_file, current_working_dir, cloned_repo_dir )
- # Add the files in the uploaded archive to the cloned repository.
- hg_add( trans, current_working_dir, cloned_repo_dir )
- # Commit the files to the cloned repository.
- if not commit_message:
- commit_message = 'Uploaded'
- hg_commit( commit_message, current_working_dir, cloned_repo_dir )
- # Push the changes from the cloned repository to the master repository.
- hg_push( trans, repository, current_working_dir, cloned_repo_dir )
- # Remove the temporary directory containing the cloned repository.
- shutil.rmtree( tmp_dir )
- # Update the repository files for browsing.
+ full_path = os.path.abspath( os.path.join( repo_dir, uploaded_file_filename ) )
+ # Move the uploaded file to the load_point within the repository hierarchy.
+ shutil.move( uploaded_file_name, full_path )
+ commands.add( repo.ui, repo, full_path )
+ commands.commit( repo.ui, repo, full_path, message=commit_message )
+ handle_email_alerts( trans, repository )
+ if ok:
+ # Update the repository files for browsing, a by-product of doing this
+ # is eliminating unwanted files from the repository directory.
update_for_browsing( repository, current_working_dir )
# Get the new repository tip.
repo = hg.repository( ui.ui(), repo_dir )
if tip != repo[ 'tip' ]:
- if uncompress_file:
+ if ( isgzip or isbz2 ) and uncompress_file:
uncompress_str = ' uncompressed and '
else:
uncompress_str = ' '
message = "The file '%s' has been successfully%suploaded to the repository." % ( uploaded_file_filename, uncompress_str )
- if istar and remove_repo_files_not_in_tar:
- message += " %d files were removed from the repository." % len( files_to_remove )
+ if istar and remove_repo_files_not_in_tar and files_to_remove:
+ if upload_point is not None:
+ message += " %d files were removed from the repository relative to the selected upload point '%s'." % ( len( files_to_remove ), upload_point )
+ else:
+ message += " %d files were removed from the repository root." % len( files_to_remove )
else:
- message = 'No changes to repository.'
+ message = 'No changes to repository.'
trans.response.send_redirect( web.url_for( controller='repository',
action='browse_repository',
commit_message='Deleted selected files',
message=message,
id=trans.security.encode_id( repository.id ) ) )
- if ok:
- if files_to_commit:
- repo.dirstate.write()
- repo.commit( text=commit_message )
- os.chdir( repo_dir )
- os.system( 'hg update > /dev/null 2>&1' )
- os.chdir( current_working_dir )
- if uncompress_file:
- uncompress_str = ' uncompressed and '
- else:
- uncompress_str = ' '
- message = "The file '%s' has been successfully%suploaded to the repository." % ( uploaded_file_filename, uncompress_str )
- trans.response.send_redirect( web.url_for( controller='repository',
- action='browse_repository',
- commit_message='Deleted selected files',
- message=message,
- id=trans.security.encode_id( repository.id ) ) )
else:
status = 'error'
- os.chdir( repo_dir )
- os.system( 'hg update > /dev/null 2>&1' )
- os.chdir( current_working_dir )
selected_categories = [ trans.security.decode_id( id ) for id in category_ids ]
return trans.fill_template( '/webapps/community/repository/upload.mako',
repository=repository,
@@ -218,6 +118,53 @@
remove_repo_files_not_in_tar=remove_repo_files_not_in_tar,
message=message,
status=status )
+ def upload_tar( self, trans, repository, tar, uploaded_file, upload_point, remove_repo_files_not_in_tar, commit_message ):
+ # Upload a tar archive of files.
+ repo_dir = repository.repo_path
+ repo = hg.repository( ui.ui(), repo_dir )
+ files_to_remove = []
+ ok, message = self.__check_archive( tar )
+ if not ok:
+ tar.close()
+ uploaded_file.close()
+ return ok, message, files_to_remove
+ else:
+ if upload_point is not None:
+ full_path = os.path.abspath( os.path.join( repo_dir, upload_point ) )
+ else:
+ full_path = os.path.abspath( repo_dir )
+ filenames_in_archive = [ tarinfo_obj.name for tarinfo_obj in tar.getmembers() ]
+ filenames_in_archive = [ os.path.join( full_path, name ) for name in filenames_in_archive ]
+ # Extract the uploaded tar to the load_point within the repository hierarchy.
+ tar.extractall( path=full_path )
+ tar.close()
+ uploaded_file.close()
+ if remove_repo_files_not_in_tar and not repository.is_new:
+ # We have a repository that is not new (it contains files), so discover
+ # those files that are in the repository, but not in the uploaded archive.
+ for root, dirs, files in os.walk( full_path ):
+ if not root.find( '.hg' ) >= 0 and not root.find( 'hgrc' ) >= 0:
+ if '.hg' in dirs:
+ # Don't visit .hg directories - should be impossible since we don't
+ # allow uploaded archives that contain .hg dirs, but just in case...
+ dirs.remove( '.hg' )
+ if 'hgrc' in files:
+ # Don't include hgrc files in commit.
+ files.remove( 'hgrc' )
+ for name in files:
+ full_name = os.path.join( root, name )
+ if full_name not in filenames_in_archive:
+ files_to_remove.append( full_name )
+ for repo_file in files_to_remove:
+ # Remove files in the repository (relative to the upload point)
+ # that are not in the uploaded archive.
+ commands.remove( repo.ui, repo, repo_file )
+ for filename_in_archive in filenames_in_archive:
+ commands.add( repo.ui, repo, filename_in_archive )
+ # Commit the changes.
+ commands.commit( repo.ui, repo, full_path, message=commit_message )
+ handle_email_alerts( trans, repository )
+ return True, '', files_to_remove
def uncompress( self, repository, uploaded_file_name, uploaded_file_filename, isgzip, isbz2 ):
if isgzip:
self.__handle_gzip( repository, uploaded_file_name )
@@ -259,44 +206,26 @@
os.close( fd )
bzipped_file.close()
shutil.move( uncompressed, uploaded_file_name )
- def __move_to_upload_point( self, repository, upload_point, uploaded_file, uploaded_file_name,
- uploaded_file_filename, cloned_repo_dir, istar, tar, remove_repo_files_not_in_tar ):
- files_to_remove = []
+ def __get_upload_point( self, repository, **kwd ):
+ upload_point = kwd.get( 'upload_point', None )
if upload_point is not None:
- if istar:
- full_path = os.path.abspath( os.path.join( cloned_repo_dir, upload_point ) )
+ # The value of upload_point will be something like: database/community_files/000/repo_12/1.bed
+ if os.path.exists( upload_point ):
+ if os.path.isfile( upload_point ):
+ # Get the parent directory
+ upload_point, not_needed = os.path.split( upload_point )
+ # Now the value of uplaod_point will be something like: database/community_files/000/repo_12/
+ upload_point = upload_point.split( 'repo_%d' % repository.id )[ 1 ]
+ if upload_point:
+ upload_point = upload_point.lstrip( '/' )
+ upload_point = upload_point.rstrip( '/' )
+ # Now the value of uplaod_point will be something like: /
+ if upload_point == '/':
+ upload_point = None
else:
- full_path = os.path.abspath( os.path.join( cloned_repo_dir, upload_point, uploaded_file_filename ) )
- else:
- if istar:
- full_path = os.path.abspath( os.path.join( cloned_repo_dir ) )
- else:
- full_path = os.path.abspath( os.path.join( cloned_repo_dir, uploaded_file_filename ) )
- if istar:
- if remove_repo_files_not_in_tar:
- # Discover those files that are in the repository, but not in the uploaded archive
- filenames_in_archive = [ tarinfo_obj.name for tarinfo_obj in tar.getmembers() ]
- for root, dirs, files in os.walk( full_path ):
- relative_dir = root.split( 'repo_%d' % repository.id )[1].lstrip( '/' )
- if not root.find( '.hg' ) >= 0 and not root.find( 'hgrc' ) >= 0:
- if '.hg' in dirs:
- # Don't visit .hg directories
- dirs.remove( '.hg' )
- if 'hgrc' in files:
- # Don't include hgrc files in commit - should be impossible
- # since we don't visit .hg dirs, but just in case...
- files.remove( 'hgrc' )
- for name in files:
- if name not in filenames_in_archive:
- files_to_remove.append( os.path.join( relative_dir, name ) )
- # Extract the uploaded tarball to the load_point within the cloned repository hierarchy
- tar.extractall( path=full_path )
- tar.close()
- uploaded_file.close()
- else:
- # Move the uploaded file to the load_point within the cloned repository hierarchy
- shutil.move( uploaded_file_name, full_path )
- return files_to_remove
+ # Must have been an error selecting something that didn't exist, so default to repository root
+ upload_point = None
+ return upload_point
def __check_archive( self, archive ):
for member in archive.getmembers():
# Allow regular files and directories only
--- a/lib/galaxy/webapps/community/model/__init__.py Mon Jun 27 17:25:32 2011 -0400
+++ b/lib/galaxy/webapps/community/model/__init__.py Tue Jun 28 10:24:49 2011 -0400
@@ -5,6 +5,7 @@
the relationship cardinalities are obvious (e.g. prefer Dataset to Data)
"""
import os.path, os, errno, sys, codecs, operator, tempfile, logging, tarfile, mimetypes, ConfigParser
+from galaxy import util
from galaxy.util.bunch import Bunch
from galaxy.util.hash_util import *
from galaxy.web.form_builder import *
@@ -115,163 +116,30 @@
repo = hg.repository( ui.ui(), self.repo_path )
tip_ctx = repo.changectx( repo.changelog.tip() )
return tip_ctx.rev() < 0
-class Tool( object ):
- file_path = '/tmp' # Overridden in mapping.__init__()
- states = Bunch( NEW = 'new',
- ERROR = 'error',
- DELETED = 'deleted',
- WAITING = 'waiting',
- APPROVED = 'approved',
- REJECTED = 'rejected',
- ARCHIVED = 'archived' )
- def __init__( self, guid=None, tool_id=None, name=None, description=None, user_description=None,
- category=None, version=None, user_id=None, external_filename=None, suite=False ):
- self.guid = guid
- self.tool_id = tool_id
- self.name = name or "Unnamed tool"
- self.description = description
- self.user_description = user_description
- self.version = version or "1.0.0"
- self.user_id = user_id
- self.external_filename = external_filename
- self.deleted = False
- self.__extension = None
- self.suite = suite
- def get_file_name( self ):
- if not self.external_filename:
- assert self.id is not None, "ID must be set before filename used (commit the object)"
- dir = os.path.join( self.file_path, 'tools', *directory_hash_id( self.id ) )
- # Create directory if it does not exist
- if not os.path.exists( dir ):
- os.makedirs( dir )
- # Return filename inside hashed directory
- filename = os.path.join( dir, "tool_%d.dat" % self.id )
+ @property
+ def allow_push( self ):
+ repo = hg.repository( ui.ui(), self.repo_path )
+ return repo.ui.config( 'web', 'allow_push' )
+ def set_allow_push( self, usernames, remove_auth='' ):
+ allow_push = util.listify( self.allow_push )
+ if remove_auth:
+ allow_push.remove( remove_auth )
else:
- filename = self.external_filename
- # Make filename absolute
- return os.path.abspath( filename )
- def set_file_name( self, filename ):
- if not filename:
- self.external_filename = None
- else:
- self.external_filename = filename
- file_name = property( get_file_name, set_file_name )
- def create_from_datatype( self, datatype_bunch ):
- # TODO: ensure guid is unique and generate a new one if not.
- self.guid = datatype_bunch.guid
- self.tool_id = datatype_bunch.id
- self.name = datatype_bunch.name
- self.description = datatype_bunch.description
- self.version = datatype_bunch.version
- self.user_id = datatype_bunch.user.id
- self.suite = datatype_bunch.suite
- @property
- def state( self ):
- latest_event = self.latest_event
- if latest_event:
- return latest_event.state
- return None
- @property
- def latest_event( self ):
- if self.events:
- events = [ tea.event for tea in self.events ]
- # Get the last event that occurred ( events mapper is sorted descending )
- return events[0]
- return None
- # Tool states
- @property
- def is_new( self ):
- return self.state == self.states.NEW
- @property
- def is_error( self ):
- return self.state == self.states.ERROR
- @property
- def is_deleted( self ):
- return self.state == self.states.DELETED
- @property
- def is_waiting( self ):
- return self.state == self.states.WAITING
- @property
- def is_approved( self ):
- return self.state == self.states.APPROVED
- @property
- def is_rejected( self ):
- return self.state == self.states.REJECTED
- @property
- def is_archived( self ):
- return self.state == self.states.ARCHIVED
- def get_state_message( self ):
- if self.is_suite:
- label = 'tool suite'
- else:
- label = 'tool'
- if self.is_new:
- return '<font color="red"><b><i>This is an unsubmitted version of this %s</i></b></font>' % label
- if self.is_error:
- return '<font color="red"><b><i>This %s is in an error state</i></b></font>' % label
- if self.is_deleted:
- return '<font color="red"><b><i>This is a deleted version of this %s</i></b></font>' % label
- if self.is_waiting:
- return '<font color="red"><b><i>This version of this %s is awaiting administrative approval</i></b></font>' % label
- if self.is_approved:
- return '<b><i>This is the latest approved version of this %s</i></b>' % label
- if self.is_rejected:
- return '<font color="red"><b><i>This version of this %s has been rejected by an administrator</i></b></font>' % label
- if self.is_archived:
- return '<font color="red"><b><i>This is an archived version of this %s</i></b></font>' % label
- @property
- def extension( self ):
- # if instantiated via a query, this unmapped property won't exist
- if '_Tool__extension' not in dir( self ):
- self.__extension = None
- if self.__extension is None:
- head = open( self.file_name, 'rb' ).read( 4 )
- try:
- assert head[:3] == 'BZh'
- assert int( head[-1] ) in range( 0, 10 )
- self.__extension = 'tar.bz2'
- except AssertionError:
- pass
- if self.__extension is None:
- try:
- assert head[:2] == '\037\213'
- self.__extension = 'tar.gz'
- except:
- pass
- if self.__extension is None:
- self.__extension = 'tar'
- return self.__extension
- @property
- def is_suite( self ):
- return self.suite
- @property
- def label( self ):
- if self.is_suite:
- return 'tool suite'
- else:
- return 'tool'
- @property
- def type( self ):
- # Hack
- if self.is_suite:
- return 'toolsuite'
- return 'tool'
- @property
- def download_file_name( self ):
- return '%s_%s.%s' % ( self.tool_id, self.version, self.extension )
- @property
- def mimetype( self ):
- return mimetypes.guess_type( self.download_file_name )[0]
-
-class Event( object ):
- def __init__( self, state=None, comment='' ):
- self.state = state
- self.comment = comment
-
-class ToolEventAssociation( object ):
- def __init__( self, tool=None, event=None ):
- self.tool = tool
- self.event = event
+ for username in util.listify( usernames ):
+ if username not in allow_push:
+ allow_push.append( username )
+ allow_push = '%s\n' % ','.join( allow_push )
+ repo = hg.repository( ui.ui(), path=self.repo_path )
+ # Why doesn't the following work?
+ #repo.ui.setconfig( 'web', 'allow_push', allow_push )
+ lines = repo.opener( 'hgrc', 'rb' ).readlines()
+ fp = repo.opener( 'hgrc', 'wb' )
+ for line in lines:
+ if line.startswith( 'allow_push' ):
+ fp.write( 'allow_push = %s' % allow_push )
+ else:
+ fp.write( line )
+ fp.close()
class ItemRatingAssociation( object ):
def __init__( self, id=None, user=None, item=None, rating=0, comment='' ):
@@ -284,10 +152,6 @@
""" Set association's item. """
pass
-class ToolRatingAssociation( ItemRatingAssociation ):
- def set_item( self, tool ):
- self.tool = tool
-
class RepositoryRatingAssociation( ItemRatingAssociation ):
def set_item( self, repository ):
self.repository = repository
@@ -298,11 +162,6 @@
self.description = description
self.deleted = deleted
-class ToolCategoryAssociation( object ):
- def __init__( self, tool=None, category=None ):
- self.tool = tool
- self.category = category
-
class RepositoryCategoryAssociation( object ):
def __init__( self, repository=None, category=None ):
self.repository = repository
@@ -326,12 +185,6 @@
self.user_tname = user_tname
self.value = None
self.user_value = None
-
-class ToolTagAssociation ( ItemTagAssociation ):
- pass
-
-class ToolAnnotationAssociation( object ):
- pass
## ---- Utility methods -------------------------------------------------------
def sort_by_attr( seq, attr ):
--- a/templates/webapps/community/repository/browse_repository.mako Mon Jun 27 17:25:32 2011 -0400
+++ b/templates/webapps/community/repository/browse_repository.mako Tue Jun 28 10:24:49 2011 -0400
@@ -9,7 +9,7 @@
can_push = trans.app.security_agent.can_push( trans.user, repository )
can_upload = can_push
can_browse_contents = not is_new
- can_rate = repository.user != trans.user
+ can_rate = trans.user and repository.user != trans.user
can_manage = repository.user == trans.user
can_view_change_log = not is_new
%>
--- a/templates/webapps/community/repository/manage_repository.mako Mon Jun 27 17:25:32 2011 -0400
+++ b/templates/webapps/community/repository/manage_repository.mako Tue Jun 28 10:24:49 2011 -0400
@@ -9,7 +9,7 @@
can_push = trans.app.security_agent.can_push( trans.user, repository )
can_upload = can_push
can_browse_contents = not is_new
- can_rate = not is_new and repository.user != trans.user
+ can_rate = not is_new and trans.user and repository.user != trans.user
can_view_change_log = not is_new
if can_push:
browse_label = 'Browse or delete repository files'
--- a/templates/webapps/community/repository/upload.mako Mon Jun 27 17:25:32 2011 -0400
+++ b/templates/webapps/community/repository/upload.mako Tue Jun 28 10:24:49 2011 -0400
@@ -93,7 +93,7 @@
Supported compression types are gz and bz2. If <b>Yes</b> is selected, the uploaded file will be uncompressed. However,
if the uploaded file is an archive that contains compressed files, the contained files will not be uncompressed. For
example, if the uploaded compressed file is some_file.tar.gz, some_file.tar will be uncompressed and extracted, but if
- some_file.tar contains 4.bed.gz, the contained file 4.bed.gz will not be uncompressed.
+ some_file.tar contains some_contained_file.gz, the contained file will not be uncompressed.
</div></div><div class="form-row">
@@ -105,7 +105,7 @@
yes_selected = ''
no_selected = 'selected'
%>
- <label>Remove files in the repository (relative to the upload point) that are not in the uploaded archive?</label>
+ <label>Remove files in the repository (relative to the root or selected upload point) that are not in the uploaded archive?</label><div class="form-row-input"><select name="remove_repo_files_not_in_tar"><option value="true" ${yes_selected}>Yes
@@ -114,9 +114,9 @@
</div><div class="toolParamHelp" style="clear: both;">
This selection pertains only to uploaded tar archives, not to single file uploads. If <b>Yes</b> is selected, files
- that exist in the repository (relative to the upload point) but that are not in the uploaded archive will be removed
- from the repository. Otherwise, all existing repository files will remain and the uploaded archive files will be added
- to the repository.
+ that exist in the repository (relative to the root or selected upload point) but that are not in the uploaded archive
+ will be removed from the repository. Otherwise, all existing repository files will remain and the uploaded archive
+ files will be added to the repository.
</div></div><div class="form-row">
@@ -141,8 +141,9 @@
</div><input type="hidden" id="upload_point" name="upload_point" value=""/><div class="toolParamHelp" style="clear: both;">
- Select a location within the repository to upload your files by clicking a check box next to the location. If a location
- is not selected, files will be uploaded to the repository root.
+ Select a location within the repository to upload your files by clicking a check box next to the location. The
+ selected location is considered the upload point. If a location is not selected, the upload point will be the
+ repository root.
</div><div style="clear: both"></div></div>
--- a/templates/webapps/community/repository/view_changelog.mako Mon Jun 27 17:25:32 2011 -0400
+++ b/templates/webapps/community/repository/view_changelog.mako Tue Jun 28 10:24:49 2011 -0400
@@ -9,7 +9,7 @@
can_browse_contents = not is_new
can_manage = trans.user == repository.user
can_push = trans.app.security_agent.can_push( trans.user, repository )
- can_rate = repository.user != trans.user
+ can_rate = trans.user and repository.user != trans.user
can_upload = can_push
if can_push:
browse_label = 'Browse or delete repository files'
--- a/templates/webapps/community/repository/view_changeset.mako Mon Jun 27 17:25:32 2011 -0400
+++ b/templates/webapps/community/repository/view_changeset.mako Tue Jun 28 10:24:49 2011 -0400
@@ -7,7 +7,7 @@
from galaxy.web.framework.helpers import time_ago
is_new = repository.is_new
can_browse_contents = not is_new
- can_rate = repository.user != trans.user
+ can_rate = trans.user and repository.user != trans.user
can_manage = trans.user == repository.user
can_push = trans.app.security_agent.can_push( trans.user, repository )
can_view_change_log = not is_new
--- a/templates/webapps/community/repository/view_repository.mako Mon Jun 27 17:25:32 2011 -0400
+++ b/templates/webapps/community/repository/view_repository.mako Tue Jun 28 10:24:49 2011 -0400
@@ -7,7 +7,7 @@
from galaxy.web.framework.helpers import time_ago
is_new = repository.is_new
can_push = trans.app.security_agent.can_push( trans.user, repository )
- can_rate = not is_new and repository.user != trans.user
+ can_rate = not is_new and trans.user and repository.user != trans.user
can_upload = can_push
can_browse_contents = not is_new
can_view_change_log = not is_new
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
0
commit/galaxy-central: jgoecks: Additional security for loading visualizations.
by Bitbucket 27 Jun '11
by Bitbucket 27 Jun '11
27 Jun '11
1 new changeset in galaxy-central:
http://bitbucket.org/galaxy/galaxy-central/changeset/e132a1398caa/
changeset: e132a1398caa
user: jgoecks
date: 2011-06-27 23:25:32
summary: Additional security for loading visualizations.
affected #: 1 file (60 bytes)
--- a/lib/galaxy/web/controllers/tracks.py Mon Jun 27 16:58:52 2011 -0400
+++ b/lib/galaxy/web/controllers/tracks.py Mon Jun 27 17:25:32 2011 -0400
@@ -229,9 +229,7 @@
"""
Display browser for the datasets listed in `dataset_ids`.
"""
- decoded_id = trans.security.decode_id( id )
- session = trans.sa_session
- vis = session.query( model.Visualization ).get( decoded_id )
+ vis = self.get_visualization( trans, id, check_ownership=False, check_accessible=True )
viz_config = self.get_visualization_config( trans, vis )
new_dataset = kwargs.get("dataset_id", None)
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
0
commit/galaxy-central: jgoecks: Add generic method for getting track type and use it when saving visualizations.
by Bitbucket 27 Jun '11
by Bitbucket 27 Jun '11
27 Jun '11
1 new changeset in galaxy-central:
http://bitbucket.org/galaxy/galaxy-central/changeset/b13d16085dfc/
changeset: b13d16085dfc
user: jgoecks
date: 2011-06-27 22:58:52
summary: Add generic method for getting track type and use it when saving visualizations.
affected #: 2 files (861 bytes)
--- a/static/scripts/trackster.js Mon Jun 27 15:44:59 2011 -0400
+++ b/static/scripts/trackster.js Mon Jun 27 16:58:52 2011 -0400
@@ -1524,6 +1524,7 @@
* ----> FeatureTrack
* -------> ReadTrack
* -------> ToolDataFeatureTrack
+ * -------> VcfTrack
*/
var Track = function(name, view, parent_element, data_url, data_query_wait) {
//
@@ -1556,6 +1557,32 @@
this.parent_element.append(this.container_div);
};
extend(Track.prototype, {
+ /** Returns track type. */
+ get_type: function() {
+ // Order is important: start with most-specific classes and go up the track hierarchy.
+ if (this instanceof LabelTrack) {
+ return "LabelTrack";
+ }
+ else if (this instanceof ReferenceTrack) {
+ return "ReferenceTrack";
+ }
+ else if (this instanceof LineTrack) {
+ return "LineTrack";
+ }
+ else if (this instanceof ReadTrack) {
+ return "ReadTrack";
+ }
+ else if (this instanceof ToolDataFeatureTrack) {
+ return "ToolDataFeatureTrack";
+ }
+ else if (this instanceof VcfTrack) {
+ return "VcfTrack";
+ }
+ else if (this instanceof FeatureTrack) {
+ return "FeatureTrack";
+ }
+ return "";
+ },
/**
* Initialize and draw the track.
*/
--- a/templates/tracks/browser.mako Mon Jun 27 15:44:59 2011 -0400
+++ b/templates/tracks/browser.mako Mon Jun 27 16:58:52 2011 -0400
@@ -59,8 +59,7 @@
converted_datasets_state_url = "${h.url_for( action='converted_datasets_state' )}",
addable_track_types = { "LineTrack": LineTrack, "FeatureTrack": FeatureTrack, "ReadTrack": ReadTrack },
view;
-
-
+
/**
* Add bookmark.
*/
@@ -85,7 +84,7 @@
view.has_changes = true;
return new_bookmark;
- }
+ };
$(function() {
// Hide bookmarks by default right now.
@@ -267,7 +266,7 @@
// Add track.
tracks.push( {
- "track_type": track.track_type,
+ "track_type": track.get_type(),
"name": track.name,
"hda_ldda": track.hda_ldda,
"dataset_id": track.dataset_id,
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
0
commit/galaxy-central: guru: Rounded the outputs of regression to 10 significant digits.
by Bitbucket 27 Jun '11
by Bitbucket 27 Jun '11
27 Jun '11
1 new changeset in galaxy-central:
http://bitbucket.org/galaxy/galaxy-central/changeset/a3ef80ad2535/
changeset: a3ef80ad2535
user: guru
date: 2011-06-27 21:44:59
summary: Rounded the outputs of regression to 10 significant digits.
affected #: 2 files (631 bytes)
--- a/test-data/regr_out.tabular Mon Jun 27 11:20:04 2011 -0400
+++ b/test-data/regr_out.tabular Mon Jun 27 15:44:59 2011 -0400
@@ -1,10 +1,10 @@
Y-intercept -28.1169126094
-p-value (Y-intercept) 0.294263204753
-Slope (c1) 5.74713412453
-p-value (c1) 0.0017328770415
-Slope (c2) 0.904274537427
-p-value (c2) 0.114667546826
-R-squared 0.938805439971
-Adjusted R-squared 0.921321279962
-F-statistic {'dendf': 7.0, 'value': 53.694626422997381, 'numdf': 2.0}
-Sigma 7.43450071131
+p-value (Y-intercept) 0.2942632048
+Slope (c1) 5.7471341245
+p-value (c1) 0.001732877
+Slope (c2) 0.9042745374
+p-value (c2) 0.1146675468
+R-squared 0.93881
+Adjusted R-squared 0.92132
+F-statistic {'dendf': 7.0, 'value': '53.69463', 'numdf': 2.0}
+Sigma 7.4345007113
--- a/tools/regVariation/linear_regression.py Mon Jun 27 11:20:04 2011 -0400
+++ b/tools/regVariation/linear_regression.py Mon Jun 27 15:44:59 2011 -0400
@@ -68,7 +68,6 @@
coeffs=linear_model.as_py()['coefficients']
yintercept= coeffs['(Intercept)']
-print >>fout, "Y-intercept\t%s" %(yintercept)
summary = r.summary(linear_model)
co = summary.get('coefficients', 'NA')
@@ -76,15 +75,23 @@
if len(co) != len(x_vals)+1:
stop_err("Stopped performing linear regression on the input data, since one of the predictor columns contains only non-numeric or invalid values.")
"""
-print >>fout, "p-value (Y-intercept)\t%s" %(co[0][3])
+
+try:
+ yintercept = r.round(float(yintercept), digits=10)
+ pvaly = r.round(float(co[0][3]), digits=10)
+except:
+ pass
+
+print >>fout, "Y-intercept\t%s" %(yintercept)
+print >>fout, "p-value (Y-intercept)\t%s" %(pvaly)
if len(x_vals) == 1: #Simple linear regression case with 1 predictor variable
try:
- slope = coeffs['x']
+ slope = r.round(float(coeffs['x']), digits=10)
except:
slope = 'NA'
try:
- pval = co[1][3]
+ pval = r.round(float(co[1][3]), digits=10)
except:
pval = 'NA'
print >>fout, "Slope (c%d)\t%s" %(x_cols[0]+1,slope)
@@ -92,18 +99,36 @@
else: #Multiple regression case with >1 predictors
ind=1
while ind < len(coeffs.keys()):
- print >>fout, "Slope (c%d)\t%s" %(x_cols[ind-1]+1,coeffs['x'+str(ind)])
try:
- pval = co[ind][3]
+ slope = r.round(float(coeffs['x'+str(ind)]), digits=10)
+ except:
+ slope = 'NA'
+ print >>fout, "Slope (c%d)\t%s" %(x_cols[ind-1]+1,slope)
+ try:
+ pval = r.round(float(co[ind][3]), digits=10)
except:
pval = 'NA'
print >>fout, "p-value (c%d)\t%s" %(x_cols[ind-1]+1,pval)
ind+=1
-print >>fout, "R-squared\t%s" %(summary.get('r.squared','NA'))
-print >>fout, "Adjusted R-squared\t%s" %(summary.get('adj.r.squared','NA'))
-print >>fout, "F-statistic\t%s" %(summary.get('fstatistic','NA'))
-print >>fout, "Sigma\t%s" %(summary.get('sigma','NA'))
+rsq = summary.get('r.squared','NA')
+adjrsq = summary.get('adj.r.squared','NA')
+fstat = summary.get('fstatistic','NA')
+sigma = summary.get('sigma','NA')
+
+try:
+ rsq = r.round(float(rsq), digits=5)
+ adjrsq = r.round(float(adjrsq), digits=5)
+ fval = r.round(fstat['value'], digits=5)
+ fstat['value'] = str(fval)
+ sigma = r.round(float(sigma), digits=10)
+except:
+ pass
+
+print >>fout, "R-squared\t%s" %(rsq)
+print >>fout, "Adjusted R-squared\t%s" %(adjrsq)
+print >>fout, "F-statistic\t%s" %(fstat)
+print >>fout, "Sigma\t%s" %(sigma)
r.pdf( outfile2, 8, 8 )
if len(x_vals) == 1: #Simple linear regression case with 1 predictor variable
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
0
commit/galaxy-central: kellyv: Add missed dbkey setting to Tophat color-space wrapper
by Bitbucket 27 Jun '11
by Bitbucket 27 Jun '11
27 Jun '11
1 new changeset in galaxy-central:
http://bitbucket.org/galaxy/galaxy-central/changeset/0d9e5403de5b/
changeset: 0d9e5403de5b
user: kellyv
date: 2011-06-27 17:20:04
summary: Add missed dbkey setting to Tophat color-space wrapper
affected #: 2 files (3.4 KB)
--- a/tools/ngs_rna/tophat_color_wrapper.xml Fri Jun 24 16:55:43 2011 -0400
+++ b/tools/ngs_rna/tophat_color_wrapper.xml Mon Jun 27 11:20:04 2011 -0400
@@ -391,6 +391,23 @@
( singlePaired['pParams']['indel_search']['allow_indel_search'] == 'Yes' ) )
)
</filter>
+ <actions>
+ <conditional name="refGenomeSource.genomeSource">
+ <when value="indexed">
+ <action type="metadata" name="dbkey">
+ <option type="from_data_table" name="tophat_indexes_color" column="1" offset="0">
+ <filter type="param_value" column="0" value="#" compare="startswith" keep="False"/>
+ <filter type="param_value" ref="refGenomeSource.index" column="0"/>
+ </option>
+ </action>
+ </when>
+ <when value="history">
+ <action type="metadata" name="dbkey">
+ <option type="from_param" name="refGenomeSource.ownFile" param_attribute="dbkey" />
+ </action>
+ </when>
+ </conditional>
+ </actions></data><data format="bed" name="deletions" label="${tool.name} on ${on_string}: deletions" from_work_dir="tophat_out/deletions.bed"><filter>
@@ -401,9 +418,62 @@
( singlePaired['pParams']['indel_search']['allow_indel_search'] == 'Yes' ) )
)
</filter>
+ <actions>
+ <conditional name="refGenomeSource.genomeSource">
+ <when value="indexed">
+ <action type="metadata" name="dbkey">
+ <option type="from_data_table" name="tophat_indexes_color" column="1" offset="0">
+ <filter type="param_value" column="0" value="#" compare="startswith" keep="False"/>
+ <filter type="param_value" ref="refGenomeSource.index" column="0"/>
+ </option>
+ </action>
+ </when>
+ <when value="history">
+ <action type="metadata" name="dbkey">
+ <option type="from_param" name="refGenomeSource.ownFile" param_attribute="dbkey" />
+ </action>
+ </when>
+ </conditional>
+ </actions></data>
- <data format="bed" name="junctions" label="${tool.name} on ${on_string}: splice junctions"/>
- <data format="bam" name="accepted_hits" label="${tool.name} on ${on_string}: accepted_hits"/>
+ <data format="bed" name="junctions" label="${tool.name} on ${on_string}: splice junctions">
+ <actions>
+ <conditional name="refGenomeSource.genomeSource">
+ <when value="indexed">
+ <action type="metadata" name="dbkey">
+ <option type="from_data_table" name="tophat_indexes_color" column="1" offset="0">
+ <filter type="param_value" column="0" value="#" compare="startswith" keep="False"/>
+ <filter type="param_value" ref="refGenomeSource.index" column="0"/>
+ </option>
+ </action>
+ </when>
+ <when value="history">
+ <action type="metadata" name="dbkey">
+ <option type="from_param" name="refGenomeSource.ownFile" param_attribute="dbkey" />
+ </action>
+ </when>
+ </conditional>
+ </actions>
+ </data>
+ <data format="bam" name="accepted_hits" label="${tool.name} on ${on_string}: accepted_hits">
+ <actions>
+ <conditional name="refGenomeSource.genomeSource">
+ <when value="indexed">
+ <action type="metadata" name="dbkey">
+ <option type="from_data_table" name="tophat_indexes_color" column="1" offset="0">
+ <filter type="param_value" column="0" value="#" compare="startswith" keep="False"/>
+ <filter type="param_value" ref="refGenomeSource.index" column="0"/>
+ </option>
+ </action>
+ </when>
+ <when value="history">
+ <action type="metadata" name="dbkey">
+ <option type="from_param" name="refGenomeSource.ownFile" param_attribute="dbkey" />
+ </action>
+ </when>
+ </conditional>
+ </actions>
+ </data></outputs><tests><!-- Test color-space single-end reads with user-supplied reference fasta and preset parameters -->
--- a/tools/ngs_rna/tophat_wrapper.xml Fri Jun 24 16:55:43 2011 -0400
+++ b/tools/ngs_rna/tophat_wrapper.xml Mon Jun 27 11:20:04 2011 -0400
@@ -386,7 +386,7 @@
( singlePaired['sParams']['indel_search']['allow_indel_search'] == 'Yes' ) ) or
( ( 'pParams' in singlePaired ) and ( 'indel_search' in singlePaired['pParams'] ) and
( singlePaired['pParams']['indel_search']['allow_indel_search'] == 'Yes' ) )
- )
+ )
</filter><actions><conditional name="refGenomeSource.genomeSource">
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
0
2 new changesets in galaxy-central:
http://bitbucket.org/galaxy/galaxy-central/changeset/d4bedd464938/
changeset: d4bedd464938
user: kellyv
date: 2011-06-24 22:13:48
summary: Added new builds to manual builds list
affected #: 1 file (209 bytes)
--- a/tool-data/shared/ucsc/manual_builds.txt Thu Jun 23 15:39:57 2011 -0400
+++ b/tool-data/shared/ucsc/manual_builds.txt Fri Jun 24 16:13:48 2011 -0400
@@ -702,3 +702,5 @@
Tcas_3.0 Red Flour Beetle (Tribolium castaneum) chrLG1=X=10877635,chrLG2=20218415,chrLG3=38791480,chrLG4=13894384,chrLG5=19135781,chrLG6=13176827,chrLG7=20532854,chrLG8=18021898,chrLG9=21459655,chrLG10=11386040
hg_g1k_v37 Homo sapiens b37 1=249250621,2=243199373,3=198022430,4=191154276,5=180915260,6=171115067,7=159138663,8=146364022,9=141213431,10=135534747,11=135006516,12=133851895,13=115169878,14=107349540,15=102531392,16=90354753,17=81195210,18=78077248,19=59128983,20=63025520,21=48129895,22=51304566,X=155270560,Y=59373566,MT=16569,GL000207.1=4262,GL000226.1=15008,GL000229.1=19913,GL000231.1=27386,GL000210.1=27682,GL000239.1=33824,GL000235.1=34474,GL000201.1=36148,GL000247.1=36422,GL000245.1=36651,GL000197.1=37175,GL000203.1=37498,GL000246.1=38154,GL000249.1=38502,GL000196.1=38914,GL000248.1=39786,GL000244.1=39929,GL000238.1=39939,GL000202.1=40103,GL000234.1=40531,GL000232.1=40652,GL000206.1=41001,GL000240.1=41933,GL000236.1=41934,GL000241.1=42152,GL000243.1=43341,GL000242.1=43523,GL000230.1=43691,GL000237.1=45867,GL000233.1=45941,GL000204.1=81310,GL000198.1=90085,GL000208.1=92689,GL000191.1=106433,GL000227.1=128374,GL000228.1=129120,GL000214.1=137718,GL000221.1=155397,GL000209.1=159169,GL000218.1=161147,GL000220.1=161802,GL000213.1=164239,GL000211.1=166566,GL000199.1=169874,GL000217.1=172149,GL000216.1=172294,GL000215.1=172545,GL000205.1=174588,GL000219.1=179198,GL000224.1=179693,GL000223.1=180455,GL000195.1=182896,GL000212.1=186858,GL000222.1=186861,GL000200.1=187035,GL000193.1=189789,GL000194.1=191469,GL000225.1=211173,GL000192.1=547496
Homo_sapiens_nuHg19_mtrCRS Homo sapiens (hg19 with mtDNA replaced with rCRS) chr1=249250621,chr2=243199373,chr3=198022430,chr4=191154276,chr5=180915260,chr6=171115067,chr7=159138663,chr8=146364022,chr9=141213431,chr10=135534747,chr11=135006516,chr12=133851895,chr13=115169878,chr14=107349540,chr15=102531392,chr16=90354753,chr17=81195210,chr18=78077248,chr19=59128983,chr20=63025520,chr21=48129895,chr22=51304566,chrX=155270560,chrY=59373566,chrM=16569,chr1_gl000191_random=106433,chr1_gl000192_random=547496,chr4_ctg9_hap1=590426,chr4_gl000193_random=189789,chr4_gl000194_random=191469,chr6_apd_hap1=4622290,chr6_cox_hap2=4795371,chr6_dbb_hap3=4610396,chr6_mann_hap4=4683263,chr6_mcf_hap5=4833398,chr6_qbl_hap6=4611984,chr6_ssto_hap7=4928567,chr7_gl000195_random=182896,chr8_gl000196_random=38914,chr8_gl000197_random=37175,chr9_gl000198_random=90085,chr9_gl000199_random=169874,chr9_gl000200_random=187035,chr9_gl000201_random=36148,chr11_gl000202_random=40103,chr17_ctg5_hap1=1680828,chr17_gl000203_random=37498,chr17_gl000204_random=81310,chr17_gl000205_random=174588,chr17_gl000206_random=41001,chr18_gl000207_random=4262,chr19_gl000208_random=92689,chr19_gl000209_random=159169,chr21_gl000210_random=27682,chrUn_gl000211=166566,chrUn_gl000212=186858,chrUn_gl000213=164239,chrUn_gl000214=137718,chrUn_gl000215=172545,chrUn_gl000216=172294,chrUn_gl000217=172149,chrUn_gl000218=161147,chrUn_gl000219=179198,chrUn_gl000220=161802,chrUn_gl000221=155397,chrUn_gl000222=186861,chrUn_gl000223=180455,chrUn_gl000224=179693,chrUn_gl000225=211173,chrUn_gl000226=15008,chrUn_gl000227=128374,chrUn_gl000228=129120,chrUn_gl000229=19913,chrUn_gl000230=43691,chrUn_gl000231=27386,chrUn_gl000232=40652,chrUn_gl000233=45941,chrUn_gl000234=40531,chrUn_gl000235=34474,chrUn_gl000236=41934,chrUn_gl000237=45867,chrUn_gl000238=39939,chrUn_gl000239=33824,chrUn_gl000240=41933,chrUn_gl000241=42152,chrUn_gl000242=43523,chrUn_gl000243=43341,chrUn_gl000244=39929,chrUn_gl000245=36651,chrUn_gl000246=38154,chrUn_gl000247=36422,chrUn_gl000248=39786,chrUn_gl000249=38502
+Arabidopsis_thaliana_TAIR10 Arabidopsis thaliana TAIR10 (Arabidopsis_thaliana_TAIR10) chr1=30427671,chr2=19698289,chr3=23459830,chr4=18585056,chr5=26975502,chrM=366924,chrC=154478
+dp4 D. pseudoobscura (dp4)
http://bitbucket.org/galaxy/galaxy-central/changeset/eb26eb407efa/
changeset: eb26eb407efa
user: kellyv
date: 2011-06-24 22:55:43
summary: Added color-space Tophat wrapper
affected #: 21 files (438.5 KB)
Diff too large to display.
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
0
23 Jun '11
1 new changeset in galaxy-central:
http://bitbucket.org/galaxy/galaxy-central/changeset/0966a9170e68/
changeset: 0966a9170e68
user: greg
date: 2011-06-23 21:39:57
summary: Bug fix for change set c996393163e1.
affected #: 1 file (28 bytes)
--- a/lib/galaxy/webapps/community/controllers/repository.py Thu Jun 23 15:32:07 2011 -0400
+++ b/lib/galaxy/webapps/community/controllers/repository.py Thu Jun 23 15:39:57 2011 -0400
@@ -117,7 +117,7 @@
model.User.table.c.email == column_filter ) )
class EmailAlertsColumn( grids.TextColumn ):
def get_value( self, trans, grid, repository ):
- if trans.user.email in from_json_string( repository.email_alerts ):
+ if repository.email_alerts and trans.user.email in from_json_string( repository.email_alerts ):
return 'yes'
return ''
# Grid definition
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
0
commit/galaxy-central: greg: Add the ability to select Galaxy tool shed repositories to receive email alerts when they are updated. Also remove a broken link on the Galaxy tool shed Help menu.
by Bitbucket 23 Jun '11
by Bitbucket 23 Jun '11
23 Jun '11
1 new changeset in galaxy-central:
http://bitbucket.org/galaxy/galaxy-central/changeset/c996393163e1/
changeset: c996393163e1
user: greg
date: 2011-06-23 21:32:07
summary: Add the ability to select Galaxy tool shed repositories to receive email alerts when they are updated. Also remove a broken link on the Galaxy tool shed Help menu.
affected #: 12 files (10.3 KB)
--- a/lib/galaxy/webapps/community/config.py Thu Jun 23 11:03:45 2011 -0400
+++ b/lib/galaxy/webapps/community/config.py Thu Jun 23 15:32:07 2011 -0400
@@ -54,6 +54,9 @@
self.mailing_join_addr = kwargs.get('mailing_join_addr',"galaxy-user-join(a)bx.psu.edu")
self.error_email_to = kwargs.get( 'error_email_to', None )
self.smtp_server = kwargs.get( 'smtp_server', None )
+ self.smtp_username = kwargs.get( 'smtp_username', None )
+ self.smtp_password = kwargs.get( 'smtp_password', None )
+ self.email_alerts_from = kwargs.get( 'email_alerts_from', None )
self.log_actions = string_as_bool( kwargs.get( 'log_actions', 'False' ) )
self.brand = kwargs.get( 'brand', None )
self.wiki_url = kwargs.get( 'wiki_url', 'http://bitbucket.org/galaxy/galaxy-central/wiki/Home' )
--- a/lib/galaxy/webapps/community/controllers/common.py Thu Jun 23 11:03:45 2011 -0400
+++ b/lib/galaxy/webapps/community/controllers/common.py Thu Jun 23 15:32:07 2011 -0400
@@ -1,4 +1,7 @@
-import os, tarfile, tempfile, shutil
+import os, tarfile, tempfile, shutil, string, socket
+from time import strftime
+from datetime import *
+from galaxy.util.json import from_json_string, to_json_string
from galaxy.web.base.controller import *
from galaxy.webapps.community import model
from galaxy.model.orm import *
@@ -9,6 +12,25 @@
import logging
log = logging.getLogger( __name__ )
+email_alert_template = """
+GALAXY TOOL SHED REPOSITORY UPDATE ALERT
+-----------------------------------------------------------------------------
+You received this alert because you registered to receive email whenever
+changes were made to the repository named "${repository_name}".
+-----------------------------------------------------------------------------
+
+Date of change: ${display_date}
+Changed by: ${username}
+
+Revision: ${revision}
+Change description:
+${description}
+
+-----------------------------------------------------------------------------
+This change alert was sent from the Galaxy tool shed hosted on the server
+"${host}"
+"""
+
# States for passing messages
SUCCESS, INFO, WARNING, ERROR = "done", "info", "warning", "error"
@@ -95,6 +117,42 @@
os.chdir( cloned_repo_dir )
os.system( cmd )
os.chdir( current_working_dir )
+ smtp_server = trans.app.config.smtp_server
+ if smtp_server and repository.email_alerts:
+ # Send email alert to users that want them.
+ if trans.app.config.email_alerts_from is not None:
+ email_alerts_from = trans.app.config.email_alerts_from
+ elif trans.request.host.split( ':' )[0] == 'localhost':
+ email_alerts_from = 'galaxy-no-reply@' + socket.getfqdn()
+ else:
+ email_alerts_from = 'galaxy-no-reply@' + trans.request.host.split( ':' )[0]
+ tip_changeset = repo.changelog.tip()
+ ctx = repo.changectx( tip_changeset )
+ t, tz = ctx.date()
+ date = datetime( *time.gmtime( float( t ) - tz )[:6] )
+ display_date = date.strftime( "%Y-%m-%d" )
+ try:
+ username = ctx.user().split()[0]
+ except:
+ username = ctx.user()
+ # Build the email message
+ body = string.Template( email_alert_template ) \
+ .safe_substitute( host=trans.request.host,
+ repository_name=repository.name,
+ revision='%s:%s' %( str( ctx.rev() ), ctx ),
+ display_date=display_date,
+ description=ctx.description(),
+ username=username )
+ frm = email_alerts_from
+ subject = "Galaxy tool shed repository update alert"
+ email_alerts = from_json_string( repository.email_alerts )
+ for email in email_alerts:
+ to = email.strip()
+ # Send it
+ try:
+ 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 hg_remove( file_path, current_working_dir, cloned_repo_dir ):
# Remove a file path from a cloned repository. Since mercurial doesn't track
# directories (only files), directories are automatically removed when they
--- a/lib/galaxy/webapps/community/controllers/repository.py Thu Jun 23 11:03:45 2011 -0400
+++ b/lib/galaxy/webapps/community/controllers/repository.py Thu Jun 23 15:32:07 2011 -0400
@@ -5,9 +5,11 @@
from galaxy import util
from galaxy.datatypes.checkers import *
from galaxy.web.base.controller import *
+from galaxy.web.form_builder import CheckboxField
from galaxy.webapps.community import model
from galaxy.webapps.community.model import directory_hash_id
from galaxy.web.framework.helpers import time_ago, iff, grids
+from galaxy.util.json import from_json_string, to_json_string
from galaxy.model.orm import *
from common import *
from mercurial import hg, ui, patch
@@ -113,6 +115,11 @@
return query
return query.filter( and_( model.Repository.table.c.user_id == model.User.table.c.id,
model.User.table.c.email == column_filter ) )
+ class EmailAlertsColumn( grids.TextColumn ):
+ def get_value( self, trans, grid, repository ):
+ if trans.user.email in from_json_string( repository.email_alerts ):
+ return 'yes'
+ return ''
# Grid definition
title = "Repositories"
model_class = model.Repository
@@ -139,6 +146,8 @@
key="username" ),
grids.CommunityRatingColumn( "Average Rating",
key="rating" ),
+ EmailAlertsColumn( "Alert",
+ attach_popup=False ),
# Columns that are valid for filtering but are not visible.
EmailColumn( "Email",
model_class=model.User,
@@ -154,7 +163,10 @@
key="free-text-search",
visible=False,
filterable="standard" ) )
- operations = []
+ operations = [ grids.GridOperation( "Receive email alerts",
+ allow_multiple=True,
+ condition=( lambda item: not item.deleted ),
+ async_compatible=False ) ]
standard_filters = []
default_filter = {}
num_rows_per_page = 50
@@ -248,6 +260,10 @@
category_id = kwd.get( 'id', None )
category = get_category( trans, category_id )
kwd[ 'f-Category.name' ] = category.name
+ elif operation == "receive email alerts":
+ return trans.response.send_redirect( web.url_for( controller='repository',
+ action='set_email_alerts',
+ **kwd ) )
# Render the list view
return self.repository_list_grid( trans, **kwd )
@web.expose
@@ -485,6 +501,30 @@
tip = get_repository_tip( repo )
avg_rating, num_ratings = self.get_ave_item_rating_data( trans.sa_session, repository, webapp_model=trans.model )
display_reviews = util.string_as_bool( params.get( 'display_reviews', False ) )
+ alerts = params.get( 'alerts', '' )
+ alerts_checked = CheckboxField.is_checked( alerts )
+ if repository.email_alerts:
+ email_alerts = from_json_string( repository.email_alerts )
+ else:
+ email_alerts = []
+ user = trans.user
+ if params.get( 'receive_email_alerts_button', False ):
+ flush_needed = False
+ if alerts_checked:
+ if user.email not in email_alerts:
+ email_alerts.append( user.email )
+ repository.email_alerts = to_json_string( email_alerts )
+ flush_needed = True
+ else:
+ if user.email in email_alerts:
+ email_alerts.remove( user.email )
+ repository.email_alerts = to_json_string( email_alerts )
+ flush_needed = True
+ if flush_needed:
+ trans.sa_session.add( repository )
+ trans.sa_session.flush()
+ checked = alerts_checked or user.email in email_alerts
+ alerts_check_box = CheckboxField( 'alerts', checked=checked )
return trans.fill_template( '/webapps/community/repository/view_repository.mako',
repo=repo,
repository=repository,
@@ -492,6 +532,7 @@
avg_rating=avg_rating,
display_reviews=display_reviews,
num_ratings=num_ratings,
+ alerts_check_box=alerts_check_box,
message=message,
status=status )
@web.expose
@@ -507,11 +548,18 @@
description = util.restore_text( params.get( 'description', repository.description ) )
avg_rating, num_ratings = self.get_ave_item_rating_data( trans.sa_session, repository, webapp_model=trans.model )
display_reviews = util.string_as_bool( params.get( 'display_reviews', False ) )
+ alerts = params.get( 'alerts', '' )
+ alerts_checked = CheckboxField.is_checked( alerts )
+ if repository.email_alerts:
+ email_alerts = from_json_string( repository.email_alerts )
+ else:
+ email_alerts = []
allow_push = params.get( 'allow_push', '' )
error = False
+ user = trans.user
if params.get( 'edit_repository_button', False ):
flush_needed = False
- if trans.user != repository.user:
+ if user != repository.user:
message = "You are not the owner of this repository, so you cannot manage it."
status = error
return trans.response.send_redirect( web.url_for( controller='repository',
@@ -520,7 +568,7 @@
message=message,
status=status ) )
if repo_name != repository.name:
- message = self.__validate_repository_name( repo_name, trans.user )
+ message = self.__validate_repository_name( repo_name, user )
if message:
error = True
else:
@@ -545,10 +593,27 @@
usernames.append( user.username )
usernames = ','.join( usernames )
self.__set_allow_push( repository, usernames, remove_auth=remove_auth )
+ elif params.get( 'receive_email_alerts_button', False ):
+ flush_needed = False
+ if alerts_checked:
+ if user.email not in email_alerts:
+ email_alerts.append( user.email )
+ repository.email_alerts = to_json_string( email_alerts )
+ flush_needed = True
+ else:
+ if user.email in email_alerts:
+ email_alerts.remove( user.email )
+ repository.email_alerts = to_json_string( email_alerts )
+ flush_needed = True
+ if flush_needed:
+ trans.sa_session.add( repository )
+ trans.sa_session.flush()
if error:
status = 'error'
current_allow_push_list = self.__get_allow_push( repository ).split( ',' )
allow_push_select_field = self.__build_allow_push_select_field( trans, current_allow_push_list )
+ checked = alerts_checked or user.email in email_alerts
+ alerts_check_box = CheckboxField( 'alerts', checked=checked )
return trans.fill_template( '/webapps/community/repository/manage_repository.mako',
repo_name=repo_name,
description=description,
@@ -560,6 +625,7 @@
avg_rating=avg_rating,
display_reviews=display_reviews,
num_ratings=num_ratings,
+ alerts_check_box=alerts_check_box,
message=message,
status=status )
@web.expose
@@ -666,6 +732,42 @@
message=message,
status=status )
@web.expose
+ def set_email_alerts( self, trans, **kwd ):
+ # Set email alerts for selected repositories
+ params = util.Params( kwd )
+ user = trans.user
+ repository_ids = util.listify( kwd.get( 'id', '' ) )
+ total_alerts_added = 0
+ total_alerts_removed = 0
+ for repository_id in repository_ids:
+ flush_needed = False
+ repository = get_repository( trans, repository_id )
+ if repository.email_alerts:
+ email_alerts = from_json_string( repository.email_alerts )
+ else:
+ email_alerts = []
+ if user.email in email_alerts:
+ email_alerts.remove( user.email )
+ repository.email_alerts = to_json_string( email_alerts )
+ trans.sa_session.add( repository )
+ flush_needed = True
+ total_alerts_removed += 1
+ else:
+ email_alerts.append( user.email )
+ repository.email_alerts = to_json_string( email_alerts )
+ trans.sa_session.add( repository )
+ flush_needed = True
+ total_alerts_added += 1
+ if flush_needed:
+ trans.sa_session.flush()
+ message = 'Total alerts added: %d, total alerts removed: %d' % ( total_alerts_added, total_alerts_removed )
+ kwd[ 'message' ] = message
+ kwd[ 'status' ] = 'done'
+ del( kwd[ 'operation' ] )
+ return trans.response.send_redirect( web.url_for( controller='repository',
+ action='browse_repositories',
+ **kwd ) )
+ @web.expose
def download( self, trans, repository_id, file_type, **kwd ):
# Download an archive of the repository files compressed as zip, gz or bz2.
params = util.Params( kwd )
--- a/lib/galaxy/webapps/community/model/__init__.py Thu Jun 23 11:03:45 2011 -0400
+++ b/lib/galaxy/webapps/community/model/__init__.py Thu Jun 23 15:32:07 2011 -0400
@@ -19,8 +19,6 @@
self.deleted = False
self.purged = False
self.username = None
- # Relationships
- self.tools = []
def set_password_cleartext( self, cleartext ):
"""Set 'self.password' to the digest of 'cleartext'."""
self.password = new_secure_hash( text_type=cleartext )
@@ -90,11 +88,12 @@
MARKED_FOR_REMOVAL = 'r',
MARKED_FOR_ADDITION = 'a',
NOT_TRACKED = '?' )
- def __init__( self, name=None, description=None, user_id=None, private=False ):
+ def __init__( self, name=None, description=None, user_id=None, private=False, email_alerts=None ):
self.name = name or "Unnamed repository"
self.description = description
self.user_id = user_id
self.private = private
+ self.email_alerts = email_alerts
@property
def repo_path( self ):
# Repository locations on disk are defined in the hgweb.config file
--- a/lib/galaxy/webapps/community/model/mapping.py Thu Jun 23 11:03:45 2011 -0400
+++ b/lib/galaxy/webapps/community/model/mapping.py Thu Jun 23 15:32:07 2011 -0400
@@ -106,7 +106,8 @@
Column( "description" , TEXT ),
Column( "user_id", Integer, ForeignKey( "galaxy_user.id" ), index=True ),
Column( "private", Boolean, default=False ),
- Column( "deleted", Boolean, index=True, default=False ) )
+ Column( "deleted", Boolean, index=True, default=False ),
+ Column( "email_alerts", JSONType, nullable=True ) )
RepositoryRatingAssociation.table = Table( "repository_rating_association", metadata,
Column( "id", Integer, primary_key=True ),
--- a/lib/galaxy/webapps/community/model/migrate/versions/0001_initial_tables.py Thu Jun 23 11:03:45 2011 -0400
+++ b/lib/galaxy/webapps/community/model/migrate/versions/0001_initial_tables.py Thu Jun 23 15:32:07 2011 -0400
@@ -11,8 +11,14 @@
# Need our custom types, but don't import anything else from model
from galaxy.model.custom_types import *
-import logging
+import sys, logging
log = logging.getLogger( __name__ )
+log.setLevel(logging.DEBUG)
+handler = logging.StreamHandler( sys.stdout )
+format = "%(name)s %(levelname)s %(asctime)s %(message)s"
+formatter = logging.Formatter( format )
+handler.setFormatter( formatter )
+log.addHandler( handler )
metadata = MetaData( migrate_engine )
--- a/lib/galaxy/webapps/community/model/migrate/versions/0002_add_tool_suite_column.py Thu Jun 23 11:03:45 2011 -0400
+++ b/lib/galaxy/webapps/community/model/migrate/versions/0002_add_tool_suite_column.py Thu Jun 23 15:32:07 2011 -0400
@@ -7,8 +7,14 @@
from migrate import *
from migrate.changeset import *
-import logging
+import sys, logging
log = logging.getLogger( __name__ )
+log.setLevel(logging.DEBUG)
+handler = logging.StreamHandler( sys.stdout )
+format = "%(name)s %(levelname)s %(asctime)s %(message)s"
+formatter = logging.Formatter( format )
+handler.setFormatter( formatter )
+log.addHandler( handler )
metadata = MetaData( migrate_engine )
db_session = scoped_session( sessionmaker( bind=migrate_engine, autoflush=False, autocommit=True ) )
@@ -16,7 +22,6 @@
def upgrade():
print __doc__
metadata.reflect()
-
# Create and initialize imported column in job table.
Tool_table = Table( "tool", metadata, autoload=True )
c = Column( "suite", Boolean, default=False, index=True )
@@ -24,22 +29,19 @@
# Create
c.create( Tool_table )
assert c is Tool_table.c.suite
-
# Initialize.
if migrate_engine.name == 'mysql' or migrate_engine.name == 'sqlite':
default_false = "0"
elif migrate_engine.name == 'postgres':
default_false = "false"
db_session.execute( "UPDATE tool SET suite=%s" % default_false )
-
except Exception, e:
print "Adding suite column to the tool table failed: %s" % str( e )
log.debug( "Adding suite column to the tool table failed: %s" % str( e ) )
def downgrade():
metadata.reflect()
-
- # Drop imported column from job table.
+ # Drop suite column from tool table.
Tool_table = Table( "tool", metadata, autoload=True )
try:
Tool_table.c.suite.drop()
--- a/templates/display_common.mako Thu Jun 23 11:03:45 2011 -0400
+++ b/templates/display_common.mako Thu Jun 23 15:32:07 2011 -0400
@@ -2,6 +2,8 @@
## Utilities for sharing items and displaying shared items.
## HACK: these should probably go in the web helper object.
##
+## TODO: FIXME Cannot import model here, because grids are
+## used across webapps, and each webapp has it's own model.
<%! from galaxy import model %>
@@ -88,7 +90,7 @@
elif a_class == model.UserOpenID:
class_plural = "OpenIDs"
else:
- class_plural = a_class.__name__ + "s"
+ class_plural = "items"
return class_plural
%></%def>
--- a/templates/webapps/community/base_panels.mako Thu Jun 23 11:03:45 2011 -0400
+++ b/templates/webapps/community/base_panels.mako Thu Jun 23 15:32:07 2011 -0400
@@ -33,7 +33,6 @@
<a>Help</a><div class="submenu"><ul>
- <li><a target="galaxy_main" href="${h.url_for( controller='tool', action='help' )}">How to upload, download and install tools</a></li><li><a href="${app.config.get( "bugs_email", "mailto:galaxy-bugs@bx.psu.edu" )}">Email comments, bug reports, or suggestions</a></li><li><a target="_blank" href="${app.config.get( "wiki_url", "http://bitbucket.org/galaxy/galaxy-central/wiki" )}">Galaxy Wiki</a></li><li><a target="_blank" href="${app.config.get( "screencasts_url", "http://galaxycast.org" )}">Video tutorials (screencasts)</a></li>
--- a/templates/webapps/community/repository/manage_repository.mako Thu Jun 23 11:03:45 2011 -0400
+++ b/templates/webapps/community/repository/manage_repository.mako Thu Jun 23 15:32:07 2011 -0400
@@ -137,6 +137,26 @@
</form></div></div>
+%if trans.app.config.smtp_server:
+ <p/>
+ <div class="toolForm">
+ <div class="toolFormTitle">${repository.name}</div>
+ <div class="toolFormBody">
+ <form name="receive_email_alerts" id="receive_email_alerts" action="${h.url_for( controller='repository', action='manage_repository', id=trans.security.encode_id( repository.id ) )}" method="post" >
+ <div class="form-row">
+ <label>Receive email alerts:</label>
+ ${alerts_check_box.get_html()}
+ <div class="toolParamHelp" style="clear: both;">
+ Check the box and click <b>Save</b> to receive email alerts when updates to this repository occur.
+ </div>
+ </div>
+ <div class="form-row">
+ <input type="submit" name="receive_email_alerts_button" value="Save"/>
+ </div>
+ </form>
+ </div>
+ </div>
+%endif
<p/><div class="toolForm"><div class="toolFormTitle">User access</div>
--- a/templates/webapps/community/repository/view_repository.mako Thu Jun 23 11:03:45 2011 -0400
+++ b/templates/webapps/community/repository/view_repository.mako Thu Jun 23 15:32:07 2011 -0400
@@ -134,8 +134,28 @@
</div></div></div>
-<p/>
+%if trans.user and trans.app.config.smtp_server:
+ <p/>
+ <div class="toolForm">
+ <div class="toolFormTitle">${repository.name}</div>
+ <div class="toolFormBody">
+ <form name="receive_email_alerts" id="receive_email_alerts" action="${h.url_for( controller='repository', action='view_repository', id=trans.security.encode_id( repository.id ) )}" method="post" >
+ <div class="form-row">
+ <label>Receive email alerts:</label>
+ ${alerts_check_box.get_html()}
+ <div class="toolParamHelp" style="clear: both;">
+ Check the box and click <b>Save</b> to receive email alerts when updates to this repository occur.
+ </div>
+ </div>
+ <div class="form-row">
+ <input type="submit" name="receive_email_alerts_button" value="Save"/>
+ </div>
+ </form>
+ </div>
+ </div>
+%endif
%if repository.ratings:
+ <p/><div class="toolForm"><div class="toolFormTitle">Rating</div><div class="toolFormBody">
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
0
23 Jun '11
1 new changeset in galaxy-central:
http://bitbucket.org/galaxy/galaxy-central/changeset/720455407d1c/
changeset: 720455407d1c
user: natefoo
date: 2011-06-23 17:03:45
summary: Set the HDA purged column to false upon creation. If you already upgraded to database >= 78 please do this by hand (UPDATE history_dataset_association SET purged=false WHERE purged IS NULL).
affected #: 1 file (90 bytes)
--- a/lib/galaxy/model/migrate/versions/0078_add_columns_for_disk_usage_accounting.py Wed Jun 22 08:36:48 2011 -0400
+++ b/lib/galaxy/model/migrate/versions/0078_add_columns_for_disk_usage_accounting.py Thu Jun 23 11:03:45 2011 -0400
@@ -33,6 +33,7 @@
c = Column( "purged", Boolean, index=True, default=False )
c.create( HistoryDatasetAssociation_table )
assert c is HistoryDatasetAssociation_table.c.purged
+ db_session.execute(HistoryDatasetAssociation_table.update().values(purged=False))
except Exception, e:
print "Adding purged column to history_dataset_association table failed: %s" % str( e )
log.debug( "Adding purged column to history_dataset_association table failed: %s" % str( e ) )
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
0
commit/galaxy-central: jgoecks: Better handling of Cuffdiff outputs when set_metadata_externally=True
by Bitbucket 22 Jun '11
by Bitbucket 22 Jun '11
22 Jun '11
1 new changeset in galaxy-central:
http://bitbucket.org/galaxy/galaxy-central/changeset/be48d8761458/
changeset: be48d8761458
user: jgoecks
date: 2011-06-22 14:36:48
summary: Better handling of Cuffdiff outputs when set_metadata_externally=True
affected #: 2 files (297 bytes)
--- a/tools/ngs_rna/cuffcompare_wrapper.py Tue Jun 21 16:22:14 2011 -0400
+++ b/tools/ngs_rna/cuffcompare_wrapper.py Wed Jun 22 08:36:48 2011 -0400
@@ -32,6 +32,9 @@
parser.add_option( '', '--index_dir', dest='index_dir', help='GALAXY_DATA_INDEX_DIR' )
parser.add_option( '', '--ref_file', dest='ref_file', help='The reference dataset from the history' )
+ # Outputs.
+ parser.add_option( '', '--combined-transcripts', dest='combined_transcripts' )
+
(options, args) = parser.parse_args()
# output version # of tool
@@ -115,6 +118,9 @@
if returncode != 0:
raise Exception, stderr
+ # Copy outputs.
+ shutil.copyfile( "cc_output.combined.gtf" , options.combined_transcripts )
+
# check that there are results in the output file
cc_output_fname = "cc_output.stats"
if len( open( cc_output_fname, 'rb' ).read().strip() ) == 0:
--- a/tools/ngs_rna/cuffcompare_wrapper.xml Tue Jun 21 16:22:14 2011 -0400
+++ b/tools/ngs_rna/cuffcompare_wrapper.xml Wed Jun 22 08:36:48 2011 -0400
@@ -26,11 +26,15 @@
--index_dir=${GALAXY_DATA_INDEX_DIR}
#end if
+ ## Outputs.
+ --combined-transcripts=${transcripts_combined}
+
## Inputs.
${first_input}
#for $input_file in $input_files:
${input_file.additional_input}
#end for
+
</command><inputs><param format="gtf" name="first_input" type="data" label="GTF file produced by Cufflinks" help=""/>
@@ -86,7 +90,7 @@
<data format="tabular" name="transcripts_tracking" label="${tool.name} on ${on_string}: transcript tracking" from_work_dir="cc_output.tracking"><filter>len( input_files ) > 0</filter></data>
- <data format="gtf" name="transcripts_combined" label="${tool.name} on ${on_string}: combined transcripts" from_work_dir="cc_output.combined.gtf"/>
+ <data format="gtf" name="transcripts_combined" label="${tool.name} on ${on_string}: combined transcripts"/></outputs><tests>
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
0