1 new commit in galaxy-central: https://bitbucket.org/galaxy/galaxy-central/changeset/3fe486853787/ changeset: 3fe486853787 user: dan date: 2012-10-24 18:28:46 summary: Allow setting dataset attributes of additional primary datasets through galaxy.json. affected #: 1 file diff -r 0c56502c7fd78431001012cb56b3df1224472769 -r 3fe486853787d10c2ba6f0b79f82aa59aaed8790 lib/galaxy/tools/__init__.py --- a/lib/galaxy/tools/__init__.py +++ b/lib/galaxy/tools/__init__.py @@ -2623,10 +2623,19 @@ Find any additional datasets generated by a tool and attach (for cases where number of outputs is not known in advance). """ - primary_datasets = {} + new_primary_datasets = {} + try: + json_file = open( os.path.join( job_working_directory, jobs.TOOL_PROVIDED_JOB_METADATA_FILE ), 'r' ) + for line in json_file: + line = simplejson.loads( line ) + if line.get( 'type' ) == 'new_primary_dataset': + new_primary_datasets[ os.path.split( line.get( 'filename' ) )[-1] ] = line + except Exception, e: + log.debug( "Error opening galaxy.json file: %s" % e ) # Loop through output file names, looking for generated primary # datasets in form of: # 'primary_associatedWithDatasetID_designation_visibility_extension(_DBKEY)' + primary_datasets = {} for name, outdata in output.items(): filenames = [] if 'new_file_path' in self.app.config.collect_outputs_from: @@ -2664,8 +2673,6 @@ primary_data.info = outdata.info primary_data.init_meta( copy_from=outdata ) primary_data.dbkey = dbkey - primary_data.set_meta() - primary_data.set_peek() # Associate new dataset with job job = None for assoc in outdata.creating_job_associations: @@ -2677,6 +2684,15 @@ self.sa_session.add( assoc ) self.sa_session.flush() primary_data.state = outdata.state + #add tool/metadata provided information + new_primary_datasets_attributes = new_primary_datasets.get( os.path.split( filename )[-1] ) + if new_primary_datasets_attributes: + dataset_att_by_name = dict( ext='extension' ) + for att_set in [ 'name', 'info', 'ext', 'dbkey' ]: + dataset_att_name = dataset_att_by_name.get( att_set, att_set ) + setattr( primary_data, dataset_att_name, new_primary_datasets_attributes.get( att_set, getattr( primary_data, dataset_att_name ) ) ) + primary_data.set_meta() + primary_data.set_peek() self.sa_session.add( primary_data ) self.sa_session.flush() outdata.history.add_dataset( primary_data ) 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.