# HG changeset patch # User earlhaminst # Date 1741649237 0 # Node ID c22276db40255d6deae8a5128ea3a8700787242a # Parent ab5611663f32f389f0d35e5c48d6c0621b184ccc planemo upload for repository https://github.com/TGAC/earlham-galaxytools/tree/main/tools/GAFA/ commit a0d7ab86b86bb764e457767bf8e8bc29868d0cbb diff -r ab5611663f32 -r c22276db4025 GAFA.xml --- a/GAFA.xml Mon Mar 03 17:47:53 2025 +0000 +++ b/GAFA.xml Mon Mar 10 23:27:17 2025 +0000 @@ -1,4 +1,4 @@ - + generates an SQLite database that can be visualised with Aequatus python diff -r ab5611663f32 -r c22276db4025 datatypes_conf.xml --- a/datatypes_conf.xml Mon Mar 03 17:47:53 2025 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,12 +0,0 @@ - - - - - - - - - - - - diff -r ab5611663f32 -r c22276db4025 gafa_datatypes.py --- a/gafa_datatypes.py Mon Mar 03 17:47:53 2025 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,56 +0,0 @@ -import logging - -from galaxy.datatypes.binary import Binary, SQlite -from galaxy.datatypes.metadata import MetadataElement, MetadataParameter -from galaxy.util import sqlite - -log = logging.getLogger(__name__) - - -class GAFASQLite(SQlite): - """Class describing a GAFA SQLite database""" - MetadataElement(name='gafa_schema_version', default='0.1.0', param=MetadataParameter, desc='GAFA schema version', - readonly=True, visible=True, no_value='0.1.0') - file_ext = 'gafa.sqlite' - - def set_meta(self, dataset, overwrite=True, **kwd): - super(GAFASQLite, self).set_meta(dataset, overwrite=overwrite, **kwd) - try: - conn = sqlite.connect(dataset.file_name) - c = conn.cursor() - version_query = 'SELECT version FROM meta' - results = c.execute(version_query).fetchall() - if len(results) == 0: - raise Exception('version not found in meta table') - elif len(results) > 1: - raise Exception('Multiple versions found in meta table') - dataset.metadata.gafa_schema_version = results[0][0] - except Exception as e: - log.warn("%s, set_meta Exception: %s", self, e) - - def sniff(self, filename): - if super(GAFASQLite, self).sniff(filename): - gafa_table_names = frozenset(['gene', 'gene_family', 'gene_family_member', 'meta', 'transcript']) - conn = sqlite.connect(filename) - c = conn.cursor() - tables_query = "SELECT name FROM sqlite_master WHERE type='table' ORDER BY name" - results = c.execute(tables_query).fetchall() - found_table_names = frozenset(_[0] for _ in results) - return gafa_table_names <= found_table_names - return False - - -# Since in Galaxy < 18.01 Binary.register_sniffable_binary_format() ignores the -# sniff order declared in datatypes_conf.xml and put TS datatypes at the end, -# instead of simply doing: -# Binary.register_sniffable_binary_format("sqlite", "sqlite", SQlite) -# we need to register specialized SQLite datatypes before SQlite -try: - for i, format_dict in enumerate(Binary.sniffable_binary_formats): - if format_dict['class'] == SQlite: - break - else: - i += 1 - Binary.sniffable_binary_formats.insert(i, {'type': 'gafa.sqlite', 'ext': 'gafa.sqlite', 'class': GAFASQLite}) -except AttributeError: - pass