commit/galaxy-central: kanwei: Sniffers: Fix sniffers not being loaded from datatypes.conf file. Modify VCF sniffer to just check a simple header string.
1 new changeset in galaxy-central: http://bitbucket.org/galaxy/galaxy-central/changeset/d7c529fa8e96/ changeset: d7c529fa8e96 user: kanwei date: 2011-06-14 19:22:12 summary: Sniffers: Fix sniffers not being loaded from datatypes.conf file. Modify VCF sniffer to just check a simple header string. affected #: 3 files (559 bytes) --- a/datatypes_conf.xml.sample Tue Jun 14 13:17:34 2011 -0400 +++ b/datatypes_conf.xml.sample Tue Jun 14 13:22:12 2011 -0400 @@ -280,6 +280,7 @@ defined format first, followed by next-most rigidly defined, and so on. --> + <sniffer type="galaxy.datatypes.tabular:Vcf"/><sniffer type="galaxy.datatypes.binary:TwoBit"/><sniffer type="galaxy.datatypes.binary:Bam"/><sniffer type="galaxy.datatypes.binary:Sff"/> @@ -303,7 +304,6 @@ <sniffer type="galaxy.datatypes.tabular:Pileup"/><sniffer type="galaxy.datatypes.interval:Interval"/><sniffer type="galaxy.datatypes.tabular:Sam"/> - <sniffer type="galaxy.datatypes.tabular:Vcf"/><!-- Keep this commented until the sniff method in the assembly.py module is fixed to not read the entire file. --- a/lib/galaxy/datatypes/registry.py Tue Jun 14 13:17:34 2011 -0400 +++ b/lib/galaxy/datatypes/registry.py Tue Jun 14 13:22:12 2011 -0400 @@ -122,32 +122,22 @@ if current_app is None and isinstance( d_type1, type( d_type2 ) ): d_type1.add_display_application( display_app ) # Load datatype sniffers from the config - sniff_order = [] sniffers = root.find( 'sniffers' ) for elem in sniffers.findall( 'sniffer' ): dtype = elem.get( 'type', None ) if dtype: - sniff_order.append( dtype ) - for dtype in sniff_order: - try: - fields = dtype.split( ":" ) - datatype_module = fields[0] - datatype_class = fields[1] - fields = datatype_module.split( "." ) - module = __import__( fields.pop(0) ) - for mod in fields: - module = getattr( module, mod ) - aclass = getattr( module, datatype_class )() - included = False - for atype in self.sniff_order: - if not issubclass( atype.__class__, aclass.__class__ ) and isinstance( atype, aclass.__class__ ): - included = True - break - if not included: + try: + fields = dtype.split( ":" ) + datatype_module = fields[0] + datatype_class = fields[1] + module = __import__( datatype_module ) + for comp in datatype_module.split('.')[1:]: + module = getattr(module, comp) + aclass = getattr( module, datatype_class )() self.sniff_order.append( aclass ) self.log.debug( 'Loaded sniffer for datatype: %s' % dtype ) - except Exception, exc: - self.log.warning( 'Error appending datatype %s to sniff_order, problem: %s' % ( dtype, str( exc ) ) ) + except Exception, exc: + self.log.warning( 'Error appending datatype %s to sniff_order, problem: %s' % ( dtype, str( exc ) ) ) #default values if len(self.datatypes_by_extension) < 1: self.datatypes_by_extension = { --- a/lib/galaxy/datatypes/tabular.py Tue Jun 14 13:17:34 2011 -0400 +++ b/lib/galaxy/datatypes/tabular.py Tue Jun 14 13:22:12 2011 -0400 @@ -479,13 +479,8 @@ MetadataElement( name="viz_filter_cols", desc="Score column for visualization", default=[5], param=metadata.ColumnParameter, multiple=True ) def sniff( self, filename ): - try: - # If reader can read and parse file, it's VCF. - for line in list( galaxy_utils.sequence.vcf.Reader( open( filename ) ) ): - pass - return True - except: - return False + headers = get_headers( filename, '\n', count=1 ) + return headers[0][0].startswith("##fileformat=VCF") def make_html_table( self, dataset, skipchars=[] ): """Create HTML table, used for displaying peek""" Repository URL: https://bitbucket.org/galaxy/galaxy-central/ -- This is a commit notification from bitbucket.org. You are receiving this because you have the service enabled, addressing the recipient of this email.
participants (1)
-
Bitbucket