# HG changeset patch # User cropgeeks # Date 1488451254 18000 # Node ID 414aa590a1de2951a5efc67d48aefea8d6f79f2b # Parent c8d80417e9023a633d6478165a5263e03880dd38 Uploaded diff -r c8d80417e902 -r 414aa590a1de flapjack.py --- a/flapjack.py Tue Feb 28 05:01:03 2017 -0500 +++ b/flapjack.py Thu Mar 02 05:40:54 2017 -0500 @@ -1,8 +1,26 @@ from galaxy.datatypes.data import Text from galaxy.datatypes.tabular import Tabular +from galaxy.datatypes.binary import SQlite -class FlapjackFormat(Text): +class FlapjackFormat(SQlite): file_ext = "flapjack" + + def sniff(self, filename): + if super(FlapjackFormat, self).sniff(filename): + fj_table_names = ["objects", "project"] + try: + conn = sqlite.connect( filename ) + c = conn.cursor() + tables_query = "SELECT name FROM sqlite_master WHERE type='table' ORDER BY name" + result = c.execute(tables_query).fetchall() + result = [_[0] for _ in result] + for table_name in fj_table_names: + if table_name not in result: + return False + return True + except Exception as e: + log.warning( '%s, sniff Exception: %s', self, e ) + return False class FlapjackMapFormat(Tabular): file_ext = "fjmap" diff -r c8d80417e902 -r 414aa590a1de hapmap2fj.xml --- a/hapmap2fj.xml Tue Feb 28 05:01:03 2017 -0500 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,58 +0,0 @@ - - - - - convert an HapMap formatted file into a Flapjack-formatted genotype file - java -Xmx$memory -cp $__tool_directory__/lib/flapjack.jar jhi.flapjack.io.cmd.HapMapToFJTabbedConverter - -hapmap=$hapmap - -separator=$separator - -map=$map - -genotypes=$genotypes - - - - - - - - - - - - - - - - - - - - - - - 10.1093/bioinformatics/btq580 - - \ No newline at end of file diff -r c8d80417e902 -r 414aa590a1de hdf52fj.xml --- a/hdf52fj.xml Tue Feb 28 05:01:03 2017 -0500 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,55 +0,0 @@ - - - convert an HDF5 formatted genotype file into a Flapjack-formatted genotype file - java -Xmx$memory -cp $__tool_directory__/lib/flapjack.jar jhi.flapjack.io.cmd.Hdf5ToFJTabbedConverter - -hdf5=$hdf5 - -lines=$lines - -markers=$markers - -missing_filter=$missing_filter - -heterozygous_filter=$heterozygous_filter - -genotypes=$genotypes - - - - - - - - - - - - - - - - - - - - - - 10.1093/bioinformatics/btq580 - - \ No newline at end of file