Mercurial > repos > jorrit > obotools
changeset 5:ef086bb44e6c
Uploaded
author | jorrit |
---|---|
date | Tue, 12 Feb 2013 14:48:56 -0500 |
parents | d455c48f74fa |
children | ebf2b433a239 |
files | annotation.py datatypes_conf.xml ontology.py repository_dependencies.xml termenrichment.py |
diffstat | 5 files changed, 4 insertions(+), 199 deletions(-) [+] |
line wrap: on
line diff
--- a/annotation.py Tue Feb 12 14:13:23 2013 -0500 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,42 +0,0 @@ -""" -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 - -
--- a/datatypes_conf.xml Tue Feb 12 14:13:23 2013 -0500 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,16 +0,0 @@ -<?xml version="1.0"?> -<!-- see http://wiki.galaxyproject.org/ToolShedDatatypesFeatures for more info --> -<datatypes> - <datatype_files> - <datatype_file name="annotation.py"/> - <datatype_file name="ontology.py"/> - <datatype_file name="termenrichment.py"/> - </datatype_files> - <registration> - <datatype extension="ontology" type="galaxy.datatypes.ontology:Ontology" display_in_upload="true"/> - <datatype extension="obo" type="galaxy.datatypes.ontology:Obo" display_in_upload="true"/> - <datatype extension="owl" type="galaxy.datatypes.ontology:Owl" display_in_upload="true"/> - <datatype extension="gaf" type="galaxy.datatypes.annotation:Gaf" display_in_upload="true"/> - <datatype extension="terf" type="galaxy.datatypes.termenrichment:TerfTab" display_in_upload="true"/> - </registration> -</datatypes>
--- a/ontology.py Tue Feb 12 14:13:23 2013 -0500 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,90 +0,0 @@ -""" -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( '<owl' ) > -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( '<owl:Ontology' ) > -1 : - return True - return False - except: - return False - -
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/repository_dependencies.xml Tue Feb 12 14:48:56 2013 -0500 @@ -0,0 +1,4 @@ +<?xml version="1.0"?> +<repositories description="Obo tools requires the Galaxy applicable data formats used by Obo tools."> + <repository toolshed="http://testtoolshed.g2.bx.psu.edu" name="obo_datatypes" owner="jorrit" changeset_revision="b4db4eaf8fff" /> +</repositories>
--- a/termenrichment.py Tue Feb 12 14:13:23 2013 -0500 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,51 +0,0 @@ -""" -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 - - -