view annotation.py @ 2:474ea11c8581

Uploaded
author jorrit
date Tue, 12 Feb 2013 13:47:22 -0500
parents 646b05282962
children
line wrap: on
line source

"""
Annotation datatypes

"""
import pkg_resources
pkg_resources.require( "bx-python" )

import logging, os, sys, time, tempfile, shutil
import data
from galaxy import util
from galaxy.datatypes.sniff import *
from galaxy.web import url_for
from cgi import escape
import urllib
from bx.intervals.io import *
from galaxy.datatypes import metadata
from galaxy.datatypes.metadata import MetadataElement
from galaxy.datatypes.tabular import Tabular
import math

log = logging.getLogger(__name__)

class Gaf( Tabular ):
    """Tab delimited data in Gene Ontology Association File (GAF) format"""
    file_ext = "gaf"

    def init_meta( self, dataset, copy_from=None ):
        data.Text.init_meta( self, dataset, copy_from=copy_from )
    def sniff( self, filename ):
        """
        Determines whether the file is in GAF format
        """
        headers = get_headers( filename, '\t' )
        try:
            for hdr in headers:
                if hdr and hdr[0].startswith( '!gaf-version:' ) :
                    return True
            return False
        except:
            return False