2 new commits in galaxy-central: https://bitbucket.org/galaxy/galaxy-central/changeset/a21e7bd8a41d/ changeset: a21e7bd8a41d user: dan date: 2012-10-11 18:09:06 summary: Add source_dataset_chain as a property to DatasetInstance. affected #: 1 file diff -r 62b89df24ab159aa12b6a15d63001c4cd01cab2e -r a21e7bd8a41d6d84b9acd63095ea18de80eba76f lib/galaxy/model/__init__.py --- a/lib/galaxy/model/__init__.py +++ b/lib/galaxy/model/__init__.py @@ -1242,7 +1242,25 @@ return source return ( None, None ) return get_source( self ) - + @property + def source_dataset_chain( self ): + def _source_dataset_chain( dataset, lst ): + try: + cp_from_ldda = dataset.copied_from_library_dataset_dataset_association + if cp_from_ldda: + lst.append( (cp_from_ldda, "(Data Library)") ) + return _source_dataset_chain( cp_from_ldda, lst ) + except Exception, e: + log.warning( e ) + try: + cp_from_hda = dataset.copied_from_history_dataset_association + if cp_from_hda: + lst.append( (cp_from_hda, cp_from_hda.history.name) ) + return _source_dataset_chain( cp_from_hda, lst ) + except Exception, e: + log.warning( e ) + return lst + return _source_dataset_chain( self, [] ) def get_display_applications( self, trans ): return self.datatype.get_display_applications_by_dataset( self, trans ) https://bitbucket.org/galaxy/galaxy-central/changeset/05dfdda80590/ changeset: 05dfdda80590 user: dan date: 2012-10-11 18:09:06 summary: Refactor show_params for hda controller. affected #: 1 file diff -r a21e7bd8a41d6d84b9acd63095ea18de80eba76f -r 05dfdda805908059de813a303e6ed02ea5e97117 lib/galaxy/webapps/galaxy/controllers/dataset.py --- a/lib/galaxy/webapps/galaxy/controllers/dataset.py +++ b/lib/galaxy/webapps/galaxy/controllers/dataset.py @@ -977,21 +977,6 @@ """ Show the parameters used for an HDA """ - - def source_dataset_chain( dataset, lst ): - try: - cp_from_ldda = dataset.copied_from_library_dataset_dataset_association - cp_from_hda = dataset.copied_from_history_dataset_association - if cp_from_ldda: - lst.append( (cp_from_ldda, "(Data Library)") ) - return source_dataset_chain( cp_from_ldda, lst ) - elif cp_from_hda: - lst.append( (cp_from_hda, cp_from_hda.history.name) ) - return source_dataset_chain( cp_from_hda, lst ) - except: - pass - return lst - hda = trans.sa_session.query( trans.app.model.HistoryDatasetAssociation ).get( trans.security.decode_id( dataset_id ) ) if not hda: raise paste.httpexceptions.HTTPRequestRangeNotSatisfiable( "Invalid reference dataset id: %s." % str( dataset_id ) ) @@ -999,15 +984,17 @@ return trans.show_error_message( "You are not allowed to access this dataset" ) # Get the associated job, if any. If this hda was copied from another, - # we need to find the job that created the origial hda + # we need to find the job that created the origial dataset association. params_objects = None + job = None tool = None - job_hda = hda - while job_hda.copied_from_history_dataset_association: - job_hda = job_hda.copied_from_history_dataset_association - if job_hda.creating_job_associations: - job = None - for assoc in job_hda.creating_job_associations: + inherit_chain = hda.source_dataset_chain + if inherit_chain: + job_dataset_association, dataset_association_container_name = inherit_chain[-1] + else: + job_dataset_association = hda + if job_dataset_association.creating_job_associations: + for assoc in job_dataset_association.creating_job_associations: job = assoc.job break if job: @@ -1020,8 +1007,8 @@ params_objects = job.get_param_values( trans.app ) except: pass - - inherit_chain = source_dataset_chain(hda, []) + if job is None: + return trans.show_error_message( "Job information is not available for this dataset." ) return trans.fill_template( "show_params.mako", inherit_chain=inherit_chain, history=trans.get_history(), hda=hda, job=job, tool=tool, params_objects=params_objects ) @web.expose 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.