Skip to content

Commit

Permalink
Add ImzML composite defintion
Browse files Browse the repository at this point in the history
  • Loading branch information
bgruening committed Aug 2, 2017
1 parent 98292a0 commit 97c16db
Showing 1 changed file with 38 additions and 0 deletions.
38 changes: 38 additions & 0 deletions lib/galaxy/datatypes/proteomics.py
Original file line number Diff line number Diff line change
Expand Up @@ -425,3 +425,41 @@ class XHunterAslFormat(Binary):
class Sf3(Binary):
"""Class describing a Scaffold SF3 files"""
file_ext = "sf3"


class ImzML(Binary):
"""
Class for imzML files.
http://www.imzml.org
"""
file_ext = 'imzml'
allow_datatype_change = False
composite_type = 'auto_primary_file'

def __init__(self, **kwd):
Binary.__init__(self, **kwd)

"""The metadata"""
self.add_composite_file(
'imzml',
description='The imzML metadata component.',
is_binary=False)

"""The mass spectral data"""
self.add_composite_file(
'ibd',
description='The mass spectral data component.',
is_binary=True)

def generate_primary_file(self, dataset=None):
rval = ['<html><head><title>imzML Composite Dataset </title></head><p/>']
rval.append('<div>This composite dataset is composed of the following files:<p/><ul>')
for composite_name, composite_file in self.get_composite_files(dataset=dataset).iteritems():
fn = composite_name
opt_text = ''
if composite_file.get('description'):
rval.append('<li><a href="%s" type="text/plain">%s (%s)</a>%s</li>' % (fn, fn, composite_file.get('description'), opt_text))
else:
rval.append('<li><a href="%s" type="text/plain">%s</a>%s</li>' % (fn, fn, opt_text))
rval.append('</ul></div></html>')
return "\n".join(rval)

0 comments on commit 97c16db

Please sign in to comment.