Commits

jeremy goecks  committed 1a4d6f1

Trackster modifications to work with new tools API controller.

  • Participants
  • Parent commits b2640a9

Comments (0)

Files changed (6)

File lib/galaxy/web/api/tools.py

         run_on_regions = False
         regions = payload.get( 'regions', None )
         if regions:
-            regions = from_json_string( regions )
             if isinstance( regions, dict ):
                 # Regions is a single region.
                 regions = [ GenomeRegion.from_dict( regions ) ]

File static/scripts/mvc/data.js

  */
 var Dataset = Backbone.RelationalModel.extend({
     defaults: {
-        id: "",
-        type: "",
-        name: "",
-        hda_ldda: ""
+        id: '',
+        type: '',
+        name: '',
+        hda_ldda: 'hda'
     } 
 });
 

File static/scripts/mvc/tools.js

         return this._run({
             action: 'rerun',
             target_dataset_id: target_dataset.id,
-            regions: JSON.stringify(regions) 
+            regions: regions
         });
     },
 

File static/scripts/viz/trackster.js

  * Helper to determine if object is jQuery deferred.
  */
 var is_deferred = function ( d ) {
+    if (d === 'pending') {
+        console.log('pending');
+    }
     return ( 'isResolved' in d );
 };
 
         var param_dict = {};
         this.parent_div.find(":input").each(function() {
             var name = $(this).attr("name"), value = $(this).val();
-            param_dict[name] = JSON.stringify(value);
+            param_dict[name] = value;
         });
         return param_dict;
     },
         tool.run(
                  // URL params.
                  { 
-                     dataset_id: this.track.original_dataset_id,
+                     target_dataset_id: this.track.original_dataset_id,
                      tool_id: tool.name
                  },
                  null,
         var 
             url_params = 
             { 
-                dataset_id: this.track.original_dataset_id,
-                chrom: this.track.view.chrom,
-                low: this.track.view.low,
-                high: this.track.view.high,
-                tool_id: this.name
+                target_dataset_id: this.track.original_dataset_id,
+                action: 'rerun',
+                tool_id: this.name,
+                regions: [{
+                    chrom: this.track.view.chrom,
+                    start: this.track.view.low,
+                    end: this.track.view.high
+                }]
             },
             current_track = this.track,
             // Set name of track to include tool name, parameters, and region used.
         this.run(url_params, new_track,
                  // Success callback.
                  function(track_data) {
-                     new_track.set_dataset(new Dataset({
-                         id: track_data.dataset_id,
-                         hda_ldda: track_data.hda_ldda
-                     }));
+                     new_track.set_dataset(new Dataset(track_data));
                      new_track.tiles_div.text("Running job.");
                      new_track.init();
                  }
      */
     run: function(url_params, new_track, success_callback) {
         // Run tool.
+        url_params.inputs = this.get_param_values_dict();
         var ss_deferred = new ServerStateDeferred({
-            url: rerun_tool_url,
-            url_params: $.extend(url_params, this.get_param_values_dict()),
+            ajax_settings: {
+                url: galaxy_paths.get('tool_url'),
+                data: JSON.stringify(url_params),
+                dataType: "json",
+                contentType: 'application/json',
+                type: "POST"
+            },
             interval: 2000,
             success_fn: function(response) {
                 return response !== "pending";
             // Paint summary tree into canvas
             var painter = new painters.SummaryTreePainter(result, tile_low, tile_high, this.prefs);
             painter.draw(ctx, canvas.width, canvas.height, w_scale);
-            return new SummaryTreeTile(track, tile_index, resolution, canvas, result.data, result.max);
+            return new SummaryTreeTile(track, region, resolution, canvas, result.data, result.max);
         }
 
         // Handle row-by-row tracks

File static/scripts/viz/visualization.js

     },
     
     /**
-     * as_str attribute using the format chrom:start-end can be 
-     * used to set object's attributes.
+     * If options is a string, parsing using the format
+     * chrom:start-end is attempted to set object attributes.
      */
     initialize: function(options) {
-        if (!this.get('chrom') && !this.get('start') && 
-            !this.get('end') && 'as_str' in options) {
-            var pieces = options.as_str.split(':'),
+        if (typeof(options) === 'string') {
+            var pieces = options.split(':'),
                 chrom = pieces[0],
-                start_end = pieces.split('-'),
-                start = start_end[0],
-                end = start_end[1];
-            this.set('chrom', chrom);
-            this.set('start', start);
-            this.set('end', end);
+                start_end = pieces[1].split('-');
+            this.set({
+                chrom: chrom,
+                start: parseInt(start_end[0]),
+                end: parseInt(start_end[1])
+            });
         }  
     },
     

File templates/tracks/browser.mako

     // Place URLs here so that url_for can be used to generate them.
     //
     galaxy_paths.set({
-        visualization_url: "${h.url_for( action='save' )}",
-        run_tool_url: "${h.url_for( controller='/api/tools' )}"
+        visualization_url: "${h.url_for( action='save' )}"
     });
     var 
         add_track_async_url = "${h.url_for( action='add_track_async' )}",