changeset 35:414aa590a1de draft

Uploaded
author cropgeeks
date Thu, 02 Mar 2017 05:40:54 -0500
parents c8d80417e902
children 927533e85a6a
files flapjack.py hapmap2fj.xml hdf52fj.xml
diffstat 3 files changed, 19 insertions(+), 114 deletions(-) [+]
line wrap: on
line diff
--- 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"
--- 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 @@
-<tool id="flapjack_hapmap2fj" name="HapMap to Flapjack" version="0.0.1">
-
-<!--System.out.println("Usage: hapmap2flapjack <options>\n"
-			+ " where valid options are:\n"
-			+ "   -separator=<s or t>            (required separator used in input file)\n"
-			+ "   -hapmap=<hapmap_file>          (required input file)\n"
-			+ "   -map=<map_file>                (required output file)\n"
-			+ "   -genotypes=<genotype_file>     (required output file)\n");-->
-
-  <description>convert an HapMap formatted file into a Flapjack-formatted genotype file</description>
-  <command>java -Xmx$memory -cp $__tool_directory__/lib/flapjack.jar jhi.flapjack.io.cmd.HapMapToFJTabbedConverter 
-	  -hapmap=$hapmap
-	  -separator=$separator 
-	  -map=$map
-	  -genotypes=$genotypes
-  </command>
-  <inputs>
-    <param format="txt" name="hapmap" type="data" label="Source file"
-		help="HapMap Formatted File"/>
-	<param name="separator" type="boolean" label="File is tab-separated"
-		truevalue="t" falsevalue="s">
-	</param>
-	<param name="memory" type="select" label="Memory"
-		help="How much memory to use; larger files may require more memory">
-	  <option selected="true" value="64m">64MB</option>
-	  <option value="128m">128MB</option>
-	  <option value="256m">256MB</option>
-	</param>
-  </inputs>
-  <outputs>
-	<data format="fjmap" name="map" />
-    <data format="fjgenotype" name="genotypes" />
-  </outputs>
-  
-  <stdio>
-    <exit_code range="1:" />
-  </stdio>
-
-  <help><![CDATA[
-.. class:: infomark
-
-**What it does**
-
-Flapjack is a multi-platform application providing interactive visualizations of high-throughput genotype data,
-allowing for rapid navigation and comparisons between lines, markers and chromosomes.
-
-This tool converts a Flapjack-formatted file of genotype data into a corresponding HDF5 file.
-See Flapjack's documentation_ for more details on the various Flapjack data formats.
-
-.. _documentation: https://ics.hutton.ac.uk/wiki/index.php/Flapjack_Help_%2D_Projects_and_Data_Formats 
-
-
-
-  ]]></help>
-  <citations>
-    <citation type="doi">10.1093/bioinformatics/btq580</citation>
-  </citations>
-</tool>
\ No newline at end of file
--- 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 @@
-<tool id="flapjack_hdf52fj" name="HDF5 to Flapjack Tabbed Genotype Format" version="0.0.1">
-
-  <description>convert an HDF5 formatted genotype file into a Flapjack-formatted genotype file</description>
-  <command>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
-  </command>
-  <inputs>
-    <param format="h5" name="hdf5" type="data" label="Source file"
-		help="Flapjack's flavour of HDF5 for storing genotype data."/>
-	<param format="txt" name="lines" type="data" label="Source file"
-		help="A list of lines desired in the output. One line name per line on each line of the file."/>
-	<param format="txt" name="markers" type="data" label="Source file"
-		help="A list of markers desired in the output. One line name per marker on each line of the file."/>
-	<param name="missing_filter" type="boolean" label="Filter out missing markers"
-		truevalue="true" falsevalue="false">
-	</param>
-	<param name="heterozygous_filter" type="boolean" label="Filter out heterozygous markers"
-		truevalue="true" falsevalue="false">
-	</param>
-	<param name="memory" type="select" label="Memory"
-		help="How much memory to use; larger files may require more memory">
-	  <option selected="true" value="64m">64MB</option>
-	  <option value="128m">128MB</option>
-	  <option value="256m">256MB</option>
-	</param>
-  </inputs>
-  <outputs>
-    <data format="fjgenotype" name="genotypes" />
-  </outputs>
-
-  <help><![CDATA[
-.. class:: infomark
-
-**What it does**
-
-Flapjack is a multi-platform application providing interactive visualizations of high-throughput genotype data,
-allowing for rapid navigation and comparisons between lines, markers and chromosomes.
-
-This tool converts a Flapjack-formatted file of genotype data into a corresponding HDF5 file.
-See Flapjack's documentation_ for more details on the various Flapjack data formats.
-
-.. _documentation: https://ics.hutton.ac.uk/wiki/index.php/Flapjack_Help_%2D_Projects_and_Data_Formats 
-
-
-
-  ]]></help>
-  <citations>
-    <citation type="doi">10.1093/bioinformatics/btq580</citation>
-  </citations>
-</tool>
\ No newline at end of file