# HG changeset patch # User Jim Johnson # Date 1403787418 18000 # Node ID cd8f8c54bf9a2292203c3650bacf3771612a6553 # Parent 926c8f02b3ba5cded4231b9038f8bbdbb990061e Make regulation and annotation metadata optional, write metadata into the dataset after setting metadata diff -r 926c8f02b3ba -r cd8f8c54bf9a lib/galaxy/datatypes/snpeff.py --- 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