diff --git a/client/galaxy/scripts/mvc/tool/tool-form-composite.js b/client/galaxy/scripts/mvc/tool/tool-form-composite.js index 9a6cd1ab24e..1beea452ce9 100644 --- a/client/galaxy/scripts/mvc/tool/tool-form-composite.js +++ b/client/galaxy/scripts/mvc/tool/tool-form-composite.js @@ -119,7 +119,7 @@ var View = Backbone.View.extend({ input.help = input.step_linked ? `${input.help}, ` : ""; input.help += `Output dataset '${connection.output_name}' from step ${parseInt(i) + 1}`; input.step_linked = input.step_linked || []; - input.step_linked.push(step); + input.step_linked.push({ index: step.index, step_type: step.step_type }); } }); }); @@ -314,31 +314,34 @@ var View = Backbone.View.extend({ /** Render job caching option */ _renderUseCachedJob: function() { - var extra_user_preferences = {}; - if (Galaxy.user.attributes.preferences && 'extra_user_preferences' in Galaxy.user.attributes.preferences){ - extra_user_preferences = JSON.parse(Galaxy.user.attributes.preferences.extra_user_preferences); - } - var display_use_cached_job_checkbox = 'use_cached_job|use_cached_job_checkbox' in extra_user_preferences ? extra_user_preferences['use_cached_job|use_cached_job_checkbox'] : false ; - this.display_use_cached_job_checkbox = display_use_cached_job_checkbox === 'true'; - if (this.display_use_cached_job_checkbox){ + var extra_user_preferences = {}; + if (Galaxy.user.attributes.preferences && "extra_user_preferences" in Galaxy.user.attributes.preferences) { + extra_user_preferences = JSON.parse(Galaxy.user.attributes.preferences.extra_user_preferences); + } + var display_use_cached_job_checkbox = + "use_cached_job|use_cached_job_checkbox" in extra_user_preferences + ? extra_user_preferences["use_cached_job|use_cached_job_checkbox"] + : false; + this.display_use_cached_job_checkbox = display_use_cached_job_checkbox === "true"; + if (this.display_use_cached_job_checkbox) { this.job_options_form = new Form({ cls: "ui-portlet-narrow", title: "Job re-use Options", inputs: [ - { - type: "conditional", - name: "use_cached_job", - test_param: { - name: "check", - label: "BETA: Attempt to reuse jobs with identical parameters?", - type: "boolean", - value: "false", - help: "This may skip executing jobs that you have already run." - }, - } - ] - }); - this._append(this.$steps, this.job_options_form.$el); + { + type: "conditional", + name: "use_cached_job", + test_param: { + name: "check", + label: "BETA: Attempt to reuse jobs with identical parameters?", + type: "boolean", + value: "false", + help: "This may skip executing jobs that you have already run." + } + } + ] + }); + this._append(this.$steps, this.job_options_form.$el); } }, @@ -542,8 +545,8 @@ var View = Backbone.View.extend({ batch: true }; if (this.display_use_cached_job_checkbox) { - job_def['use_cached_job'] = this.job_options_form.data.create()["use_cached_job|check"] === 'true'; - } + job_def["use_cached_job"] = this.job_options_form.data.create()["use_cached_job|check"] === "true"; + } var validated = true; for (var i in this.forms) { var form = this.forms[i]; diff --git a/client/galaxy/scripts/mvc/workflow/workflow-node.js b/client/galaxy/scripts/mvc/workflow/workflow-node.js index e32591b7373..67a10df10a3 100644 --- a/client/galaxy/scripts/mvc/workflow/workflow-node.js +++ b/client/galaxy/scripts/mvc/workflow/workflow-node.js @@ -179,13 +179,19 @@ var Node = Backbone.Model.extend({ // Remove active class $(element).removeClass("toolForm-active"); }, + set_tool_version: function() { + if (this.config_form) { + this.tool_version = this.config_form.version; + this.content_id = this.config_form.id; + } + }, init_field_data: function(data) { if (data.type) { this.type = data.type; } this.name = data.name; this.config_form = data.config_form; - this.tool_version = this.config_form && this.config_form.version; + this.set_tool_version(); this.tool_state = data.tool_state; this.errors = data.errors; this.tooltip = data.tooltip ? data.tooltip : ""; @@ -263,7 +269,7 @@ var Node = Backbone.Model.extend({ }); this.tool_state = data.tool_state; this.config_form = data.config_form; - this.tool_version = this.config_form && this.config_form.version; + this.set_tool_version(); this.errors = data.errors; this.annotation = data.annotation; this.label = data.label; diff --git a/lib/galaxy/datatypes/binary.py b/lib/galaxy/datatypes/binary.py index daefe7a7e97..2b7325a2ed6 100644 --- a/lib/galaxy/datatypes/binary.py +++ b/lib/galaxy/datatypes/binary.py @@ -327,27 +327,35 @@ class Bam(Binary): def get_chunk(self, trans, dataset, offset=0, ck_size=None): index_file = dataset.metadata.bam_index - with pysam.AlignmentFile(dataset.file_name, "rb", index_filename=index_file.file_name) as bamfile: - ck_size = 300 # 300 lines - ck_data = "" - header_line_count = 0 - if offset == 0: - ck_data = bamfile.text.replace('\t', ' ') - header_line_count = bamfile.text.count('\n') - else: - bamfile.seek(offset) - for line_number, alignment in enumerate(bamfile) : - # return only Header lines if 'header_line_count' exceeds 'ck_size' - # FIXME: Can be problematic if bam has million lines of header - offset = bamfile.tell() - if (line_number + header_line_count) > ck_size: - break - else: - bamline = alignment.tostring(bamfile) - # Galaxy display each tag as separate column because 'tostring()' funcition put tabs in between each tag of tags column. - # Below code will remove spaces between each tag. - bamline_modified = ('\t').join(bamline.split()[:11] + [(' ').join(bamline.split()[11:])]) - ck_data = "%s\n%s" % (ck_data, bamline_modified) + if not offset == -1: + try: + with pysam.AlignmentFile(dataset.file_name, "rb", index_filename=index_file.file_name) as bamfile: + ck_size = 300 # 300 lines + ck_data = "" + header_line_count = 0 + if offset == 0: + ck_data = bamfile.text.replace('\t', ' ') + header_line_count = bamfile.text.count('\n') + else: + bamfile.seek(offset) + for line_number, alignment in enumerate(bamfile) : + # return only Header lines if 'header_line_count' exceeds 'ck_size' + # FIXME: Can be problematic if bam has million lines of header + offset = bamfile.tell() + if (line_number + header_line_count) > ck_size: + break + else: + bamline = alignment.tostring(bamfile) + # Galaxy display each tag as separate column because 'tostring()' funcition put tabs in between each tag of tags column. + # Below code will remove spaces between each tag. + bamline_modified = ('\t').join(bamline.split()[:11] + [(' ').join(bamline.split()[11:])]) + ck_data = "%s\n%s" % (ck_data, bamline_modified) + except Exception as e: + offset = -1 + ck_data = "Could not display BAM file, error was:\n%s" % e.message + else: + ck_data = '' + offset = -1 return dumps({'ck_data': util.unicodify(ck_data), 'offset': offset})