# HG changeset patch # User jorrit # Date 1360698085 18000 # Node ID b4db4eaf8fffb9948dfdd5a3df2c97b34b0ccc5a Uploaded diff -r 000000000000 -r b4db4eaf8fff annotation.py --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/annotation.py Tue Feb 12 14:41:25 2013 -0500 @@ -0,0 +1,42 @@ +""" +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 + + diff -r 000000000000 -r b4db4eaf8fff datatypes_conf.xml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/datatypes_conf.xml Tue Feb 12 14:41:25 2013 -0500 @@ -0,0 +1,16 @@ + + + + + + + + + + + + + + + + diff -r 000000000000 -r b4db4eaf8fff ontology.py --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ontology.py Tue Feb 12 14:41:25 2013 -0500 @@ -0,0 +1,90 @@ +""" +Ontology 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 Ontology( data.Text ): + """Any ontology Format""" + file_ext = "ontology" + + def init_meta( self, dataset, copy_from=None ): + data.Text.init_meta( self, dataset, copy_from=copy_from ) + + +class Obo( Ontology ): + """OBO Format""" + file_ext = "obo" + + 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 OBO format + """ + headers = get_headers( filename, '\n' ) + try: + for hdr in headers: + if hdr and hdr[0].startswith( 'format-version:' ) : + return True + return False + except: + return False + +class Owl( Ontology ): + """OWL""" + file_ext = "owl" + + 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 OWL RDF-XML format + """ + headers = get_headers( filename, '\n' ) + try: + for hdr in headers: + if hdr and hdr[0].find( ' -1 : + return True + if hdr and hdr[0].find( 'http://www.w3.org/2002/07/owl' ) > -1 : + return True + return False + except: + return False + + +class OwlRdfXML( Owl ): + """OWL RDF/XML""" + + 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 OWL RDF-XML format + """ + headers = get_headers( filename, '\n' ) + try: + for hdr in headers: + if hdr and hdr[0].find( ' -1 : + return True + return False + except: + return False + + diff -r 000000000000 -r b4db4eaf8fff termenrichment.py --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/termenrichment.py Tue Feb 12 14:41:25 2013 -0500 @@ -0,0 +1,51 @@ +""" +Term enrichment 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 TermEnrichmentResult( data.Text ): + """Any term enrichment format""" + file_ext = "enrichment" + + def init_meta( self, dataset, copy_from=None ): + data.Text.init_meta( self, dataset, copy_from=copy_from ) + + +class TerfTab( TermEnrichmentResult ): + """TERF TSV Format""" + file_ext = "terf" + + 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 TERF format + """ + headers = get_headers( filename, '\n' ) + try: + for hdr in headers: + if hdr and hdr[0].startswith( '##terf-version' ) : + return True + return False + except: + return False + + +