changeset 2:52da588232b0

Add datatypes for maps and snpindex, add iit_store and snpindex tools, update GMAP and GSNAP to use these.
author Jim Johnson <jj@umn.edu>
date Fri, 21 Oct 2011 11:38:55 -0500
parents 30d42bb409b8
children 72ab00e732c3
files gmap/README gmap/gmap.xml gmap/gmap_build.xml gmap/gsnap.xml gmap/iit_store.xml gmap/lib/galaxy/datatypes/gmap.py gmap/snpindex.xml
diffstat 7 files changed, 981 insertions(+), 278 deletions(-) [+]
line wrap: on
line diff
--- a/gmap/README	Tue Oct 18 11:51:15 2011 -0500
+++ b/gmap/README	Fri Oct 21 11:38:55 2011 -0500
@@ -9,9 +9,16 @@
    add to datatypes_conf.xml
         <!-- Start GMAP Datatypes -->
         <datatype extension="gmapdb" type="galaxy.datatypes.gmap:GmapDB"  display_in_upload="False"/>
-        <!--
-
-
+        <datatype extension="gmapsnpindex" type="galaxy.datatypes.gmap:GmapSnpIndex"  display_in_upload="False"/>
+        <datatype extension="iit" type="galaxy.datatypes.gmap:IntervalIndexTree"  display_in_upload="True"/>
+        <datatype extension="splicesites.iit" type="galaxy.datatypes.gmap:SpliceSitesIntervalIndexTree"  display_in_upload="True"/>
+        <datatype extension="introns.iit" type="galaxy.datatypes.gmap:IntronsIntervalIndexTree"  display_in_upload="True"/>
+        <datatype extension="snps.iit" type="galaxy.datatypes.gmap:SNPsIntervalIndexTree"  display_in_upload="True"/>
+        <datatype extension="gmap_annotation" type="galaxy.datatypes.gmap:IntervalAnnotation"  display_in_upload="False"/>
+        <datatype extension="gmap_splicesites" type="galaxy.datatypes.gmap:SpliceSiteAnnotation"  display_in_upload="True"/>
+        <datatype extension="gmap_introns" type="galaxy.datatypes.gmap:IntronAnnotation"  display_in_upload="True"/>
+        <datatype extension="gmap_snps" type="galaxy.datatypes.gmap:SNPAnnotation"  display_in_upload="True"/>
+        <!-- End GMAP tools -->
 
 Tools:
   GMAP_Build - create a GmapDB set of index files for a reference sequence and optional set of annotations
@@ -19,28 +26,22 @@
   GSNAP - align sequences to a reference and detect splicing 
 
   Add to  tool_conf.xml     ( probably in the "NGS: Mapping" section )
-   <tool file="gmap/gmap_build.xml" />
    <tool file="gmap/gmap.xml" />
    <tool file="gmap/gsnap.xml" />
+   <tool file="gmap/gmap_build.xml" />
+   <tool file="gmap/snpindex.xml" />
+   <tool file="gmap/iit_store.xml" />
+
+Admin built cached gmapdb indexes defined in tool-data/gmap_indices.loc
 
 
 TODO:
   Add classes to gmap.py
-    IntervalIndexTree  -  datatype for the iit_store result
-    IntervalAnnotation  - generic class  for gmap annotation formats
-    SpliceSiteAnnotation - class  for gmap splicesite annotation format
-    IntronAnnotation - class  for gmap introns  annotation format
-    SNPAnnotation - class  for gmap snp  annotation format
-    GmapIndex - generic class for a gmap index
-    SnpIndex - an index created by  snpindex
     CmetIndex - an index created by cmetindex
     AtoiIndex - an index created by atoiindex
 
   Possibly add Tools:
-    iit_store - creates a mapping index .iit from: gtf,gff3,gmapannotation, UCSC refGene table
-    iit_get - retrieves from .iit store 
     get_genome - retrieves from a gmapdb
-    snpindex  - create a SNPIndex
     cmetindex - create methylcytosine index
     atoiindex - create  A-to-I RNA editing index
     
--- a/gmap/gmap.xml	Tue Oct 18 11:51:15 2011 -0500
+++ b/gmap/gmap.xml	Fri Oct 21 11:38:55 2011 -0500
@@ -1,7 +1,13 @@
 <tool id="gmap" name="GMAP" version="2.0.0">
   <description>Genomic Mapping and Alignment Program for mRNA and EST sequences</description>
   <requirements>
-      <requirement type="binary">gmap</requirement>
+    <requirement type="binary">gmap</requirement>
+    <!-- proposed tag for added datatype dependencies -->
+    <requirement type="datatype">gmapdb</requirement>
+    <requirement type="datatype">gmap_annotation</requirement>
+    <requirement type="datatype">gmap_splicesites</requirement>
+    <requirement type="datatype">gmap_introns</requirement>
+    <requirement type="datatype">gmap_snps</requirement>
   </requirements>
   <version_string>gmap --version</version_string>
   <command>
@@ -113,8 +119,20 @@
     #end if
   </command>
   <inputs>
+    <!-- Input data -->
+    <param name="input" type="data" format="fasta,fastqsanger,fastqillumina" label="&lt;H2&gt;Input Sequences&lt;/H2&gt;Select an mRNA or EST dataset to map" />
+    <repeat name="inputs" title="addtional mRNA or EST dataset to map">
+      <param name="added_input" type="data" format="fasta,fastqsanger,fastqillumina" label=""/>
+    </repeat>
+    <param name="quality_protocol" type="select" label="Protocol for input quality scores">
+      <option value="">No quality scores</option>
+      <option value="sanger">Sanger quality scores</option>
+      <option value="illumina">Illumina quality scores</option>
+    </param>
+
+    <!-- GMAPDB for mapping -->
     <conditional name="refGenomeSource">
-     <param name="genomeSource" type="select" label="Will you map to a reference genome from your history or use a built-in index?" help="Built-ins were indexed using default options">
+     <param name="genomeSource" type="select" label="&lt;HR&gt;&lt;H2&gt;Map To&lt;/H2&gt;Will you map to a reference genome from your history or use a built-in index?" help="Built-ins were indexed using default options">
         <option value="indexed">Use a built-in index</option>
         <option value="gmapdb">Use gmapdb from the history</option>
         <option value="history">Use a fasta reference sequence from the history</option>
@@ -155,8 +173,6 @@
       <when value="gmapdb">
         <param name="gmapdb" type="data" format="gmapdb" metadata_name="dbkey" label="Select a gmapdb" 
               help="A GMAP database built with GMAP Build"/>
-        <param name="gmapdb" type="data" format="gmapdb" metadata_name="dbkey" label="Select a gmapdb" 
-              help="A GMAP database built with GMAP Build"/>
         <param name="kmer" type="select" data_ref="gmapdb" label="kmer size" help="Defaults to highest available kmer size">
           <options>
             <filter type="data_meta" ref="gmapdb" key="kmers" multiple="True" separator=","/>
@@ -174,18 +190,89 @@
       </when>
     </conditional>
 
-    <!-- Input data -->
-    <param name="input" type="data" format="fasta,fastqsanger,fastqillumina" label="Select an mRNA or EST dataset to map" />
-    <repeat name="inputs" title="addtional mRNA or EST dataset to map">
-      <param name="added_input" type="data" format="fasta,fastqsanger,fastqillumina" label=""/>
-    </repeat>
-    <param name="quality_protocol" type="select" label="Protocol for input quality scores">
-      <option value="">No quality scores</option>
-      <option value="sanger">Sanger quality scores</option>
-      <option value="illumina">Illumina quality scores</option>
-    </param>
+    
+    <!-- Computation options -->
+    <conditional name="computation">
+      <param name="options" type="select" label="&lt;HR&gt;Computational Settings" help="">
+        <option value="default">Use default settings</option>
+        <option value="advanced">Set Computation Options</option>
+      </param>
+      <when value="default"/>
+      <when value="advanced">
+       <param name="nosplicing" type="boolean" truevalue="--nosplicing" falsevalue="" checked="false" label="Turn off splicing" help="(useful for aligning genomic sequences onto a genome)"/>
+       <param name="min_intronlength" type="integer" value="9" label="Min length for one internal intron (default 9)." help="Below this size, a genomic gap will be considered a deletion rather than an intron." />	
+       <param name="intronlength" type="integer" value="1000000" label="Max length for one intron (default 1000000)" />	
+       <param name="localsplicedist" type="integer" value="200000" label="Max length for known splice sites at ends of sequence (default 200000)" />	
+       <param name="totallength"  type="integer" value="2400000" label="Max total intron length (default 2400000)" />	
+       <param name="chimera_margin" type="integer" value="40" label="Amount of unaligned sequence that triggers search for a chimera (default is 40, 0 is off)" />	
+       <param name="direction"  type="select" label="cDNA direction">	
+         <option value="auto">auto</option>
+         <option value="sense_force">sense_force</option>
+         <option value="antisense_force">antisense_force</option>
+         <option value="sense_filter">sense_filter</option>
+         <option value="antisense_filter">antisense_filter</option>
+       </param>
+       <param name="trimendexons"  type="integer" value="12" label="Trim end exons with fewer than given number of matches (in nt, default 12)" />	
+       <param name="cross_species" type="boolean" truevalue="--cross-species" falsevalue="" checked="false" label="Cross-species alignment" help="For cross-species alignments, use a more sensitive search for canonical splicing"/>
+       
+       <param name="canonical"  type="select" label="Reward for canonical and semi-canonical introns">	
+         <option value="1">high reward (default)</option>
+         <option value="0">low reward</option>
+         <option value="2">low reward for high-identity sequences</option>
+       </param>
+       <param name="allow_close_indels"  type="select" label="Allow an insertion and deletion close to each other">	
+         <option value="1" selected="true">yes (default)</option>
+         <option value="0">no</option>
+         <option value="2">only for high-quality alignments</option>
+       </param>
+       <param name="microexon_spliceprob" type="float" value="0.90" label="Allow microexons only if one of the splice site probabilities is greater than this value (default 0.90)" >	
+         <validator type="in_range" message="slice probability between 0.00 and 1.00" min="0" max="1"/> 
+       </param>
+       <param name="prunelevel"  type="select" label="Pruning level">	
+         <option value="0">no pruning (default)</option>
+         <option value="1">poor sequences</option>
+         <option value="2">repetitive sequences</option>
+         <option value="3">poor and repetitive sequences</option>
+       </param>
+       <!--  could do this as a config file 
+       <param name="chrsubsetfile" type="data" format="fasta" label="User-supplied chromosome subset file" />
+       <param name="chrsubset" type="text" label="Chromosome subset to search" />
+       -->
+      </when>
+    </conditional>
+
+    <!-- Advanced Settings -->
+    <conditional name="advanced">
+      <param name="options" type="select" label="&lt;HR&gt;Advanced Settings" help="">
+        <option value="default">Use default settings</option>
+        <option value="used">Set Options</option>
+      </param>
+      <when value="default"/>
+      <when value="used">
+       <param name="nolengths" type="boolean" checked="false" truevalue="--nolengths=true" falsevalue="" label="No intron lengths in alignment"/>
+       <param name="invertmode" type="select" label=" Mode for alignments to genomic (-) strand" help="">
+        <option value="">Don't invert the cDNA (default)</option>
+        <option value="--invertmode=1">Invert cDNA and print genomic (-) strand</option>
+        <option value="--invertmode=2">Invert cDNA and print genomic (+) strand</option>
+       </param>
+       <param name="introngap" type="integer" value="3" label="Nucleotides to show on each end of intron (default=3)" />	
+       <param name="wraplength" type="integer" value="50" label="Line Wrap length for alignment (default=50)" />	
+       <param name="npaths" type="integer" value="-1" optional="true"
+              label="Maximum number of paths to show.  Ignored if negative.  If 0, prints two paths if chimera detected, else one." />	
+       <param name="chimera_overlap" type="integer" value="0" label="Overlap to show, if any, at chimera breakpoint" />	
+       <param name="tolerant" type="boolean" checked="false" truevalue="--tolerant=true" falsevalue="" 
+              label="Translates cDNA with corrections for frameshifts"/>
+       <param name="protein" type="select" label="Protein alignment" help="">
+        <option value="">default</option>
+        <option value="--fulllength=true">Assume full-length protein, starting with Met</option>
+        <option value="--truncate=true">Truncate alignment around full-length protein, Met to Stop</option>
+       </param>
+      </when>
+    </conditional>
+
+    <!-- Output data -->
     <conditional name="result">
-    <param name="format" type="select" label="Select the output format" help="">
+    <param name="format" type="select" label="&lt;HR&gt;&lt;H2&gt;Output&lt;/H2&gt;Select the output format" help="">
       <option value="gmap">GMAP default output</option>
       <option value="summary">Summary of alignments</option>
       <option value="align">Alignment</option>
@@ -246,92 +333,20 @@
     </conditional> <!-- name="result" -->
 
     <param name="split_output" type="boolean" truevalue="--split-output=gmap_out" falsevalue="" checked="false" label="Separate outputs for nomapping, uniq, mult, and chimera" help="(chimera only when chimera-margin is selected)"/>
-    
-    <conditional name="computation">
-      <param name="options" type="select" label="Computational Settings" help="">
-        <option value="default">Use default settings</option>
-        <option value="advanced">Set Computation Options</option>
-      </param>
-      <when value="default"/>
-      <when value="advanced">
-       <param name="nosplicing" type="boolean" truevalue="--nosplicing" falsevalue="" checked="false" label="Turn off splicing" help="(useful for aligning genomic sequences onto a genome)"/>
-       <param name="min_intronlength" type="integer" value="9" label="Min length for one internal intron (default 9)." help="Below this size, a genomic gap will be considered a deletion rather than an intron." />	
-       <param name="intronlength" type="integer" value="1000000" label="Max length for one intron (default 1000000)" />	
-       <param name="localsplicedist" type="integer" value="200000" label="Max length for known splice sites at ends of sequence (default 200000)" />	
-       <param name="totallength"  type="integer" value="2400000" label="Max total intron length (default 2400000)" />	
-       <param name="chimera_margin" type="integer" value="40" label="Amount of unaligned sequence that triggers search for a chimera (default is 40, 0 is off)" />	
-       <param name="direction"  type="select" label="cDNA direction">	
-         <option value="auto">auto</option>
-         <option value="sense_force">sense_force</option>
-         <option value="antisense_force">antisense_force</option>
-         <option value="sense_filter">sense_filter</option>
-         <option value="antisense_filter">antisense_filter</option>
-       </param>
-       <param name="trimendexons"  type="integer" value="12" label="Trim end exons with fewer than given number of matches (in nt, default 12)" />	
-       <param name="cross_species" type="boolean" truevalue="--cross-species" falsevalue="" checked="false" label="Cross-species alignment" help="For cross-species alignments, use a more sensitive search for canonical splicing"/>
-       
-       <param name="canonical"  type="select" label="Reward for canonical and semi-canonical introns">	
-         <option value="1">high reward (default)</option>
-         <option value="0">low reward</option>
-         <option value="2">low reward for high-identity sequences</option>
-       </param>
-       <param name="allow_close_indels"  type="select" label="Allow an insertion and deletion close to each other">	
-         <option value="1" selected="true">yes (default)</option>
-         <option value="0">no</option>
-         <option value="2">only for high-quality alignments</option>
-       </param>
-       <param name="microexon_spliceprob" type="float" value="0.90" label="Allow microexons only if one of the splice site probabilities is greater than this value (default 0.90)" >	
-         <validator type="in_range" message="slice probability between 0.00 and 1.00" min="0" max="1"/> 
-       </param>
-       <param name="prunelevel"  type="select" label="Pruning level">	
-         <option value="0">no pruning (default)</option>
-         <option value="1">poor sequences</option>
-         <option value="2">repetitive sequences</option>
-         <option value="3">poor and repetitive sequences</option>
-       </param>
-       <!--  could do this as a config file 
-       <param name="chrsubsetfile" type="data" format="fasta" label="User-supplied chromosome subset file" />
-       <param name="chrsubset" type="text" label="Chromosome subset to search" />
-       -->
-      </when>
-    </conditional>
-    <conditional name="advanced">
-      <param name="options" type="select" label="Advanced Settings" help="">
-        <option value="default">Use default settings</option>
-        <option value="used">Set Options</option>
-      </param>
-      <when value="default"/>
-      <when value="used">
-       <param name="nolengths" type="boolean" checked="false" truevalue="--nolengths=true" falsevalue="" label="No intron lengths in alignment"/>
-       <param name="invertmode" type="select" label=" Mode for alignments to genomic (-) strand" help="">
-        <option value="">Don't invert the cDNA (default)</option>
-        <option value="--invertmode=1">Invert cDNA and print genomic (-) strand</option>
-        <option value="--invertmode=2">Invert cDNA and print genomic (+) strand</option>
-       </param>
-       <param name="introngap" type="integer" value="3" label="Nucleotides to show on each end of intron (default=3)" />	
-       <param name="wraplength" type="integer" value="50" label="Line Wrap length for alignment (default=50)" />	
-       <param name="npaths" type="integer" value="-1" optional="true"
-              label="Maximum number of paths to show.  Ignored if negative.  If 0, prints two paths if chimera detected, else one." />	
-       <param name="chimera_overlap" type="integer" value="0" label="Overlap to show, if any, at chimera breakpoint" />	
-       <param name="tolerant" type="boolean" checked="false" truevalue="--tolerant=true" falsevalue="" 
-              label="Translates cDNA with corrections for frameshifts"/>
-       <param name="protein" type="select" label="Protein alignment" help="">
-        <option value="">default</option>
-        <option value="--fulllength=true">Assume full-length protein, starting with Met</option>
-        <option value="--truncate=true">Truncate alignment around full-length protein, Met to Stop</option>
-       </param>
-      </when>
-    </conditional>
+
+
     <!-- 
-      map=iitfile              Map file.  If argument is '?' (with the quotes), this lists available map files.
-      mapexons                 Map each exon separately
-      mapboth                  Report hits from both strands of genome
-      flanking=INT             Show flanking hits (default 0)
-      print-comment                Show comment line for each hit
+      map=iitfile      Map file.  If argument is '?' (with the quotes), this lists available map files.
+      mapexons         Map each exon separately
+      mapboth          Report hits from both strands of genome
+      flanking=INT     Show flanking hits (default 0)
+      print-comment    Show comment line for each hit
     -->
+
+
   </inputs>
   <outputs>
-    <data format="txt" name="gmap_stderr" label="${tool.name} on ${on_string}: log"/>
+    <data format="txt" name="gmap_stderr" label="${tool.name} on ${on_string}: stderr"/>
     <data format="txt" name="output" label="${tool.name} on ${on_string} ${result.format}" >
       <filter>(split_output == False)</filter>
       <change_format>
@@ -339,10 +354,10 @@
         <when input="result['format']" value="gff3_match_cdna" format="gff3"/>
         <when input="result['format']" value="gff3_match_est" format="gff3"/>
         <when input="result['format']" value="sam" format="sam"/>
-        <!--
         <when input="result['format']" value="splicesites" format="gmap_splicesites"/>
         <when input="result['format']" value="introns" format="gmap_introns"/>
-        -->
+        <when input="result['format']" value="map_genes" format="gmap_annotation"/>
+        <when input="result['format']" value="map_exons" format="gmap_annotation"/>
       </change_format>
     </data>
     <data format="txt" name="uniq" label="${tool.name} on ${on_string} uniq.${result.format}"  from_work_dir="gmap_out.uniq">
@@ -352,6 +367,10 @@
         <when input="result['format']" value="gff3_match_cdna" format="gff3"/>
         <when input="result['format']" value="gff3_match_est" format="gff3"/>
         <when input="result['format']" value="sam" format="sam"/>
+        <when input="result['format']" value="splicesites" format="gmap_splicesites"/>
+        <when input="result['format']" value="introns" format="gmap_introns"/>
+        <when input="result['format']" value="map_genes" format="gmap_annotation"/>
+        <when input="result['format']" value="map_exons" format="gmap_annotation"/>
       </change_format>
     </data>
     <data format="txt" name="transloc" label="${tool.name} on ${on_string} transloc.${result.format}"  from_work_dir="gmap_out.transloc">
@@ -361,6 +380,10 @@
         <when input="result['format']" value="gff3_match_cdna" format="gff3"/>
         <when input="result['format']" value="gff3_match_est" format="gff3"/>
         <when input="result['format']" value="sam" format="sam"/>
+        <when input="result['format']" value="splicesites" format="gmap_splicesites"/>
+        <when input="result['format']" value="introns" format="gmap_introns"/>
+        <when input="result['format']" value="map_genes" format="gmap_annotation"/>
+        <when input="result['format']" value="map_exons" format="gmap_annotation"/>
       </change_format>
     </data>
     <data format="txt" name="nomapping" label="${tool.name} on ${on_string} nomapping.${result.format}"  from_work_dir="gmap_out.nomapping">
@@ -370,6 +393,10 @@
         <when input="result['format']" value="gff3_match_cdna" format="gff3"/>
         <when input="result['format']" value="gff3_match_est" format="gff3"/>
         <when input="result['format']" value="sam" format="sam"/>
+        <when input="result['format']" value="splicesites" format="gmap_splicesites"/>
+        <when input="result['format']" value="introns" format="gmap_introns"/>
+        <when input="result['format']" value="map_genes" format="gmap_annotation"/>
+        <when input="result['format']" value="map_exons" format="gmap_annotation"/>
       </change_format>
     </data>
     <data format="txt" name="mult" label="${tool.name} on ${on_string} mult.${result.format}"  from_work_dir="gmap_out.mult">
@@ -379,6 +406,10 @@
         <when input="result['format']" value="gff3_match_cdna" format="gff3"/>
         <when input="result['format']" value="gff3_match_est" format="gff3"/>
         <when input="result['format']" value="sam" format="sam"/>
+        <when input="result['format']" value="splicesites" format="gmap_splicesites"/>
+        <when input="result['format']" value="introns" format="gmap_introns"/>
+        <when input="result['format']" value="map_genes" format="gmap_annotation"/>
+        <when input="result['format']" value="map_exons" format="gmap_annotation"/>
       </change_format>
     </data>
   </outputs>
--- a/gmap/gmap_build.xml	Tue Oct 18 11:51:15 2011 -0500
+++ b/gmap/gmap_build.xml	Fri Oct 21 11:38:55 2011 -0500
@@ -1,16 +1,23 @@
 <tool id="gmap_build" name="GMAP Build" version="2.0.0">
-  <description>a GMAP DB Index</description>
+  <description>a database genome index for GMAP and GSNAP</description>
   <requirements>
       <requirement type="binary">gmap_build</requirement>
+      <!-- proposed tag for added datatype dependencies -->
+      <requirement type="datatype">gmapdb</requirement>
+      <requirement type="datatype">gmap_snps</requirement>
   </requirements>
   <version_string>gmap --version</version_string>
   <command interpreter="command"> /bin/bash $shscript 2>1 1> $output </command>
   <inputs>
-    <!-- Input data -->
-    <param name="input" type="data" format="fasta" label="reference sequence fasta" />
-    <param name="refname" type="text" label="reference name" help="">
+    <!-- Name for this gmapdb -->
+    <param name="refname" type="text" label="Name you want to give this gmap database" help="">
       <validator type="empty_field" message="A database name is required."/>
     </param>
+    <!-- Input data -->
+    <repeat name="inputs" title="Reference Sequence" min="1">
+      <param name="input" type="data" format="fasta" label="reference sequence fasta" />
+    </repeat>
+
     <param name="kmer" type="select" multiple="true" force_select="true" label="kmer size" help="">
       <option value="12">12</option>
       <option value="13">13</option>
@@ -79,7 +86,6 @@
     <!--
     <data format="txt" name="log" label="${tool.name} on ${on_string}: log"/>
     -->
-    <!-- this should have its own datatype: gmapdb -->
     <data format="gmapdb" name="output" label="${tool.name} on ${on_string} gmapdb ${refname}" />
   </outputs>
   <configfiles>
@@ -89,6 +95,11 @@
 #set $gt = chr(62)
 #set $lt = chr(60)
 #set $ad = chr(38)
+## #set $ref_files = ''
+## #for $i in $inputs:
+  ## #set $ref_files = $ref_files $i.input
+## #end for
+## echo $ref_files
 #import os.path
 #set $gmapdb = $output.extra_files_path
 #set $mapsdir = $os.path.join($os.path.join($gmapdb,str($refname)), str($refname) + '.maps')
@@ -96,7 +107,7 @@
 ## export GMAPDB required for cmetindex  and atoiindex
 export GMAPDB=$gmapdb
 #for $k in $kmer.__str__.split(','):
-gmap_build -D $gmapdb -d $refname -s numeric-alpha -k $k $input
+gmap_build -D $gmapdb -d $refname -s numeric-alpha -k $k #for i in $inputs# ${i.input}#end for#
 #end for
 get-genome -D $gmapdb -d '?' | sed 's/^Available .*/gmap db: /' 
 echo "kmers: " $kmer 
@@ -116,23 +127,26 @@
 cat $splicesite.gff3Genes | gff3_introns | iit_store -o  $os.path.join($mapsdir,'introns')
 #end if
 #end if
+#if $dbsnp.snp_source != 'none' and $dbsnp.snps.__str__ != 'None':
 #if $dbsnp.snp_source == 'snpTable':
-#if $dbsnp.snps.__str__ != 'None':
 #if $dbsnp.snpsex.__str__ != 'None':
 cat $dbsnp.snps | dbsnp_iit -w $dbsnp.weight -e $dbsnp.snpsex | iit_store -o  $os.path.join($mapsdir,'snps')
 #else:
 cat $dbsnp.snps | dbsnp_iit -w $dbsnp.weight | iit_store -o  $os.path.join($mapsdir,'snps')
 #end if
+#else:
+cat $dbsnp.snps | iit_store -o  $os.path.join($mapsdir,'snps')
+#end if
 snpindex -d $refname -v snps
-#end if
+echo "snpindex" -d  $refname -v snps
 #end if
 #if $cmetindex.__str__ == 'yes':
 cmetindex -d $refname
-echo "cmetindex" 
+echo "cmetindex" -d $refname
 #end if
 #if $atoiindex.__str__ == 'yes':
 atoiindex -d $refname
-echo "atoiindex" 
+echo "atoiindex" -d $refname
 #end if
 get-genome -D $gmapdb -d $refname -m '?' | sed 's/^Available maps .*/maps: /' 
     </configfile>
@@ -146,7 +160,7 @@
 
 **GMAP Build**
 
-GMAP Build creates an index of a genomic sequence for alignments using GMAP_ (Genomic Mapping and Alignment Program for mRNA and EST sequences) and GSNAP_ (Genomic Short-read Nucleotide Alignment Program).  
+GMAP Build creates an index of a genomic sequence for mapping and alignment using GMAP_ (Genomic Mapping and Alignment Program for mRNA and EST sequences) and GSNAP_ (Genomic Short-read Nucleotide Alignment Program).  (GMAP Build uses GMSP commands: gmap_build, iit_store, psl_splicesites, psl_introns, gtf_splicesites, gtf_introns, gff3_splicesites, gff3_introns, dbsnp_iit, snpindex, cmetindex, and atoiindex.)
 
 You will want to read the README_
 
--- a/gmap/gsnap.xml	Tue Oct 18 11:51:15 2011 -0500
+++ b/gmap/gsnap.xml	Fri Oct 21 11:38:55 2011 -0500
@@ -2,31 +2,43 @@
   <description>Genomic Short-read Nucleotide Alignment Program</description>
   <requirements>
       <requirement type="binary">gsnap</requirement>
+      <!-- proposed tag for added datatype dependencies -->
+      <requirement type="datatype">gmapdb</requirement>
+      <requirement type="datatype">gmapsnpindex</requirement>
+      <requirement type="datatype">splicesites.iit</requirement>
+      <requirement type="datatype">introns.iit</requirement>
   </requirements>
   <version_string>gsnap --version</version_string>
   <command>
     #import os.path, re
     gsnap
     --nthreads="4" --ordered
-    #if $refGenomeSource.genomeSource == "history":
-      --gseg=$refGenomeSource.ownFile
-    #elif $refGenomeSource.genomeSource == "gmapdb":
+    #if $refGenomeSource.genomeSource == "gmapdb":
       #set $gmapdb = $os.listdir($refGenomeSource.gmapdb.extra_files_path)[0]
-      --dir=$refGenomeSource.gmapdb.extra_files_path --db=$gmapdb
-      #if $refGenomeSource.kmer != None and len($refGenomeSource.kmer.__str__) == 2:
-        --kmer=$refGenomeSource.kmer
-      #end if
-      #if $refGenomeSource.splicemap != None and len($refGenomeSource.splicemap.__str__) == 2:
-        --use-splices=$refGenomeSource.splicemap
-      #end if
-      #if $refGenomeSource.snpindex != None and len($refGenomeSource.snpindex.__str__) == 2:
-        --use-snps=$refGenomeSource.snpindex
-      #end if
+      --dir=$refGenomeSource.gmapdb.extra_files_path --db=$refGenomeSource.gmapdb.metadata.db_name
     #else:
       --dir=$os.path.dirname($refGenomeSource.gmapindex.value) --db=$os.path.basename($refGenomeSource.gmapindex.value)
-      #if $refGenomeSource.kmer != None and len($refGenomeSource.kmer.__str__) == 2:
-        --kmer=$refGenomeSource.kmer
+    #end if
+    #if $refGenomeSource.kmer != None and len($refGenomeSource.kmer.__str__) == 2:
+      --kmer=$refGenomeSource.kmer
+    #end if
+    #if $refGenomeSource.use_splicing.src == 'gmapdb':
+      #if $refGenomeSource.use_splicing.splicemap != None and len($refGenomeSource.use_splicing.splicemap.__str__) > 0:
+        -s $refGenomeSource.use_splicing.splicemap.value
       #end if
+    #elif $refGenomeSource.use_splicing.src == 'history':
+      #if $refGenomeSource.use_splicing.splicemap != None and len($refGenomeSource.use_splicing.splicemap.__str__) > 0:
+        -S $os.path.dirname($refGenomeSource.use_splicing.splicemap) -s $os.path.basename($refGenomeSource.use_splicing.splicemap)
+      #end if
+    #end if
+    #if $refGenomeSource.use_snps.src == 'gmapdb':
+       #if $refGenomeSource.use_snps.snpindex != None and len($refGenomeSource.use_snps.snpindex.__str__) > 0:
+        -v $refGenomeSource.use_snps.snpindex.value
+       #end if
+    #elif $refGenomeSource.use_snps.src == 'history':
+       #if $refGenomeSource.use_snps.snpindex != None and len($refGenomeSource.use_snps.snpindex.__str__) > 0:
+         -V $refGenomeSource.use_snps.snpindex.extra_files_path -v $refGenomeSource.use_snps.snpindex.metadata.snps_name
+       #end if
     #end if
     #if $mode.__str__ != '':
       --mode=$mode
@@ -181,86 +193,9 @@
 
   </command>
   <inputs>
-    <conditional name="refGenomeSource">
-     <param name="genomeSource" type="select" label="Will you select a reference genome from your history or use a built-in index?" help="Built-ins were indexed using default options">
-        <option value="indexed">Use a built-in index</option>
-        <option value="gmapdb">Use gmapdb from the history</option>
-        <option value="history">Use one from the history</option>
-      </param>
-      <when value="indexed">
-        <param name="gmapindex" type="select" label="Select a reference genome" help="if your genome of interest is not listed - contact Galaxy team">
-          <options from_file="gmap_indices.loc">
-            <column name="uid" index="0" />
-            <column name="dbkey" index="1" />
-            <column name="name" index="2" />
-            <column name="kmers" index="3" />
-            <column name="maps" index="4" />
-            <column name="snps" index="5" />
-            <column name="value" index="6" />
-          </options>
-        </param>
-
-        <param name="kmer" type="select" data_ref="gmapindex" label="kmer size" help="Defaults to highest available kmer size">
-          <options from_file="gmap_indices.loc">
-            <column name="name" index="3"/>
-            <column name="value" index="3"/>
-            <filter type="param_value" ref="gmapindex" column="6"/>
-            <filter type="multiple_splitter" column="3" separator=","/>
-            <filter type="add_value" name="" value=""/>
-            <filter type="sort_by" column="3"/>
-          </options>
-        </param>
-
-        <param name="splicemap" type="select" data_ref="gmapindex" label="Use map for splicing involving known sites or known introns" help="">
-          <options from_file="gmap_indices.loc">
-            <column name="name" index="4"/>
-            <column name="value" index="4"/>
-            <filter type="param_value" ref="gmapindex" column="6"/>
-            <filter type="multiple_splitter" column="4" separator=","/>
-            <filter type="add_value" name="" value=""/>
-            <filter type="sort_by" column="4"/>
-          </options>
-        </param>
-
-        <param name="snpindex" type="select" data_ref="gmapindex" label="Use database containing known SNPs" help="">
-          <options from_file="gmap_indices.loc">
-            <column name="name" index="5"/>
-            <column name="value" index="5"/>
-            <filter type="param_value" ref="gmapindex" column="6"/>
-            <filter type="multiple_splitter" column="5" separator=","/>
-            <filter type="add_value" name="" value=""/>
-            <filter type="sort_by" column="5"/>
-          </options>
-        </param>
-      </when>
-      <when value="gmapdb">
-        <param name="gmapdb" type="data" format="gmapdb" metadata_name="dbkey" label="Select a gmapdb" 
-              help="A GMAP database built with GMAP Build"/>
-        <param name="kmer" type="select" data_ref="gmapdb" label="kmer size" help="Defaults to highest available kmer size">
-          <options>
-            <filter type="data_meta" ref="gmapdb" key="kmers" multiple="True" separator=","/>
-          </options>
-        </param>
-        <param name="splicemap" type="select"  data_ref="gmapdb" label="Use map for splicing involving known sites or known introns" help="">
-          <options>
-            <filter type="data_meta" ref="gmapdb" key="maps" multiple="True"/>
-          </options>
-        </param>
-        <param name="snpindex" type="select"  data_ref="gmapdb" label="Use database containing known SNPs" help="">
-          <options>
-            <filter type="data_meta" ref="gmapdb" key="snps" multiple="True" separator=","/>
-          </options>
-        </param>
-
-      </when>
-      <when value="history">
-        <param name="ownFile" type="data" format="fasta" metadata_name="dbkey" label="Select the reference genome" 
-              help="Fasta containing genomic DNA sequence"/>
-      </when>
-    </conditional>
     <!-- Input data -->
     <conditional name="seq">
-      <param name="format" type="select" label="Select the input format" help="">
+      <param name="format" type="select" label="&lt;H2&gt;Input Sequences&lt;/H2&gt;Select the input format" help="">
         <option value="fastq">Fastq</option>
         <option value="gsnap_fasta">GNSAP fasta</option>
       </param>
@@ -308,6 +243,7 @@
         <param name="circularinput" type="boolean" checked="false" truevalue="--circular-input=true" falsevalue="" label="Circular-end data (paired reads are on same strand)"/>
       </when>
     </conditional>
+
     <param name="mode" type="select" label="Alignment mode" help="Assumes cmetindex and atoiindex were run on the gmap datatbase.">
         <option value="">standard</option>
         <option value="cmet-stranded">cmet-stranded   for bisulfite-treated DNA reads (tolerance to C-to-T changes)</option>
@@ -315,9 +251,147 @@
         <option value="atoi-stranded">atoi-stranded   for RNA-editing tolerance (A-to-G changes)</option>
         <option value="atoi-nonstranded">atoi-nonstranded   for RNA-editing tolerance (A-to-G changes)</option>
     </param>
+
+    <!-- GMAPDB for alignment -->
+    <conditional name="refGenomeSource">
+     <param name="genomeSource" type="select" label="&lt;HR&gt;&lt;H2&gt;Align To&lt;/H2&gt;Will you select a reference genome from your history or use a built-in index?" help="Built-ins were indexed using default options">
+        <option value="indexed">Use a built-in index</option>
+        <option value="gmapdb">Use a gmapdb from your history</option>
+      </param>
+      <when value="indexed">
+        <param name="gmapindex" type="select" label="Select a reference genome" help="if your genome of interest is not listed - contact Galaxy team">
+          <options from_file="gmap_indices.loc">
+            <column name="uid" index="0" />
+            <column name="dbkey" index="1" />
+            <column name="name" index="2" />
+            <column name="kmers" index="3" />
+            <column name="maps" index="4" />
+            <column name="snps" index="5" />
+            <column name="value" index="6" />
+          </options>
+        </param>
+
+        <param name="kmer" type="select" data_ref="gmapindex" label="kmer size" help="Defaults to highest available kmer size">
+          <options from_file="gmap_indices.loc">
+            <column name="name" index="3"/>
+            <column name="value" index="3"/>
+            <filter type="param_value" ref="gmapindex" column="6"/>
+            <filter type="multiple_splitter" column="3" separator=","/>
+            <filter type="add_value" name="" value=""/>
+            <filter type="sort_by" column="3"/>
+          </options>
+        </param>
+
+        <conditional name="use_splicing">
+          <param name="src" type="select" label="Known Splicesite and Introns" 
+                 help="Look for splicing involving known sites or known introns at short or long distances 
+                  See README instructions for the distinction between known sites and known introns">
+            <option value="none" selected="true">None</option>
+            <option value="gmapdb">From the GMAP Database</option>
+            <option value="history">A Map in your history</option>
+          </param>
+          <when value="none"/>
+          <when value="history">
+            <param name="splicemap" type="data" format="splicesites.iit,introns.iit" metadata_name="dbkey" label="Select a splicesite map" 
+              help="built with GMAP IIT"/>
+          </when>
+          <when value="gmapdb">
+            <param name="splicemap" type="select" data_ref="gmapindex" label="Use map for splicing involving known sites or known introns" help="">
+              <options from_file="gmap_indices.loc">
+                <column name="name" index="4"/>
+                <column name="value" index="4"/>
+                <filter type="param_value" ref="gmapindex" column="6"/>
+                <filter type="multiple_splitter" column="4" separator=","/>
+                <filter type="add_value" name="" value=""/>
+                <filter type="sort_by" column="4"/>
+              </options>
+            </param>
+          </when>
+        </conditional>
+
+        <conditional name="use_snps">
+          <param name="src" type="select" label="Known SNPs" help="for SNP tolerant alignments">
+            <option value="none" selected="true">None</option>
+            <option value="gmapdb">From the GMAP Database</option>
+            <option value="history">A SNP Index in your history</option>
+          </param>
+          <when value="none"/>
+          <when value="history">
+            <param name="snpindex" type="data" format="gmapsnpindex" metadata_name="dbkey" label="Select a snpindex" 
+              help="built with GMAP SNP Index"/>
+          </when>
+          <when value="gmapdb">
+            <param name="snpindex" type="select" data_ref="gmapindex" label="Use database containing known SNPs" help="">
+              <options from_file="gmap_indices.loc">
+                <column name="name" index="5"/>
+                <column name="value" index="5"/>
+                <filter type="param_value" ref="gmapindex" column="6"/>
+                <filter type="multiple_splitter" column="5" separator=","/>
+                <filter type="add_value" name="" value=""/>
+                <filter type="sort_by" column="5"/>
+              </options>
+            </param>
+          </when>
+        </conditional>
+
+      </when>
+      <when value="gmapdb">
+        <param name="gmapdb" type="data" format="gmapdb" metadata_name="dbkey" label="Select a gmapdb" 
+              help="A GMAP database built with GMAP Build"/>
+        <param name="kmer" type="select" data_ref="gmapdb" label="kmer size" help="Defaults to highest available kmer size">
+          <options>
+            <filter type="data_meta" ref="gmapdb" key="kmers" multiple="True" separator=","/>
+          </options>
+        </param>
+
+        <conditional name="use_splicing">
+          <param name="src" type="select" label="Known Splicesite and Introns" 
+                 help="Look for splicing involving known sites or known introns at short or long distances 
+                  See README instructions for the distinction between known sites and known introns">
+            <option value="none" selected="true">None</option>
+            <option value="gmapdb">From the GMAP Database</option>
+            <option value="history">A Map in your history</option>
+          </param>
+          <when value="none"/>
+          <when value="history">
+            <param name="splicemap" type="data" format="splicesites.iit,introns.iit" metadata_name="dbkey" label="Select a splicesite map" 
+              help="built with GMAP IIT"/>
+          </when>
+          <when value="gmapdb">
+            <param name="splicemap" type="select"  data_ref="gmapdb" label="Use map for splicing involving known sites or known introns" help="">
+              <options>
+                <filter type="data_meta" ref="gmapdb" key="maps" multiple="True"/>
+              </options>
+            </param>
+          </when>
+        </conditional>
+
+        <conditional name="use_snps">
+          <param name="src" type="select" label="Known SNPs" help="for SNP tolerant alignments">
+            <option value="none" selected="true">None</option>
+            <option value="gmapdb">From the GMAP Database</option>
+            <option value="history">A SNP Index in your history</option>
+          </param>
+          <when value="none"/>
+          <when value="history">
+            <param name="snpindex" type="data" format="gmapsnpindex" metadata_name="dbkey" label="Select a snpindex" 
+              help="built with GMAP SNP Index"/>
+          </when>
+          <when value="gmapdb">
+            <param name="snpindex" type="select"  data_ref="gmapdb" label="Use database containing known SNPs" help="">
+              <options>
+                <filter type="data_meta" ref="gmapdb" key="snps" multiple="True" separator=","/>
+              </options>
+            </param>
+          </when>
+        </conditional>
+
+      </when>
+    </conditional>
+
     <!-- Computation options -->
     <conditional name="computation">
-      <param name="options" type="select" label="Computational Settings" help="">
+      <param name="options" type="select" label="&lt;HR&gt;Computational Settings" help="">
         <option value="default">Use default settings</option>
         <option value="advanced">Set Computation Options</option>
       </param>
@@ -352,8 +426,7 @@
          </param>
          <param name="trim_mismatch_score" type="integer" value="" optional="true" label="Score to use for mismatches when trimming at ends (default is -3)" 
                 help="to turn off trimming, specify 0"/>
-         <!-- use-snps This should be either a select list from the gmapdb maps or a data type using snpsdir and use-snps --> 
-         <param name="use_snps" type="text" value="" optional="true" label="SNP database Name for SNP tolearnce" help="Use database containing known SNPs (built previously using snpindex) for tolerance to SNPs"/>
+         
          <!-- Options for GMAP alignment within GSNAP -->
           <param name="gmap_mode" type="select" multiple="true" optional="true" label="Cases to use GMAP for complex alignments containing multiple splices or indels" help="">
             <option value="pairsearch">pairsearch</option>
@@ -376,7 +449,7 @@
     </conditional>
 
     <conditional name="splicing">
-      <param name="options" type="select" label="Splicing options for RNA-Seq" help="">
+      <param name="options" type="select" label="&lt;HR&gt;Splicing options for RNA-Seq" help="">
         <option value="default">Use default settings</option>
         <option value="advanced">Set Splicing Options</option>
       </param>
@@ -384,7 +457,7 @@
       <when value="advanced">
          <!-- Splicing options for RNA-Seq -->
          <!-- use-splices This should be either a select list from the gmapdb maps or a data type using splicesdir and use-splices --> 
-         <param name="use_splices" type="text" value="" optional="true" label="Known splicesites or introns" help="Look for splicing involving known sites or known introns at short or long distances See README instructions for the distinction between known sites and known introns"/>
+         <!-- Neither novel splicing (-N) nor known splicing (-s) turned on => assume reads are DNA-Seq (genomic) -->
          <param name="novelsplicing" type="boolean" checked="false" truevalue="--novelsplicing=1" falsevalue="" label="Look for novel splicing "/>
          <param name="localsplicedist"  type="integer" value="" optional="true" label="Definition of local novel splicing event (default 200000)"/>
          <param name="local_splice_penalty"  type="integer" value="" optional="true" label="Penalty for a local splice (default 0).  Counts against mismatches allowed"/>
@@ -398,7 +471,7 @@
 
     <!-- Output data -->
     <conditional name="output">
-      <param name="options" type="select" label="Output options for RNA-Seq" help="">
+      <param name="options" type="select" label="&lt;HR&gt;&lt;H2&gt;Output&lt;/H2&gt;Output options for RNA-Seq" help="">
         <option value="default">Use default settings</option>
         <option value="advanced">Set Output Options</option>
       </param>
@@ -439,7 +512,7 @@
        help="Separate outputs for: nomapping, halfmapping_uniq, halfmapping_mult, unpaired_uniq, unpaired_mult, paired_uniq, paired_mult, concordant_uniq, and concordant_mult results"/> 
   </inputs>
   <outputs>
-    <data format="txt" name="gsnap_stderr" label="${tool.name} on ${on_string}: log"/>
+    <data format="txt" name="gsnap_stderr" label="${tool.name} on ${on_string}: stderr"/>
     <data format="txt" name="results" label="${tool.name} on ${on_string} ${result.format}" >
       <filter>(split_output == False)</filter>
       <change_format>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/gmap/iit_store.xml	Fri Oct 21 11:38:55 2011 -0500
@@ -0,0 +1,188 @@
+<tool id="gmap_iit_store" name="GMAP IIT" version="2.0.0">
+  <description>Create a map store for known genes or SNPs</description>
+  <requirements>
+      <requirement type="binary">iit_store</requirement>
+      <!-- proposed tag for added datatype dependencies -->
+      <requirement type="datatype">gmap_annotation</requirement>
+      <requirement type="datatype">gmap_snps</requirement>
+      <requirement type="datatype">iit</requirement>
+      <requirement type="datatype">splicesites.iit</requirement>
+      <requirement type="datatype">introns.iit</requirement>
+      <requirement type="datatype">snps.iit</requirement>
+  </requirements>
+  <version_string>iit_store --version</version_string>
+  <command interpreter="command"> /bin/bash $shscript 2> $log </command>
+  <inputs>
+    <!-- Input data -->
+    <conditional name="map">
+      <param name="type" type="select" label="Make map for" >
+        <option value="genes">Introns and Splice sites</option>
+        <option value="snps">SNPs</option>
+        <option value="gmap">GMAP Annotation</option>
+      </param>
+      <when value="genes">
+        <conditional name="src">
+          <param name="src_format" type="select" label="Add splice and intron info from" >
+            <option value="refGeneTable">refGenes table from UCSC table browser</option>
+            <option value="gtf">GTF</option>
+            <option value="gff3">GFF3</option>
+          </param>
+          <when value="refGeneTable">
+            <param name="genes" type="data" format="tabular" label="UCSC refGenes table" help="Example: ftp://hgdownload.cse.ucsc.edu/goldenPath/hg18/database/refGene.txt.gz" />
+            <param name="col_skip" type="integer" value="1" label="Columns to skip before the id/name column (default 1)" 
+                   help="Note that alignment tracks in UCSC sometimes have an extra column on the left.">
+              <validator type="in_range" message="The number of colmumns to skip must >= 0." min="0."/>
+            </param>
+          </when>
+          <when value="gtf">
+            <param name="genes" type="data" format="gtf" label="Genes as GTF" help="" />
+          </when>
+          <when value="gff3">
+            <param name="genes" type="data" format="gff3" label="Genes in GFF3 format" help="" />
+          </when>
+        </conditional> 
+        <param name="maps" type="select" display="checkboxes" multiple="true" force_select="true" label="Add splice and intron info from" >
+          <option value="splicesites" selected="true">splicesites.iit</option>
+          <option value="introns" selected="false">introns.iit</option>
+        </param>
+      </when>
+      <when value="snps">
+        <conditional name="src">
+          <param name="src_format" type="select" label="Add SNP info from" >
+            <option value="snpTable">UCSC SNP Table</option>
+            <option value="snpFile">GMAP SNP File</option>
+          </param>
+          <when value="snpTable">
+            <param name="snps" type="data" format="tabular" label="UCSC SNPs table" help="Example: ftp://hgdownload.cse.ucsc.edu/goldenPath/hg18/database/snp130.txt.gz" />
+            <param name="snpsex" type="data" format="tabular" optional="true" label="UCSC SNP Exceptions table" help="Example: ftp://hgdownload.cse.ucsc.edu/goldenPath/hg18/database/snp130Exceptions.txt.gz" />
+            <param name="weight" type="select" label="Include SNPs with at least Confidence Level" help="">
+              <option value="1" selected="true">1 (High)</option>
+              <option value="2">2 (Medium)</option>
+              <option value="3">3 (All)</option>
+            </param>
+          </when>
+          <when value="snpFile">
+            <param name="snps" type="data" format="gmap_snps" optional="true" label="GMAP SNPs file" 
+               help="Format (3 columns):&lt;B&gt;
+                    &lt;br&gt;>rs62211261 21:14379270 CG
+                    &lt;br&gt;>rs62211262 21:14379281 CG
+                    &lt;/B&gt;
+                    &lt;br&gt;Each line must start with a &gt; character, then be followed by an
+                    identifier (which may have duplicates).  Then there should be the
+                    chromosomal coordinate of the SNP.  (Coordinates are all 1-based, so
+                    the first character of a chromosome is number 1.)  Finally, there
+                    should be the two possible alleles: ( AC AG AT CG CT GT or AN CN GN TN)
+                    &lt;br&gt;These alleles must correspond to the possible nucleotides on the plus strand of the genome.  
+                    If the one of these two letters does not match the allele in the reference
+                    sequence, that SNP will be ignored in subsequent processing as a probable error.
+                    The N stands for any other allele." />
+          </when>
+        </conditional> 
+      </when>
+      <when value="gmap">
+        <param name="annotation" type="data" format="gmap_annotation" label="GMAP mapfile" 
+          help="Format (2 or columns): &lt;B&gt;
+                &lt;br&gt;>label coords optional_tag
+                &lt;br&gt;optional_annotation (which may be zero, one, or multiple lines)
+                &lt;/B&gt;
+                &lt;br&gt;Each line must start with a &gt; character, then be followed by an identifier (which may have duplicates).  
+                &lt;br&gt;Then there should be the chromosomal coordinate range.  (Coordinates are all 1-based, so the first character of a chromosome is number 1.)  
+                &lt;br&gt;The coords should be of the form
+                &lt;br&gt; chr:position
+                &lt;br&gt;  chr:startposition..endposition
+                &lt;br&gt;The term chr:position is equivalent to chr:position..position.  
+                &lt;br&gt;If you want to indicate that the interval is on the minus strand or reverse direction, then endposition may be less than startposition.  
+                " />
+      </when>
+    </conditional> 
+  </inputs>
+  <outputs>
+    <data format="txt" name="log" label="${tool.name} on ${on_string}: log"/>
+    <data format="splicesites.iit" name="splicesites_iit" label="${tool.name} on ${on_string} splicesites.iit">
+      <filter>(map['type'] == 'genes' and 'splicesites' in map['maps'])</filter>
+    </data>
+    <data format="introns.iit" name="introns_iit" label="${tool.name} on ${on_string} introns.iit">
+      <filter>(map['type'] == 'genes' and 'introns' in map['maps'])</filter>
+    </data>
+    <data format="snps.iit" name="snps_iit" label="${tool.name} on ${on_string} snps.iit">
+      <filter>(map['type'] == 'snps')</filter>
+    </data>
+    <data format="iit" name="map_iit" label="${tool.name} on ${on_string} map.iit">
+      <filter>(map['type'] == 'gmap')</filter>
+    </data>
+  </outputs>
+  <configfiles>
+    <configfile name="shscript">
+#!/bin/bash
+#set $catcmd = 'gzcat -f'
+#set $catcmd = 'cat'
+#set $ds = chr(36)
+#set $gt = chr(62)
+#set $lt = chr(60)
+#set $ad = chr(38)
+#set $ep = chr(33)
+#set $toerr = ''.join([$gt,$ad,'2'])
+#import os.path
+#if $map.type == 'genes':
+if [ $ep -e $map.src.genes ]; then echo "$map.src.genes does not exist" $toerr; exit 1; fi
+if [ $ep -s $map.src.genes ]; then echo "$map.src.genes is empty" $toerr; exit 2; fi
+ #if $map.src.src_format == 'refGeneTable':
+  #if 'splicesites' in [ $map.maps.__str__ ]:
+   $catcmd $map.src.genes | psl_splicesites -s $map.src.col_skip | iit_store -o  $splicesites_iit
+  #end if
+  #if 'introns' in [ $map.maps.__str__ ]:
+   $catcmd  $map.src.genes | psl_introns -s $map.src.col_skip | iit_store -o  $introns_iit
+  #end if
+ #elif $map.src.src_format == 'gtf':
+  #if 'splicesites' in [ $map.maps.__str__ ]:
+   $catcmd $map.src.genes | gtf_splicesites | iit_store -o  $splicesites_iit
+  #end if
+  #if 'introns' in [ $map.maps.__str__ ]:
+   $catcmd $map.src.genes | gtf_introns | iit_store -o  $introns_iit
+  #end if
+ #elif $map.src.src_format == 'gff3':
+  #if 'splicesites' in [ $map.maps.__str__ ]:
+   $catcmd $map.src.genes | gff3_splicesites | iit_store -o  $splicesites_iit
+  #end if
+  #if 'introns' in [ $map.maps.__str__ ]:
+   $catcmd $map.src.genes | gff3_introns | iit_store -o  $introns_iit
+  #end if
+ #end if
+#elif $map.type == 'snps':
+if [ $ep -s $map.src.snps ]; then echo "$map.src.snps is empty" $toerr; exit 2; fi
+ #if $map.src.snpsex.__str__ != 'None':
+  $catcmd $map.src.snps | dbsnp_iit -w $map.src.weight -e $map.src.snpsex | iit_store -o  $snps_iit
+ #else:
+  $catcmd $map.src.snps | dbsnp_iit -w $map.src.weight | iit_store -o $snps_iit 
+ #end if
+#else:
+  $catcmd $map.src.snps | iit_store -o $map_iit 
+#end if
+    </configfile>
+  </configfiles>
+
+  <tests>
+  </tests> 
+
+  <help>
+
+
+**iit_store**
+
+GMAP IIT creates an Interval Index Tree map of known splice sites, introns, or SNPs (it uses iit_store described in the GMAP documentation).  The maps can be used in GMAP_ (Genomic Mapping and Alignment Program for mRNA and EST sequences) and GSNAP_ (Genomic Short-read Nucleotide Alignment Program).  Maps are typically used for known splice sites, introns, or SNPs.  
+
+You will want to read the README_
+
+Publication_ citation: Thomas D. Wu, Colin K. Watanabe  Bioinformatics 2005 21(9):1859-1875; doi:10.1093/bioinformatics/bti310
+
+.. _GMAP: http://research-pub.gene.com/gmap/
+.. _GSNAP: http://research-pub.gene.com/gmap/
+.. _README: http://research-pub.gene.com/gmap/src/README
+.. _Publication: http://bioinformatics.oxfordjournals.org/cgi/content/full/21/9/1859
+
+
+**inputs**
+
+  </help>
+</tool>
+
--- a/gmap/lib/galaxy/datatypes/gmap.py	Tue Oct 18 11:51:15 2011 -0500
+++ b/gmap/lib/galaxy/datatypes/gmap.py	Fri Oct 21 11:38:55 2011 -0500
@@ -3,7 +3,9 @@
 """
 import logging
 import os,os.path,re
+import data
 from data import Text
+from galaxy import util
 from metadata import MetadataElement
 
 log = logging.getLogger(__name__)
@@ -61,6 +63,7 @@
             return dataset.peek
         except:
             return "GMAP index file"
+
     def sniff( self, filename ):
         return False
     def set_meta( self, dataset, overwrite = True, **kwd ):
@@ -113,57 +116,309 @@
                                 dataset.metadata.atoi = True
                 dataset.metadata.kmers = kmers.keys()
 
-##  class IntervalIndexTree( Text ):
-##      """
-##      A GMAP Interval Index Tree Map
-##      created by iit_store
-##      (/path/to/map)/(mapname).iit
-##      """
-##      MetadataElement( name="map_name", desc="The map name for this index set", default='unknown', set_in_upload=True, readonly=False )
-##      file_ext = 'iit'
-##      is_binary = True
-##      composite_type = 'auto_primary_file'
-##      allow_datatype_change = False
-##  
-##  class IntervalAnnotation(data.Text):
-##      """
-##      Class describing a GMAP Interval format:
-##          >label coords optional_tag
-##          optional_annotation (which may be zero, one, or multiple lines)
-##      The coords should be of the form:
-##          chr:position
-##          chr:startposition..endposition
-##      """
-##      file_ext = 'gmapannotation'
-##  
-##  class SpliceSiteAnnotation(IntervalAnnotation):
-##      file_ext = 'gmapsplicesites'
-##      """
-##      Example:
-##          >NM_004448.ERBB2.exon1 17:35110090..35110091 donor 6678
-##          >NM_004448.ERBB2.exon2 17:35116768..35116769 acceptor 6678
-##          >NM_004448.ERBB2.exon2 17:35116920..35116921 donor 1179
-##          >NM_004448.ERBB2.exon3 17:35118099..35118100 acceptor 1179
-##          >NM_004449.ERG.exon1 21:38955452..38955451 donor 783
-##          >NM_004449.ERG.exon2 21:38878740..38878739 acceptor 783
-##          >NM_004449.ERG.exon2 21:38878638..38878637 donor 360
-##          >NM_004449.ERG.exon3 21:38869542..38869541 acceptor 360
-##      """
-##  
-##  class IntronAnnotation(IntervalAnnotation):
-##      file_ext = 'gmapintrons'
-##      """
-##      Example:
-##          >NM_004448.ERBB2.intron1 17:35110090..35116769
-##          >NM_004448.ERBB2.intron2 17:35116920..35118100
-##          >NM_004449.ERG.intron1 21:38955452..38878739
-##          >NM_004449.ERG.intron2 21:38878638..38869541
-##      """
-##  
-##  class SNPAnnotation(IntervalAnnotation):
-##      file_ext = 'gmapsnps'
-##      """
-##      Example:
-##          >rs62211261 21:14379270 CG
-##          >rs62211262 21:14379281 CG
-##      """
+class GmapSnpIndex( Text ):
+    """
+    A GMAP SNP index created by snpindex
+    """
+    MetadataElement( name="db_name", desc="The db name for this index set", default='unknown', set_in_upload=True, readonly=True )
+    MetadataElement( name="snps_name", default='snps', desc="The name of SNP index", visible=True, no_value='', readonly=True )
+    
+    file_ext = 'gmapsnpindex'
+    is_binary = True
+    composite_type = 'auto_primary_file'
+    allow_datatype_change = False
+
+    def generate_primary_file( self, dataset = None ):
+        """ 
+        This is called only at upload to write the html file
+        cannot rename the datasets here - they come with the default unfortunately
+        """
+        return '<html><head></head><body>AutoGenerated Primary File for Composite Dataset</body></html>'
+    
+    def regenerate_primary_file(self,dataset):
+        """
+        cannot do this until we are setting metadata 
+        """
+        bn = dataset.metadata.db_name
+        log.info( "GmapDB regenerate_primary_file %s" % (bn))
+        rval = ['<html><head><title>GMAPDB %s</title></head><p/><H3>GMAPDB %s</H3><p/>cmet %s<br>atoi %s<H4>Maps:</H4><ul>' % (bn,bn,dataset.metadata.cmet,dataset.metadata.atoi)]
+        for i,name in enumerate(dataset.metadata.maps):
+            rval.append( '<li>%s' % name)
+        rval.append( '</ul></html>' )
+        f = file(dataset.file_name,'w')
+        f.write("\n".join( rval ))
+        f.write('\n')
+        f.close()
+    def set_peek( self, dataset, is_multi_byte=False ):
+        log.info( "GmapSnpIndex set_peek %s" % (dataset))
+        if not dataset.dataset.purged:
+            dataset.peek  = "GMAP SNPindex %s on %s\n" % ( dataset.metadata.snps_name,dataset.metadata.db_name)
+            dataset.blurb = "GMAP SNPindex %s on %s\n" % ( dataset.metadata.snps_name,dataset.metadata.db_name)
+        else:
+            dataset.peek = 'file does not exist'
+            dataset.blurb = 'file purged from disk'
+    def display_peek( self, dataset ):
+        try:
+            return dataset.peek
+        except:
+            return "GMAP SNP index"
+
+    def sniff( self, filename ):
+        return False
+    def set_meta( self, dataset, overwrite = True, **kwd ):
+        """
+        Expecting:
+        extra_files_path/snp_name.iit
+        extra_files_path/db_name/db_name.ref1[2345]1[2345]3offsetscomp.snp_name
+        extra_files_path/db_name/db_name.ref1[2345]1[2345]3positions.snp_name
+        extra_files_path/db_name/db_name.ref1[2345]1[2345]3gammaptrs.snp_name
+        """
+        log.info( "GmapSnpIndex set_meta %s %s" % (dataset,dataset.extra_files_path))
+        pat = '(.*)\.(ref((\d\d)(\d\d))?3positions)\.(.+)?'
+        efp = dataset.extra_files_path
+        flist = os.listdir(efp)
+        for i,fname in enumerate(flist):
+            m = re.match(pat,fname)
+            if m:
+                assert len(m.groups()) == 6
+                dataset.metadata.db_name = m.groups()[0]
+                dataset.metadata.snps_name = m.groups()[-1]
+
+
+
+
+class IntervalIndexTree( Text ):
+    """
+    A GMAP Interval Index Tree Map
+    created by iit_store
+    (/path/to/map)/(mapname).iit
+    """
+    file_ext = 'iit'
+    is_binary = True
+
+class SpliceSitesIntervalIndexTree( IntervalIndexTree ):
+    """
+    A GMAP Interval Index Tree Map 
+    created by iit_store
+    """
+    file_ext = 'splicesites.iit'
+
+class IntronsIntervalIndexTree( IntervalIndexTree ):
+    """
+    A GMAP Interval Index Tree Map
+    created by iit_store
+    """
+    file_ext = 'introns.iit'
+
+class SNPsIntervalIndexTree( IntervalIndexTree ):
+    """
+    A GMAP Interval Index Tree Map
+    created by iit_store
+    """
+    file_ext = 'snps.iit'
+
+class IntervalAnnotation( Text ):
+    """
+    Class describing a GMAP Interval format:
+        >label coords optional_tag
+        optional_annotation (which may be zero, one, or multiple lines)
+    The coords should be of the form:
+        chr:position
+        chr:startposition..endposition
+    """
+    file_ext = 'gmap_annotation'
+    """Add metadata elements"""
+    MetadataElement( name="annotations", default=0, desc="Number of interval annotations", readonly=True, optional=True, visible=False, no_value=0 )
+
+    def set_meta( self, dataset, **kwd ):
+        """
+        Set the number of annotations and the number of data lines in dataset.
+        """
+        data_lines = 0
+        annotations = 0
+        for line in file( dataset.file_name ):
+            line = line.strip()
+            if line and line.startswith( '>' ):
+                annotations += 1
+                data_lines +=1
+            else:
+                data_lines += 1
+        dataset.metadata.data_lines = data_lines
+        dataset.metadata.annotations = annotations
+    def set_peek( self, dataset, is_multi_byte=False ):
+        if not dataset.dataset.purged:
+            dataset.peek = data.get_file_peek( dataset.file_name, is_multi_byte=is_multi_byte )
+            if dataset.metadata.annotations:
+                dataset.blurb = "%s annotations" % util.commaify( str( dataset.metadata.annotations ) )
+            else:
+                dataset.blurb = data.nice_size( dataset.get_size() )
+        else:
+            dataset.peek = 'file does not exist'
+            dataset.blurb = 'file purged from disk'
+
+    def sniff( self, filename ):
+        """
+        Determines whether the file is a gmap annotation file
+        Format: 
+            >label coords optional_tag
+            optional_annotation (which may be zero, one, or multiple lines)
+        For example, the label may be an EST accession, with the coords
+        representing its genomic position.  Labels may be duplicated if
+        necessary.
+        The coords should be of the form
+            chr:position
+            chr:startposition..endposition
+        The term "chr:position" is equivalent to "chr:position..position".  If
+        you want to indicate that the interval is on the minus strand or
+        reverse direction, then <endposition> may be less than <startposition>.
+        """
+        try:
+            pat = '>(\S+)\s((\S+):(\d+)(\.\.(\d+))?(\s.(.+))?$' #>label chr:position[..endposition][ optional_tag] 
+            fh = open( filename )
+            count = 0
+            while True and count < 10:
+                line = fh.readline()
+                if not line:
+                    break #EOF
+                line = line.strip()
+                if line: #first non-empty line
+                    if line.startswith( '>' ):
+                        count += 1
+                        if re.match(pat,line) == None: # Failed to match 
+                            return False
+        finally:
+            fh.close()
+        return False
+
+class SpliceSiteAnnotation(IntervalAnnotation):
+    file_ext = 'gmap_splicesites'
+    """
+    Example:
+        >NM_004448.ERBB2.exon1 17:35110090..35110091 donor 6678
+        >NM_004448.ERBB2.exon2 17:35116768..35116769 acceptor 6678
+        >NM_004448.ERBB2.exon2 17:35116920..35116921 donor 1179
+        >NM_004448.ERBB2.exon3 17:35118099..35118100 acceptor 1179
+        >NM_004449.ERG.exon1 21:38955452..38955451 donor 783
+        >NM_004449.ERG.exon2 21:38878740..38878739 acceptor 783
+        >NM_004449.ERG.exon2 21:38878638..38878637 donor 360
+        >NM_004449.ERG.exon3 21:38869542..38869541 acceptor 360
+    Each line must start with a ">" character, then be followed by an
+    identifier, which may have duplicates and can have any format, with
+    the gene name or exon number shown here only as a suggestion.  Then
+    there should be the chromosomal coordinates which straddle the
+    exon-intron boundary, so one coordinate is on the exon and one is on
+    the intron.  (Coordinates are all 1-based, so the first character of a
+    chromosome is number 1.)  Finally, there should be the splice type:
+    "donor" or "acceptor".  You may optionally store the intron distance
+    at the end.  GSNAP can use this intron distance, if it is longer than
+    its value for --localsplicedist, to look for long introns at that
+    splice site.  The same splice site may have different intron distances
+    in the database; GSNAP will use the longest intron distance reported
+    in searching for long introns.
+    """
+    def sniff( self, filename ): # TODO
+        """
+        Determines whether the file is a gmap splice site annotation file
+        """
+        try:
+            pat = '>(\S+\.intron\d+)\s((\S+):(\d+)\.\.(\d+))\s(donor|acceptor)(\s(\d+))?$' #>label chr:position..position  donor|acceptor[ intron_dist]
+            fh = open( filename )
+            count = 0
+            while True and count < 10:
+                line = fh.readline()
+                if not line:
+                    break #EOF
+                line = line.strip()
+                if line: #first non-empty line
+                    count += 1
+                    if re.match(pat,line) == None: # Failed to match 
+                        return False
+        finally:
+            fh.close()
+        return False
+
+class IntronAnnotation(IntervalAnnotation):
+    file_ext = 'gmap_introns'
+    """
+    Example:
+        >NM_004448.ERBB2.intron1 17:35110090..35116769
+        >NM_004448.ERBB2.intron2 17:35116920..35118100
+        >NM_004449.ERG.intron1 21:38955452..38878739
+        >NM_004449.ERG.intron2 21:38878638..38869541
+     The coordinates are 1-based, and specify the exon coordinates
+     surrounding the intron, with the first coordinate being from the donor
+     exon and the second one being from the acceptor exon.
+    """
+    def sniff( self, filename ): # TODO
+        """
+        Determines whether the file is a gmap Intron annotation file
+        """
+        try:
+            pat = '>(\S+\.intron\d+)\s((\S+):(\d+)\.\.(\d+)(\s(.)+)?$' #>label chr:position
+            fh = open( filename )
+            count = 0
+            while True and count < 10:
+                line = fh.readline()
+                if not line:
+                    break #EOF
+                line = line.strip()
+                if line: #first non-empty line
+                    count += 1
+                    if re.match(pat,line) == None: # Failed to match 
+                        return False
+        finally:
+            fh.close()
+        return False
+
+class SNPAnnotation(IntervalAnnotation):
+    file_ext = 'gmap_snps'
+    """
+    Example:
+        >rs62211261 21:14379270 CG
+        >rs62211262 21:14379281 AT
+        >rs62211263 21:14379298 WN
+    Each line must start with a ">" character, then be followed by an
+    identifier (which may have duplicates).  Then there should be the
+    chromosomal coordinate of the SNP.  (Coordinates are all 1-based, so
+    the first character of a chromosome is number 1.)  Finally, there
+    should be the two possible alleles.  (Previous versions required that
+    these be in alphabetical order: "AC", "AG", "AT", "CG", "CT", or "GT",
+    but that is no longer a requirement.)  These alleles must correspond
+    to the possible nucleotides on the plus strand of the genome.  If the
+    one of these two letters does not match the allele in the reference
+    sequence, that SNP will be ignored in subsequent processing as a
+    probable error.
+    
+    GSNAP also supports the idea of a wildcard SNP.  A wildcard SNP allows
+    all nucleotides to match at that position, not just a given reference
+    and alternate allele.  It is essentially as if an "N" were recorded at
+    that genomic location, although the index files still keep track of
+    the reference allele.  To indicate that a position has a wildcard SNP,
+    you can indicate the genotype as "WN", where "W" is the reference
+    allele.  Another indication of a wildcard SNP is to provide two
+    separate lines at that position with the genotypes "WX" and "WY",
+    where "W" is the reference allele and "X" and "Y" are two different
+    alternate alleles.
+    """
+    def sniff( self, filename ):
+        """
+        Determines whether the file is a gmap SNP annotation file
+        """
+        try:
+            pat = '>(\S+)\s((\S+):(\d+)\s([TACGW][TACGN])$' #>label chr:position ATCG 
+            fh = open( filename )
+            count = 0
+            while True and count < 10:
+                line = fh.readline()
+                if not line:
+                    break #EOF
+                line = line.strip()
+                if line: #first non-empty line
+                    count += 1
+                    if re.match(pat,line) == None: # Failed to match 
+                        return False
+        finally:
+            fh.close()
+        return False
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/gmap/snpindex.xml	Fri Oct 21 11:38:55 2011 -0500
@@ -0,0 +1,141 @@
+<tool id="gmap_snpindex" name="GMAP SNP Index" version="2.0.0">
+  <description>build index files for known SNPs</description>
+  <requirements>
+      <requirement type="binary">snpindex</requirement>
+      <!-- proposed tag for added datatype dependencies -->
+      <requirement type="datatype">gmapsnpindex</requirement>
+      <requirement type="datatype">gmapdb</requirement>
+      <requirement type="datatype">gmap_snps</requirement>
+      <requirement type="datatype">snps.iit</requirement>
+  </requirements>
+  <version_string>snpindex --version</version_string>
+  <command interpreter="command"> /bin/bash $shscript 2>1 1> $output </command>
+  <inputs>
+    <conditional name="refGenomeSource">
+     <param name="genomeSource" type="select" label="Will you map to a reference genome from your history or use a built-in index?" help="Built-ins were indexed using default options">
+        <option value="indexed">Use a built-in index</option>
+        <option value="gmapdb">Use gmapdb from the history</option>
+      </param>
+      <when value="indexed">
+        <param name="gmapindex" type="select" label="Select a reference genome" help="if your genome of interest is not listed - contact Galaxy team">
+          <options from_file="gmap_indices.loc">
+            <column name="uid" index="0" />
+            <column name="dbkey" index="1" />
+            <column name="name" index="2" />
+            <column name="kmers" index="3" />
+            <column name="maps" index="4" />
+            <column name="snps" index="5" />
+            <column name="value" index="6" />
+          </options>
+        </param>
+      </when>
+      <when value="gmapdb">
+        <param name="gmapdb" type="data" format="gmapdb" metadata_name="dbkey" label="Select a gmapdb" 
+              help="A GMAP database built with GMAP Build"/>
+      </when>
+    </conditional>
+    <conditional name="dbsnp">
+      <param name="snp_source" type="select" label="Add SNP info from" >
+        <option value="snpTable">UCSC SNP Table</option>
+        <option value="snpFile">GMAP SNP File</option>
+        <option value="snpIIT">"GMAP SNPs map from GMAP iit store</option>
+      </param>
+      <when value="snpTable">
+        <param name="snps" type="data" format="tabular" label="UCSC SNPs table" help="Example: ftp://hgdownload.cse.ucsc.edu/goldenPath/hg18/database/snp130.txt.gz" />
+        <param name="snpsex" type="data" format="tabular" optional="true" label="UCSC SNP Exceptions table" help="Example: ftp://hgdownload.cse.ucsc.edu/goldenPath/hg18/database/snp130Exceptions.txt.gz" />
+        <param name="weight" type="select" label="Include SNPs with at least Confidence Level" help="">
+          <option value="1" selected="true">1 (High)</option>
+          <option value="2">2 (Medium)</option>
+          <option value="3">3 (All)</option>
+        </param>
+      </when>
+      <when value="snpFile">
+        <param name="snps" type="data" format="gmap_snps" label="GMAP SNPs file" 
+           help="Format (3 columns):
+                &lt;br&gt;>rs62211261 21:14379270 CG
+                &lt;br&gt;>rs62211262 21:14379281 CG
+                &lt;br&gt;Each line must start with a &gt; character, then be followed by an
+                identifier (which may have duplicates).  Then there should be the
+                chromosomal coordinate of the SNP.  (Coordinates are all 1-based, so
+                the first character of a chromosome is number 1.)  Finally, there
+                should be the two possible alleles: ( AC AG AT CG CT GT or AN CN GN TN)
+                &lt;br&gt;These alleles must correspond to the possible nucleotides on the plus strand of the genome.  
+                If the one of these two letters does not match the allele in the reference
+                sequence, that SNP will be ignored in subsequent processing as a probable error.
+                The N stands for any other allele." />
+      </when>
+      <when value="snpIIT">
+        <param name="snpIIT" type="data" format="snps.iit" label="GMAP SNPs map" help="Created by: GMAP iit store" />
+      </when>
+    </conditional> 
+    <param name="snps_name" type="text" value="snps" label="Name for this SNP index" help="no white space characters">
+    </param>
+  </inputs>
+  <outputs>
+    <!--
+    <data format="txt" name="log" label="${tool.name} on ${on_string}: log"/>
+    -->
+    <data format="gmapsnpindex" name="output" label="${tool.name} on ${on_string} snpindex" />
+  </outputs>
+  <configfiles>
+    <configfile name="shscript">
+#!/bin/bash
+#set $ds = chr(36)
+#set $gt = chr(62)
+#set $lt = chr(60)
+#set $ad = chr(38)
+#import os.path
+#if $refGenomeSource.genomeSource == "gmapdb":
+#set $gmapdb = $refGenomeSource.gmapdb.extra_files_path
+#set $refname = $refGenomeSource.gmapdb.metadata.db_name
+#else:
+#set $gmapdb = $os.path.dirname($refGenomeSource.gmapindex.value) 
+$refname = $os.path.basename($refGenomeSource.gmapindex.value)
+#end if
+#set $gmapsnpdir = $output.extra_files_path
+mkdir -p $gmapsnpdir
+#set $snpsname = $snps_name.__str__
+#set $snpsiit = '.'.join([$snpsname,'iit'])
+#set $pathsnps = $os.path.join($gmapsnpdir,$snpsname)
+#set $pathsnpsiit = $os.path.join($gmapsnpdir,$snpsiit)
+#if $dbsnp.snp_source != 'none' and $dbsnp.snps.__str__ != 'None':
+#if $dbsnp.snp_source == 'snpTable':
+#if $dbsnp.snpsex.__str__ != 'None':
+cat $dbsnp.snps | dbsnp_iit -w $dbsnp.weight -e $dbsnp.snpsex | iit_store -o $pathsnps
+#else:
+cat $dbsnp.snps | dbsnp_iit -w $dbsnp.weight | iit_store -o $pathsnps
+#end if
+#elif $dbsnp.snp_source == 'snpFile':
+cat $dbsnp.snps | iit_store -o $pathsnps
+#elif $dbsnp.snp_source == 'snpIIT':
+cat $dbsnp.snps  > $pathsnpsiit
+#end if
+snpindex -D $gmapdb -d $refname -V $output.extra_files_path -v $snpsname $pathsnpsiit
+echo snpindex -D  $gmapdb -d $refname -V $output.extra_files_path -v $snpsname $pathsnpsiit
+#end if
+    </configfile>
+  </configfiles>
+
+  <tests>
+  </tests> 
+
+  <help>
+
+
+**GMAP SNP Index**
+
+GMAP SNP Index (snpindex in the GMAP documentaion) creates an index for known SNPs allowing for SNP tolerant mapping and alignment when using GMAP_ (Genomic Mapping and Alignment Program for mRNA and EST sequences) and GSNAP_ (Genomic Short-read Nucleotide Alignment Program).  
+
+You will want to read the README_
+
+Publication_ citation: Thomas D. Wu, Colin K. Watanabe  Bioinformatics 2005 21(9):1859-1875; doi:10.1093/bioinformatics/bti310
+
+.. _GMAP: http://research-pub.gene.com/gmap/
+.. _GSNAP: http://research-pub.gene.com/gmap/
+.. _README: http://research-pub.gene.com/gmap/src/README
+.. _Publication: http://bioinformatics.oxfordjournals.org/cgi/content/full/21/9/1859
+
+
+  </help>
+</tool>
+