Mercurial > repos > jjohnson > snpeff_datatypes
changeset 1:cd8f8c54bf9a
Make regulation and annotation metadata optional, write metadata into the dataset after setting metadata
author | Jim Johnson <jj@umn.edu> |
---|---|
date | Thu, 26 Jun 2014 07:56:58 -0500 |
parents | 926c8f02b3ba |
children | b33911fdbac4 |
files | lib/galaxy/datatypes/snpeff.py |
diffstat | 1 files changed, 12 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- a/lib/galaxy/datatypes/snpeff.py Tue Jun 24 17:32:11 2014 -0400 +++ b/lib/galaxy/datatypes/snpeff.py Thu Jun 26 07:56:58 2014 -0500 @@ -12,8 +12,8 @@ """Class describing a SnpEff genome build""" file_ext = "snpeffdb" MetadataElement( name="genome_version", default=None, desc="Genome Version", readonly=True, visible=True, no_value=None ) - MetadataElement( name="regulation", default=[], desc="Regulation Names", readonly=True, visible=True, no_value=[] ) - MetadataElement( name="annotation", default=[], desc="Annotation Names", readonly=True, visible=True, no_value=[] ) + MetadataElement( name="regulation", default=[], desc="Regulation Names", readonly=True, visible=True, no_value=[], optional=True) + MetadataElement( name="annotation", default=[], desc="Annotation Names", readonly=True, visible=True, no_value=[], optional=True) def __init__( self, **kwd ): Text.__init__( self, **kwd ) @@ -45,4 +45,14 @@ annotations.append(name) dataset.metadata.regulation = regulations dataset.metadata.annotation = annotations + try: + fh = file(dataset.file_name,'w') + fh.write("%s\n" % genome_version) + if annotations: + fh.write("annotations: %s\n" % ','.join(annotations)) + if regulations: + fh.write("regulations: %s\n" % ','.join(regulations)) + fh.close() + except: + pass