Merge branch 'release_16.04' into dev

This commit is contained in:
Dannon Baker
2016-07-08 15:58:57 -04:00
14 changed files with 49 additions and 49 deletions
+6 -3
View File
@@ -64,7 +64,7 @@ var TabularDataset = Dataset.extend({
defaults: _.extend({}, Dataset.prototype.defaults, {
chunk_url: null,
first_data_chunk: null,
chunk_index: -1,
offset: 0,
at_eof: false
}),
@@ -72,7 +72,9 @@ var TabularDataset = Dataset.extend({
Dataset.prototype.initialize.call(this);
// If first data chunk is available, next chunk is 1.
this.attributes.chunk_index = (this.attributes.first_data_chunk ? 1 : 0);
if (this.attributes.first_data_chunk){
this.attributes.offset = this.attributes.first_data_chunk.offset;
}
this.attributes.chunk_url = Galaxy.root + 'dataset/display?dataset_id=' + this.id;
this.attributes.url_viz = Galaxy.root + 'visualization';
},
@@ -90,12 +92,13 @@ var TabularDataset = Dataset.extend({
var self = this,
next_chunk = $.Deferred();
$.getJSON(this.attributes.chunk_url, {
chunk: self.attributes.chunk_index++
offset: self.attributes.offset
}).success(function(chunk) {
var rval;
if (chunk.ck_data !== '') {
// Found chunk.
rval = chunk;
self.attributes.offset = chunk.offset;
}
else {
// At EOF.
+1 -1
View File
@@ -73,7 +73,7 @@ class Binary( data.Data ):
"""Returns the mime type of the datatype"""
return 'application/octet-stream'
def display_data(self, trans, dataset, preview=False, filename=None, to_ext=None, size=None, offset=None, **kwd):
def display_data(self, trans, dataset, preview=False, filename=None, to_ext=None, **kwd):
trans.response.set_content_type(dataset.get_mime())
trans.log_event( "Display dataset id: %s" % str( dataset.id ) )
trans.response.headers['Content-Length'] = int( os.stat( dataset.file_name ).st_size )
+1 -1
View File
@@ -312,7 +312,7 @@ class Data( object ):
trans.response.headers["Content-Disposition"] = 'attachment; filename="Galaxy%s-[%s].%s"' % (dataset.hid, fname, to_ext)
return open( dataset.file_name )
def display_data(self, trans, data, preview=False, filename=None, to_ext=None, size=None, offset=None, **kwd):
def display_data(self, trans, data, preview=False, filename=None, to_ext=None, **kwd):
""" Old display method, for transition - though still used by API and
test framework. Datatypes should be very careful if overridding this
method and this interface between datatypes and Galaxy will likely
+1 -1
View File
@@ -393,7 +393,7 @@ class OBFS(Binary):
return "OpenBabel Fastsearch Index"
def display_data(self, trans, data, preview=False, filename=None,
to_ext=None, size=None, offset=None, **kwd):
to_ext=None, **kwd):
"""Apparently an old display method, but still gets called.
This allows us to format the data shown in the central pane via the "eye" icon.
+14 -22
View File
@@ -58,31 +58,23 @@ class TabularData( data.Text ):
except:
return False
def get_chunk(self, trans, dataset, chunk):
ck_index = int(chunk)
f = open(dataset.file_name)
initial_offset = (ck_index * trans.app.config.display_chunk_size)
f.seek(initial_offset)
# If we aren't at the start of the file, seek to next newline. Do this better eventually.
if f.tell() != 0:
cursor = f.read(1)
while cursor and cursor != '\n':
def get_chunk(self, trans, dataset, offset=0, ck_size=None):
with open(dataset.file_name) as f:
f.seek(offset)
ck_data = f.read(ck_size or trans.app.config.display_chunk_size)
if ck_data and ck_data[-1] != '\n':
cursor = f.read(1)
read_start_offset = f.tell()
prechunk_skip = read_start_offset - initial_offset
# We subtract the prechunk skip out of the primary chunk read to avoid
# shifting the chunk tail onto a line it shouldn't have.
ck_data = f.read(trans.app.config.display_chunk_size - prechunk_skip)
cursor = f.read(1)
while cursor and ck_data[-1] != '\n':
ck_data += cursor
cursor = f.read(1)
return dumps( { 'ck_data': util.unicodify( ck_data ), 'ck_index': ck_index + 1 } )
while cursor and cursor != '\n':
ck_data += cursor
cursor = f.read(1)
last_read = f.tell()
return dumps( { 'ck_data': util.unicodify( ck_data ),
'offset': last_read } )
def display_data(self, trans, dataset, preview=False, filename=None, to_ext=None, chunk=None, **kwd):
def display_data(self, trans, dataset, preview=False, filename=None, to_ext=None, offset=None, ck_size=None, **kwd):
preview = util.string_as_bool( preview )
if chunk:
return self.get_chunk(trans, dataset, chunk)
if offset is not None:
return self.get_chunk(trans, dataset, offset, ck_size)
elif to_ext or not preview:
to_ext = to_ext or dataset.extension
return self._serve_raw(trans, dataset, to_ext)
+6 -8
View File
@@ -127,19 +127,17 @@ class Ipynb( Json ):
except:
return False
def display_data(self, trans, dataset, preview=False, filename=None, to_ext=None, chunk=None, **kwd):
def display_data(self, trans, dataset, preview=False, filename=None, to_ext=None, **kwd):
config = trans.app.config
trust = getattr( config, 'trust_ipython_notebook_conversion', False )
if trust:
return self._display_data_trusted(trans, dataset, preview=preview, filename=filename, to_ext=to_ext, chunk=chunk, **kwd)
return self._display_data_trusted(trans, dataset, preview=preview, filename=filename, to_ext=to_ext, **kwd)
else:
return super(Ipynb, self).display_data( trans, dataset, preview=preview, filename=filename, to_ext=to_ext, chunk=chunk, **kwd )
return super(Ipynb, self).display_data( trans, dataset, preview=preview, filename=filename, to_ext=to_ext, **kwd )
def _display_data_trusted(self, trans, dataset, preview=False, filename=None, to_ext=None, chunk=None, **kwd):
def _display_data_trusted(self, trans, dataset, preview=False, filename=None, to_ext=None, **kwd):
preview = string_as_bool( preview )
if chunk:
return self.get_chunk(trans, dataset, chunk)
elif to_ext or not preview:
if to_ext or not preview:
return self._serve_raw(trans, dataset, to_ext)
else:
ofile_handle = tempfile.NamedTemporaryFile(delete=False)
@@ -426,7 +424,7 @@ class SnpEffDb( Text ):
# search data_dir/genome_version for files
regulation_pattern = 'regulation_(.+).bin'
# annotation files that are included in snpEff by a flag
annotations_dict = {'nextProt.bin' : '-nextprot', 'motif.bin': '-motif'}
annotations_dict = {'nextProt.bin': '-nextprot', 'motif.bin': '-motif'}
regulations = []
annotations = []
genome_version = None
+4 -3
View File
@@ -278,7 +278,7 @@ class DatasetsController( BaseAPIController, UsesVisualizationMixin ):
@web.expose_api_raw_anonymous
def display( self, trans, history_content_id, history_id,
preview=False, filename=None, to_ext=None, chunk=None, raw=False, **kwd ):
preview=False, filename=None, to_ext=None, raw=False, **kwd ):
"""
GET /api/histories/{encoded_history_id}/contents/{encoded_content_id}/display
Displays history content (dataset).
@@ -297,7 +297,8 @@ class DatasetsController( BaseAPIController, UsesVisualizationMixin ):
if raw:
if filename and filename != 'index':
file_path = trans.app.object_store.get_filename( hda.dataset,
extra_dir=( 'dataset_%s_files' % hda.dataset.id ), alt_name=filename)
extra_dir=( 'dataset_%s_files' % hda.dataset.id ),
alt_name=filename)
else:
file_path = hda.file_name
rval = open( file_path )
@@ -306,7 +307,7 @@ class DatasetsController( BaseAPIController, UsesVisualizationMixin ):
display_kwd = kwd.copy()
if 'key' in display_kwd:
del display_kwd["key"]
rval = hda.datatype.display_data( trans, hda, preview, filename, to_ext, chunk, **display_kwd )
rval = hda.datatype.display_data( trans, hda, preview, filename, to_ext, **display_kwd )
except Exception as exception:
log.error( "Error getting display data for dataset (%s) from history (%s): %s",
@@ -232,11 +232,17 @@ class DatasetInterface( BaseUIController, UsesAnnotations, UsesItemRatings, Uses
return trans.app.object_store.file_ready(data.dataset)
@web.expose
def display(self, trans, dataset_id=None, preview=False, filename=None, to_ext=None, chunk=None, **kwd):
def display(self, trans, dataset_id=None, preview=False, filename=None, to_ext=None, offset=None, ck_size=None, **kwd):
data = self._check_dataset(trans, dataset_id)
if not isinstance( data, trans.app.model.DatasetInstance ):
return data
return data.datatype.display_data(trans, data, preview, filename, to_ext, chunk, **kwd)
# Ensure offset is an integer before passing through to datatypes.
if offset:
offset = int(offset)
# Ensure ck_size is an integer before passing through to datatypes.
if ck_size:
ck_size = int(ck_size)
return data.datatype.display_data(trans, data, preview, filename, to_ext, offset=offset, ck_size=ck_size, **kwd)
@web.expose
def edit(self, trans, dataset_id=None, filename=None, hid=None, **kwd):
+3 -3
View File
@@ -128,9 +128,9 @@ class TagsController ( BaseUIController, UsesTagsMixin ):
# Create and return autocomplete data.
ac_data = "#Header|Your Tags\n"
for row in result_set:
tag = self.get_tag_handler( trans ).get_tag_by_id( trans, row[0] )
tag = self.get_tag_handler( trans ).get_tag_by_id( row[0] )
# Exclude tags that are already applied to the item.
if ( item is not None ) and ( self.get_tag_handler( trans ).item_has_tag( trans, trans.user, item, tag ) ):
if ( item is not None ) and ( self.get_tag_handler( trans ).item_has_tag( trans.user, item, tag ) ):
continue
# Add tag to autocomplete data. Use the most frequent name that user
# has employed for the tag.
@@ -146,7 +146,7 @@ class TagsController ( BaseUIController, UsesTagsMixin ):
tag_name_and_value = q.split( ":" )
tag_name = tag_name_and_value[0]
tag_value = tag_name_and_value[1]
tag = self.get_tag_handler( trans ).get_tag_by_name( trans, tag_name )
tag = self.get_tag_handler( trans ).get_tag_by_name( tag_name )
# Don't autocomplete if tag doesn't exist.
if tag is None:
return ""
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long