Repository 'gmap'
hg clone https://testtoolshed.g2.bx.psu.edu/repos/jjohnson/gmap

Changeset 0:10e3476429b5 (2012-10-05)
Next changeset 1:74391fc6e3f2 (2012-10-05)
Commit message:
Uploaded
added:
README
gmap.xml
gmap_build.xml
gsnap.xml
iit_store.xml
lib/galaxy/datatypes/gmap.py
snpindex.xml
tool-data/datatypes_conf.xml
tool-data/gmap_indices.loc.sample
tool_dependencies.xml
b
diff -r 000000000000 -r 10e3476429b5 README
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/README Fri Oct 05 13:51:49 2012 -0400
b
@@ -0,0 +1,71 @@
+GMAP applications and citation info are available from:    http://research-pub.gene.com/gmap/
+
+
+    Installation instructions are in the README file in the download, 
+    and online:   http://research-pub.gene.com/gmap/src/README
+
+    These tools were consistent with gmap version: 2011-11-30
+
+
+GMAP and  GSNAP use added datatypes:
+
+   add datatype definition file: lib/galaxy/datatypes/gmap.py
+
+   add the following import line to:  lib/galaxy/datatypes/registry.py
+   import gmap # added for gmap tools
+
+   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="tally.iit" type="galaxy.datatypes.gmap:TallyIntervalIndexTree"  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"/>
+        <datatype extension="gsnap_tally" type="galaxy.datatypes.gmap:TallyAnnotation"  display_in_upload="True"/>
+        <datatype extension="gsnap" type="galaxy.datatypes.gmap:GsnapResult"  display_in_upload="True"/>
+        <!-- End GMAP Datatypes -->
+
+Tools:
+  GMAP_Build - create a GmapDB set of index files for a reference sequence and optional set of annotations
+  GMAP - map sequences to a reference sequence GmapDB index
+  GSNAP - align sequences to a reference and detect splicing 
+
+  Add to  tool_conf.xml     ( probably in the "NGS: Mapping" section )
+   <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
+    CmetIndex - an index created by cmetindex
+    AtoiIndex - an index created by atoiindex
+
+  Add tally creation
+    gsnap default output -> gsnap_tally -> iit_store
+
+  Add goby support
+    Should add separate tools and datatypes for goby 
+    GSNAP goby output relies on goby input, might be better to have a separate gsnap tool for goby
+
+  Possibly add Tools:
+    get_genome - retrieves from a gmapdb
+    cmetindex - create methylcytosine index
+    atoiindex - create  A-to-I RNA editing index
+    
+    
+     
+
+
b
diff -r 000000000000 -r 10e3476429b5 gmap.xml
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/gmap.xml Fri Oct 05 13:51:49 2012 -0400
[
b'@@ -0,0 +1,482 @@\n+<tool id="gmap" name="GMAP" version="2.0.1">\n+  <description>Genomic Mapping and Alignment Program for mRNA and EST sequences</description>\n+  <requirements>\n+    <requirement type="binary">gmap</requirement>\n+  </requirements>\n+  <version_string>gmap --version</version_string>\n+  <command>\n+    #import os,os.path\n+    gmap\n+    --nthreads=4 --ordered\n+    #if $refGenomeSource.genomeSource == "history":\n+      --gseg=$refGenomeSource.ownFile\n+    #elif $refGenomeSource.genomeSource == "gmapdb":\n+      #set $gmapdb = $os.listdir($refGenomeSource.gmapdb.extra_files_path)[0]\n+      --dir=$refGenomeSource.gmapdb.extra_files_path --db=$gmapdb\n+      #if $refGenomeSource.kmer != None and len($refGenomeSource.kmer.__str__) == 2:\n+        --kmer=$refGenomeSource.kmer\n+      #end if\n+    #else:\n+      --dir=$os.path.dirname($refGenomeSource.gmapindex.value) --db=$os.path.basename($refGenomeSource.gmapindex.value)\n+      #if $refGenomeSource.kmer != None and len($refGenomeSource.kmer.__str__) == 2:\n+        --kmer=$refGenomeSource.kmer\n+      #end if\n+    #end if\n+    #if $result.format == "summary":\n+      --summary\n+    #elif $result.format == "align":\n+      --align\n+    #elif $result.format == "continuous":\n+      --continuous\n+    #elif $result.format == "continuous-by-exon":\n+      --continuous-by-exon\n+    #elif $result.format == "compress":\n+      --compress\n+    #elif $result.format == "exons_dna":\n+      --exons=cdna\n+    #elif $result.format == "exons_gen":\n+      --exons=genomic\n+    #elif $result.format == "protein_dna":\n+      --protein_dna\n+    #elif $result.format == "protein_gen":\n+      --protein_gen\n+    #elif $result.format == "sam":\n+      --format=$result.sam_paired_read\n+      $result.no_sam_headers \n+      #* Removed in gmap version 2011-11-30\n+      #if len($result.noncanonical_splices.__str__) > 0\n+         --noncanonical-splices=$result.noncanonical_splices\n+      #end if\n+      *#\n+      #if len($result.read_group_id.__str__) > 0\n+         --read-group-id=$result.read_group_id\n+      #end if\n+      #if len($result.read_group_name.__str__) > 0\n+         --read-group-name=$result.read_group_name\n+      #end if\n+      #if len($result.read_group_library.__str__) > 0\n+         --read-group-library=$result.read_group_library\n+      #end if\n+      #if len($result.read_group_platform.__str__) > 0\n+         --read-group-platform=$result.read_group_platform\n+      #end if\n+    #elif $result.format != "gmap":\n+      --format=$result.format\n+    #end if\n+    #if $computation.options == "advanced":\n+      $computation.nosplicing\n+      $computation.cross_species\n+      #if len($computation.min_intronlength.__str__) > 0\n+        --min-intronlength=$computation.min_intronlength\n+      #end if\n+      #if len($computation.intronlength.__str__) > 0\n+        --intronlength=$computation.intronlength\n+      #end if\n+      #if len($computation.localsplicedist.__str__) > 0\n+        --localsplicedist=$computation.localsplicedist\n+      #end if\n+      #if len($computation.totallength.__str__) > 0\n+        --totallength=$computation.totallength\n+      #end if\n+      #if len($computation.trimendexons.__str__) > 0\n+        --trimendexons=$computation.trimendexons\n+      #end if\n+      --direction=$computation.direction\n+      --canonical-mode=$computation.canonical\n+      --prunelevel=$computation.prunelevel\n+      --allow-close-indels=$computation.allow_close_indels\n+      #if len($computation.microexon_spliceprob.__str__) >= 0:\n+        --microexon-spliceprob=$computation.microexon_spliceprob\n+      #end if\n+      #if len($computation.chimera_margin.__str__) >= 0:\n+        --chimera-margin=$computation.chimera_margin\n+      #end if\n+    #end if\n+    #if $advanced.options == "used":\n+      #if len($advanced.npaths.__str__) > 0:\n+        --npaths=$advanced.npaths\n+      #end if\n+      #if len($advanced.suboptimal_score.__str__) > 0:\n+        --suboptimal-score=$advanced.suboptimal_score\n+      #end if\n+      #if len('..b'="result[\'format\']" value="gff3_match_cdna" format="gff3"/>\n+        <when input="result[\'format\']" value="gff3_match_est" format="gff3"/>\n+        <when input="result[\'format\']" value="sam" format="sam"/>\n+        <when input="result[\'format\']" value="splicesites" format="gmap_splicesites"/>\n+        <when input="result[\'format\']" value="introns" format="gmap_introns"/>\n+        <when input="result[\'format\']" value="map_genes" format="gmap_annotation"/>\n+        <when input="result[\'format\']" value="map_exons" format="gmap_annotation"/>\n+      </change_format>\n+    </data>\n+    <data format="txt" name="nomapping" label="${tool.name} on ${on_string} nomapping.${result.format}"  from_work_dir="gmap_out.nomapping">\n+      <filter>(split_output == True)</filter>\n+      <change_format>\n+        <when input="result[\'format\']" value="gff3_gene" format="gff3"/>\n+        <when input="result[\'format\']" value="gff3_match_cdna" format="gff3"/>\n+        <when input="result[\'format\']" value="gff3_match_est" format="gff3"/>\n+        <when input="result[\'format\']" value="sam" format="sam"/>\n+        <when input="result[\'format\']" value="splicesites" format="gmap_splicesites"/>\n+        <when input="result[\'format\']" value="introns" format="gmap_introns"/>\n+        <when input="result[\'format\']" value="map_genes" format="gmap_annotation"/>\n+        <when input="result[\'format\']" value="map_exons" format="gmap_annotation"/>\n+      </change_format>\n+    </data>\n+    <data format="txt" name="mult" label="${tool.name} on ${on_string} mult.${result.format}"  from_work_dir="gmap_out.mult">\n+      <filter>(split_output == True)</filter>\n+      <change_format>\n+        <when input="result[\'format\']" value="gff3_gene" format="gff3"/>\n+        <when input="result[\'format\']" value="gff3_match_cdna" format="gff3"/>\n+        <when input="result[\'format\']" value="gff3_match_est" format="gff3"/>\n+        <when input="result[\'format\']" value="sam" format="sam"/>\n+        <when input="result[\'format\']" value="splicesites" format="gmap_splicesites"/>\n+        <when input="result[\'format\']" value="introns" format="gmap_introns"/>\n+        <when input="result[\'format\']" value="map_genes" format="gmap_annotation"/>\n+        <when input="result[\'format\']" value="map_exons" format="gmap_annotation"/>\n+      </change_format>\n+    </data>\n+  </outputs>\n+  <tests>\n+  </tests> \n+\n+  <help>\n+\n+**What it does**\n+\n+GMAP_ (Genomic Mapping and Alignment Program)  The functionality provided by gmap allows a user to: (1) map and align a single cDNA interactively against a large genome in about a second, without the startup time of several minutes typically needed by existing mapping programs; (2) switch arbitrarily among different genomes, without the need for a preloaded server dedicated to each genome; (3) run the program on computers with as little as 128 MB of RAM (random access memory); (4) perform high-throughput batch processing of cDNAs by using memory mapping and multithreading when appropriate memory and hardware are available; (5) generate accurate gene models, even in the presence of substantial polymorphisms and sequence errors; (6) locate splice sites accurately without the use of probabilistic splice site models, allowing generalized use of the program across species; (7) detect statistically significant microexons and incorporate them into the alignment; and (8) handle mapping and alignment tasks on genomes having alternate assemblies, linkage groups or strains.  It is developed by Thomas D. Wu of Genentech, Inc.  \n+\n+Publication_ citation: Thomas D. Wu, Colin K. Watanabe  Bioinformatics 2005 21(9):1859-1875; doi:10.1093/bioinformatics/bti310\n+\n+.. _GMAP: http://research-pub.gene.com/gmap/\n+.. _Publication: http://bioinformatics.oxfordjournals.org/cgi/content/full/21/9/1859\n+\n+------\n+\n+**Know what you are doing**\n+\n+.. class:: warningmark\n+\n+You will want to read the README_\n+\n+.. _README: http://research-pub.gene.com/gmap/src/README\n+\n+  </help>\n+</tool>\n+\n'
b
diff -r 000000000000 -r 10e3476429b5 gmap_build.xml
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/gmap_build.xml Fri Oct 05 13:51:49 2012 -0400
b
b'@@ -0,0 +1,174 @@\n+<tool id="gmap_build" name="GMAP Build" version="2.0.0">\n+  <description>a database genome index for GMAP and GSNAP</description>\n+  <requirements>\n+      <requirement type="binary">gmap_build</requirement>\n+  </requirements>\n+  <version_string>gmap --version</version_string>\n+  <command interpreter="command"> /bin/bash $shscript 2>1 1> $output </command>\n+  <inputs>\n+    <!-- Name for this gmapdb -->\n+    <param name="refname" type="text" label="Name you want to give this gmap database" help="">\n+      <validator type="empty_field" message="A database name is required."/>\n+    </param>\n+    <!-- Input data -->\n+    <repeat name="inputs" title="Reference Sequence" min="1">\n+      <param name="input" type="data" format="fasta" label="reference sequence fasta" />\n+    </repeat>\n+\n+    <param name="kmer" type="select" multiple="true" force_select="true" label="kmer size" help="">\n+      <option value="12">12</option>\n+      <option value="13">13</option>\n+      <option value="14">14</option>\n+      <option value="15" selected="true">15</option>\n+    </param>  \n+    <param name="cmetindex" type="boolean" checked="true" truevalue="yes" falsevalue="no" label="Create cmetindex to process reads from bisulfite-treated DNA"/>\n+    <param name="atoiindex" type="boolean" checked="true" truevalue="yes" falsevalue="no" label="Create atoiindex to process reads under RNA-editing tolerance"/>\n+    <conditional name="splicesite">\n+      <param name="splice_source" type="select" label="Add splice and intron info from" >\n+        <option value="none"></option>\n+        <option value="refGeneTable">refGenes table from UCSC table browser</option>\n+        <option value="gtf">GTF</option>\n+        <option value="gff3">GFF3</option>\n+      </param>\n+      <when value="none"/>\n+      <when value="refGeneTable">\n+        <param name="refGenes" type="data" format="tabular" optional="true" label="UCSC refGenes table" help="Example: ftp://hgdownload.cse.ucsc.edu/goldenPath/hg18/database/refGene.txt.gz" />\n+        <param name="col_skip" type="integer" value="1" label="Columns to skip before the id/name column (default 1)" \n+               help="Note that alignment tracks in UCSC sometimes have an extra column on the left.">\n+          <validator type="in_range" message="The number of colmumns to skip must >= 0." min="0."/>\n+        </param>\n+ \n+      </when>\n+      <when value="gtf">\n+        <param name="gtfGenes" type="data" format="gtf" optional="true" label="Genes as GTF" help="" />\n+      </when>\n+      <when value="gff3">\n+        <param name="gff3Genes" type="data" format="gff3" optional="true" label="Genes in GFF3 format" help="" />\n+      </when>\n+    </conditional> \n+    <conditional name="dbsnp">\n+      <param name="snp_source" type="select" label="Add SNP info from" >\n+        <option value="none"></option>\n+        <option value="snpTable">UCSC SNP Table</option>\n+        <option value="snpFile">GMAP SNP File</option>\n+      </param>\n+      <when value="none"/>\n+      <when value="snpTable">\n+        <param name="snps" type="data" format="tabular" optional="true" label="UCSC SNPs table" help="Example: ftp://hgdownload.cse.ucsc.edu/goldenPath/hg18/database/snp130.txt.gz" />\n+        <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" />\n+        <param name="weight" type="select" label="Include SNPs with at least Confidence Level" help="">\n+          <option value="1" selected="true">1 (High)</option>\n+          <option value="2">2 (Medium)</option>\n+          <option value="3">3 (All)</option>\n+        </param>\n+      </when>\n+      <when value="snpFile">\n+        <param name="snps" type="data" format="gmap_snps" optional="true" label="GMAP SNPs file" \n+           help="Format (3 columns):\n+                &lt;br&gt;>rs62211261 21:14379270 CG\n+                &lt;br&gt;>rs62211262 2'..b' to the possible nucleotides on the plus strand of the genome.  \n+                If the one of these two letters does not match the allele in the reference\n+                sequence, that SNP will be ignored in subsequent processing as a probable error.\n+                The N stands for any other allele." />\n+      </when>\n+    </conditional> \n+  </inputs>\n+  <outputs>\n+    <!--\n+    <data format="txt" name="log" label="${tool.name} on ${on_string}: log"/>\n+    -->\n+    <data format="gmapdb" name="output" label="${tool.name} on ${on_string} gmapdb ${refname}" />\n+  </outputs>\n+  <configfiles>\n+    <configfile name="shscript">\n+#!/bin/bash\n+#set $ds = chr(36)\n+#set $gt = chr(62)\n+#set $lt = chr(60)\n+#set $ad = chr(38)\n+## #set $ref_files = \'\'\n+## #for $i in $inputs:\n+  ## #set $ref_files = $ref_files $i.input\n+## #end for\n+## echo $ref_files\n+#import os.path\n+#set $gmapdb = $output.extra_files_path\n+#set $mapsdir = $os.path.join($os.path.join($gmapdb,str($refname)), str($refname) + \'.maps\')\n+mkdir -p $gmapdb\n+## export GMAPDB required for cmetindex  and atoiindex\n+export GMAPDB=$gmapdb\n+#for $k in $kmer.__str__.split(\',\'):\n+gmap_build -D $gmapdb -d $refname -s numeric-alpha -k $k #for i in $inputs# ${i.input}#end for#\n+#end for\n+get-genome -D $gmapdb -d \'?\' | sed \'s/^Available .*/gmap db: /\' \n+echo "kmers: " $kmer \n+#if $splicesite.splice_source == \'refGeneTable\':\n+#if $splicesite.refGenes.__str__ != \'None\':\n+cat $splicesite.refGenes | psl_splicesites -s $splicesite.col_skip | iit_store -o  $os.path.join($mapsdir,\'splicesites\')\n+cat $splicesite.refGenes | psl_introns -s $splicesite.col_skip | iit_store -o  $os.path.join($mapsdir,\'introns\')\n+#end if\n+#elif $splicesite.splice_source == \'gtf\':\n+#if $splicesite.gtfGenes.__str__ != \'None\':\n+cat $splicesite.gtfGenes | gtf_splicesites | iit_store -o  $os.path.join($mapsdir,\'splicesites\')\n+cat $splicesite.gtfGenes | gtf_introns | iit_store -o  $os.path.join($mapsdir,\'introns\')\n+#end if\n+#elif $splicesite.splice_source == \'gff3\':\n+#if $splicesite.gff3Genes.__str__ != \'None\':\n+cat $splicesite.gff3Genes | gff3_splicesites | iit_store -o  $os.path.join($mapsdir,\'splicesites\')\n+cat $splicesite.gff3Genes | gff3_introns | iit_store -o  $os.path.join($mapsdir,\'introns\')\n+#end if\n+#end if\n+#if $dbsnp.snp_source != \'none\' and $dbsnp.snps.__str__ != \'None\':\n+#if $dbsnp.snp_source == \'snpTable\':\n+#if $dbsnp.snpsex.__str__ != \'None\':\n+cat $dbsnp.snps | dbsnp_iit -w $dbsnp.weight -e $dbsnp.snpsex | iit_store -o  $os.path.join($mapsdir,\'snps\')\n+#else:\n+cat $dbsnp.snps | dbsnp_iit -w $dbsnp.weight | iit_store -o  $os.path.join($mapsdir,\'snps\')\n+#end if\n+#else:\n+cat $dbsnp.snps | iit_store -o  $os.path.join($mapsdir,\'snps\')\n+#end if\n+snpindex -d $refname -v snps\n+echo "snpindex" -d  $refname -v snps\n+#end if\n+#if $cmetindex.__str__ == \'yes\':\n+cmetindex -d $refname\n+echo "cmetindex" -d $refname\n+#end if\n+#if $atoiindex.__str__ == \'yes\':\n+atoiindex -d $refname\n+echo "atoiindex" -d $refname\n+#end if\n+get-genome -D $gmapdb -d $refname -m \'?\' | sed \'s/^Available maps .*/maps: /\' \n+    </configfile>\n+  </configfiles>\n+\n+  <tests>\n+  </tests> \n+\n+  <help>\n+\n+\n+**GMAP Build**\n+\n+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.)\n+\n+You will want to read the README_\n+\n+Publication_ citation: Thomas D. Wu, Colin K. Watanabe  Bioinformatics 2005 21(9):1859-1875; doi:10.1093/bioinformatics/bti310\n+\n+.. _GMAP: http://research-pub.gene.com/gmap/\n+.. _GSNAP: http://research-pub.gene.com/gmap/\n+.. _README: http://research-pub.gene.com/gmap/src/README\n+.. _Publication: http://bioinformatics.oxfordjournals.org/cgi/content/full/21/9/1859\n+\n+\n+  </help>\n+</tool>\n+\n'
b
diff -r 000000000000 -r 10e3476429b5 gsnap.xml
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/gsnap.xml Fri Oct 05 13:51:49 2012 -0400
[
b'@@ -0,0 +1,864 @@\n+<tool id="gsnap" name="GSNAP" version="2.0.1">\n+  <description>Genomic Short-read Nucleotide Alignment Program</description>\n+  <requirements>\n+      <requirement type="binary">gsnap</requirement>\n+  </requirements>\n+  <version_string>gsnap --version</version_string>\n+  <command>\n+    #import os.path, re\n+    gsnap\n+    --nthreads="4" --ordered\n+    #if $refGenomeSource.genomeSource == "gmapdb":\n+      #set $gmapdb = $os.listdir($refGenomeSource.gmapdb.extra_files_path)[0]\n+      --dir=$refGenomeSource.gmapdb.extra_files_path --db=$refGenomeSource.gmapdb.metadata.db_name\n+    #else:\n+      --dir=$os.path.dirname($refGenomeSource.gmapindex.value) --db=$os.path.basename($refGenomeSource.gmapindex.value)\n+    #end if\n+    #if $refGenomeSource.kmer != None and len($refGenomeSource.kmer.__str__) == 2:\n+      --kmer=$refGenomeSource.kmer\n+    #end if\n+    #if $refGenomeSource.use_splicing.src == \'gmapdb\':\n+      #if $refGenomeSource.use_splicing.splicemap != None and len($refGenomeSource.use_splicing.splicemap.__str__) > 0:\n+        -s $refGenomeSource.use_splicing.splicemap.value\n+        #if $computation.trim_mismatch_score.__str__ == \'0\':\n+          $ambig_splice_noclip\n+        #end if\n+      #end if\n+    #elif $refGenomeSource.use_splicing.src == \'history\':\n+      #if $refGenomeSource.use_splicing.splicemap != None and len($refGenomeSource.use_splicing.splicemap.__str__) > 0:\n+        -S $os.path.dirname($refGenomeSource.use_splicing.splicemap) -s $os.path.basename($refGenomeSource.use_splicing.splicemap)\n+        #if $computation.trim_mismatch_score.__str__ == \'0\':\n+          $ambig_splice_noclip\n+        #end if\n+      #end if\n+    #end if\n+    #if $refGenomeSource.use_snps.src == \'gmapdb\':\n+       #if $refGenomeSource.use_snps.snpindex != None and len($refGenomeSource.use_snps.snpindex.__str__) > 0:\n+        -v $refGenomeSource.use_snps.snpindex.value\n+       #end if\n+    #elif $refGenomeSource.use_snps.src == \'history\':\n+       #if $refGenomeSource.use_snps.snpindex != None and len($refGenomeSource.use_snps.snpindex.__str__) > 0:\n+         -V $refGenomeSource.use_snps.snpindex.extra_files_path -v $refGenomeSource.use_snps.snpindex.metadata.snps_name\n+       #end if\n+    #end if\n+    #if $refGenomeSource.mode.__str__ != \'\':\n+      --mode=$refGenomeSource.mode\n+    #end if\n+    #* ## No longer in options as of version 2011-11-30\n+    #if $mapq_unique_score.__str__ != \'\':\n+      --mapq-unique-score=$mapq_unique_score\n+    #end if\n+    *#\n+    #if $computation.options == "advanced":\n+      #if $computation.max_mismatches.__str__ != \'\':\n+        --max-mismatches=$computation.max_mismatches\n+      #end if\n+      $computation.query_unk_mismatch\n+      $computation.genome_unk_mismatch\n+      #if $computation.terminal_threshold.__str__ != \'\':\n+        --terminal-threshold=$computation.terminal_threshold\n+      #end if\n+      #if $computation.indel_penalty.__str__ != \'\':\n+        --indel-penalty=$computation.indel_penalty\n+      #end if\n+      #if $computation.indel_endlength.__str__ != \'\':\n+        --indel-endlength=$computation.indel_endlength\n+      #end if\n+      #if $computation.max_middle_insertions.__str__ != \'\':\n+        --max-middle-insertions=$computation.max_middle_insertions\n+      #end if\n+      #if $computation.max_middle_deletions.__str__ != \'\':\n+        --max-middle-deletions=$computation.max_middle_deletions\n+      #end if\n+      #if $computation.max_end_insertions.__str__ != \'\':\n+        --max-end-insertions=$computation.max_end_insertions\n+      #end if\n+      #if $computation.max_end_deletions.__str__ != \'\':\n+        --max-end-deletions=$computation.max_end_deletions\n+      #end if\n+      #if $computation.suboptimal_levels.__str__ != \'\':\n+        --suboptimal-levels=$computation.suboptimal_levels\n+      #end if\n+      #if $computation.adapter_strip.__str__ != \'\':\n+        --adapter-strip=$computation.adapter_strip\n+      #end if\n+      #if $computation.trim_mismatch_score.__str__ != \'\':\n+      '..b'value="sam" format="sam"/>\n+        <when input="result[\'format\']" value="gsnap" format="gsnap"/>\n+      </change_format>\n+    </data>\n+\n+    <data format="fastq" name="nomapping_fq" label="${tool.name} on ${on_string} nomapping.fq"  from_work_dir="gsnap_out.nomapping.fq">\n+      <filter>(results[\'split_output\'] == \'yes\' and seq[\'format\'] == \'fastq\' and seq[\'paired\'][\'ispaired\'] == False)</filter>\n+    </data>\n+\n+    <data format="fastq" name="nomapping_1_fq" label="${tool.name} on ${on_string} nomapping.1.fq"  from_work_dir="gsnap_out.nomapping.1.fq">\n+      <filter>(results[\'split_output\'] == \'yes\' and seq[\'format\'] == \'fastq\' and seq[\'paired\'][\'ispaired\'] == True)</filter>\n+    </data>\n+\n+    <data format="fastq" name="nomapping_2_fq" label="${tool.name} on ${on_string} nomapping.2.fq"  from_work_dir="gsnap_out.nomapping.2.fq">\n+      <filter>(results[\'split_output\'] == \'yes\' and seq[\'format\'] == \'fastq\' and seq[\'paired\'][\'ispaired\'] == True)</filter>\n+    </data>\n+\n+    <!-- Will problay need wrapper code to generate composite datatype for goby alignment\n+    <data format="gobyalignment" name="goby_alignment" label="${tool.name} on ${on_string} uniq.${result.format}"  from_work_dir="gsnap_out.nomapping">\n+      <filter>result[\'format\'] == \'goby\'</filter>\n+    </data>\n+    -->\n+\n+  </outputs>\n+  <tests>\n+  </tests> \n+\n+  <help>\n+\n+**What it does**\n+\n+GSNAP_ (Genomic Short-read Nucleotide Alignment Program) is a short read aligner which can align both single- and paired-end reads as short as 14nt and of arbitrarily long length. It can detect short- and long-distance splicing, including interchromosomal splicing, in individual reads, using probabilistic models or a database of known splice sites. Our program also permits SNP-tolerant alignment to a reference space of all possible combinations of major and minor alleles, and can align reads from bisulfite-treated DNA for the study of methylation state. It is developed by Thomas D. Wu of Genentech, Inc.  \n+Publication_ citation: Thomas D. Wu, Serban Nacu "Fast and SNP-tolerant detection of complex variants and splicing in short reads. Bioinformatics. 2010 Apr 1;26(7):873-81. Epub 2010 Feb 10.\n+\n+.. _GSNAP: http://research-pub.gene.com/gmap/\n+.. _Publication: http://bioinformatics.oupjournals.org/cgi/content/full/26/7/873\n+http://www.ncbi.nlm.nih.gov/pmc/articles/PMC2844994/?tool=pubmed\n+\n+------\n+\n+**Know what you are doing**\n+\n+.. class:: warningmark\n+\n+You will want to read the README_\n+\n+.. _README: http://research-pub.gene.com/gmap/src/README\n+\n+------\n+\n+**Input formats**\n+\n+Input to GSNAP should be either in FASTQ or FASTA format.  \n+\n+The FASTQ input may include quality scores, which will then be included in SAM\n+output, if that output format is selected. \n+\n+For FASTA format, you should include one line per read (or end of a\n+paired-end read).  The same FASTA file can have a mixture of\n+single-end and paired-end reads of varying lengths, if desired.\n+\n+Single-end reads:\n+\n+Each FASTA entry should contain one short read per line, like this\n+\n+>Header information\n+AAAACATTCTCCTCCGCATAAGCCTGCGTCAGATTA\n+\n+Each short read can have a different length.  However, the entire read\n+needs to be on a single line, and may not wrap around multiple lines.\n+If it extends to a second line, GSNAP will think that the read is\n+paired-end.\n+\n+\n+Paired-end reads:\n+\n+Each FASTA entry should contain two short reads, one per line, like\n+this\n+\n+>Header information\n+AAAACATTCTCCTCCGCATAAGCCTAGTAGATTA\n+GGCGTAGGTAGAAGTAGAGGTTAAGGCGCGTCAG\n+\n+By default, the program assumes that the second end is in the reverse\n+complement direction compared with the first end.  If they are in the\n+same direction, you may need to use the --circular-input (or -c) flag.\n+\n+( The Galaxy tool: "FASTA Width formatter"  can be used to reformat fasta files to have single line sequences. )\n+\n+------\n+\n+**Output formats in GSNAP**\n+\n+SAM output format\n+\n+Default GSNAP format\n+  See the README_\n+\n+\n+\n+\n+  </help>\n+</tool>\n+\n'
b
diff -r 000000000000 -r 10e3476429b5 iit_store.xml
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/iit_store.xml Fri Oct 05 13:51:49 2012 -0400
[
b'@@ -0,0 +1,181 @@\n+<tool id="gmap_iit_store" name="GMAP IIT" version="2.0.0">\n+  <description>Create a map store for known genes or SNPs</description>\n+  <requirements>\n+      <requirement type="binary">iit_store</requirement>\n+  </requirements>\n+  <version_string>iit_store --version</version_string>\n+  <command interpreter="command"> /bin/bash $shscript 2> $log </command>\n+  <inputs>\n+    <!-- Input data -->\n+    <conditional name="map">\n+      <param name="type" type="select" label="Make map for" >\n+        <option value="genes">Introns and Splice sites</option>\n+        <option value="snps">SNPs</option>\n+        <option value="gmap">GMAP Annotation</option>\n+      </param>\n+      <when value="genes">\n+        <conditional name="src">\n+          <param name="src_format" type="select" label="Add splice and intron info from" >\n+            <option value="refGeneTable">refGenes table from UCSC table browser</option>\n+            <option value="gtf">GTF</option>\n+            <option value="gff3">GFF3</option>\n+          </param>\n+          <when value="refGeneTable">\n+            <param name="genes" type="data" format="tabular" label="UCSC refGenes table" help="Example: ftp://hgdownload.cse.ucsc.edu/goldenPath/hg18/database/refGene.txt.gz" />\n+            <param name="col_skip" type="integer" value="1" label="Columns to skip before the id/name column (default 1)" \n+                   help="Note that alignment tracks in UCSC sometimes have an extra column on the left.">\n+              <validator type="in_range" message="The number of colmumns to skip must >= 0." min="0."/>\n+            </param>\n+          </when>\n+          <when value="gtf">\n+            <param name="genes" type="data" format="gtf" label="Genes as GTF" help="" />\n+          </when>\n+          <when value="gff3">\n+            <param name="genes" type="data" format="gff3" label="Genes in GFF3 format" help="" />\n+          </when>\n+        </conditional> \n+        <param name="maps" type="select" display="checkboxes" multiple="true" force_select="true" label="Add splice and intron info from" >\n+          <option value="splicesites" selected="true">splicesites.iit</option>\n+          <option value="introns" selected="false">introns.iit</option>\n+        </param>\n+      </when>\n+      <when value="snps">\n+        <conditional name="src">\n+          <param name="src_format" type="select" label="Add SNP info from" >\n+            <option value="snpTable">UCSC SNP Table</option>\n+            <option value="snpFile">GMAP SNP File</option>\n+          </param>\n+          <when value="snpTable">\n+            <param name="snps" type="data" format="tabular" label="UCSC SNPs table" help="Example: ftp://hgdownload.cse.ucsc.edu/goldenPath/hg18/database/snp130.txt.gz" />\n+            <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" />\n+            <param name="weight" type="select" label="Include SNPs with at least Confidence Level" help="">\n+              <option value="1" selected="true">1 (High)</option>\n+              <option value="2">2 (Medium)</option>\n+              <option value="3">3 (All)</option>\n+            </param>\n+          </when>\n+          <when value="snpFile">\n+            <param name="snps" type="data" format="gmap_snps" optional="true" label="GMAP SNPs file" \n+               help="Format (3 columns):&lt;B&gt;\n+                    &lt;br&gt;>rs62211261 21:14379270 CG\n+                    &lt;br&gt;>rs62211262 21:14379281 CG\n+                    &lt;/B&gt;\n+                    &lt;br&gt;Each line must start with a &gt; character, then be followed by an\n+                    identifier (which may have duplicates).  Then there should be the\n+                    chromosomal coordinate of the SNP.  (Coordinates are all 1-based, so\n+                    the first character of a chromosome is number 1.)  Finally, there\n+ '..b'+                &lt;br&gt; chr:position\n+                &lt;br&gt;  chr:startposition..endposition\n+                &lt;br&gt;The term chr:position is equivalent to chr:position..position.  \n+                &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.  \n+                " />\n+      </when>\n+    </conditional> \n+  </inputs>\n+  <outputs>\n+    <data format="txt" name="log" label="${tool.name} on ${on_string}: log"/>\n+    <data format="splicesites.iit" name="splicesites_iit" label="${tool.name} on ${on_string} splicesites.iit">\n+      <filter>(map[\'type\'] == \'genes\' and \'splicesites\' in map[\'maps\'])</filter>\n+    </data>\n+    <data format="introns.iit" name="introns_iit" label="${tool.name} on ${on_string} introns.iit">\n+      <filter>(map[\'type\'] == \'genes\' and \'introns\' in map[\'maps\'])</filter>\n+    </data>\n+    <data format="snps.iit" name="snps_iit" label="${tool.name} on ${on_string} snps.iit">\n+      <filter>(map[\'type\'] == \'snps\')</filter>\n+    </data>\n+    <data format="iit" name="map_iit" label="${tool.name} on ${on_string} map.iit">\n+      <filter>(map[\'type\'] == \'gmap\')</filter>\n+    </data>\n+  </outputs>\n+  <configfiles>\n+    <configfile name="shscript">\n+#!/bin/bash\n+#set $catcmd = \'gzcat -f\'\n+#set $catcmd = \'cat\'\n+#set $ds = chr(36)\n+#set $gt = chr(62)\n+#set $lt = chr(60)\n+#set $ad = chr(38)\n+#set $ep = chr(33)\n+#set $toerr = \'\'.join([$gt,$ad,\'2\'])\n+#import os.path\n+#if $map.type == \'genes\':\n+if [ $ep -e $map.src.genes ]; then echo "$map.src.genes does not exist" $toerr; exit 1; fi\n+if [ $ep -s $map.src.genes ]; then echo "$map.src.genes is empty" $toerr; exit 2; fi\n+ #if $map.src.src_format == \'refGeneTable\':\n+  #if \'splicesites\' in [ $map.maps.__str__ ]:\n+   $catcmd $map.src.genes | psl_splicesites -s $map.src.col_skip | iit_store -o  $splicesites_iit\n+  #end if\n+  #if \'introns\' in [ $map.maps.__str__ ]:\n+   $catcmd  $map.src.genes | psl_introns -s $map.src.col_skip | iit_store -o  $introns_iit\n+  #end if\n+ #elif $map.src.src_format == \'gtf\':\n+  #if \'splicesites\' in [ $map.maps.__str__ ]:\n+   $catcmd $map.src.genes | gtf_splicesites | iit_store -o  $splicesites_iit\n+  #end if\n+  #if \'introns\' in [ $map.maps.__str__ ]:\n+   $catcmd $map.src.genes | gtf_introns | iit_store -o  $introns_iit\n+  #end if\n+ #elif $map.src.src_format == \'gff3\':\n+  #if \'splicesites\' in [ $map.maps.__str__ ]:\n+   $catcmd $map.src.genes | gff3_splicesites | iit_store -o  $splicesites_iit\n+  #end if\n+  #if \'introns\' in [ $map.maps.__str__ ]:\n+   $catcmd $map.src.genes | gff3_introns | iit_store -o  $introns_iit\n+  #end if\n+ #end if\n+#elif $map.type == \'snps\':\n+if [ $ep -s $map.src.snps ]; then echo "$map.src.snps is empty" $toerr; exit 2; fi\n+ #if $map.src.snpsex.__str__ != \'None\':\n+  $catcmd $map.src.snps | dbsnp_iit -w $map.src.weight -e $map.src.snpsex | iit_store -o  $snps_iit\n+ #else:\n+  $catcmd $map.src.snps | dbsnp_iit -w $map.src.weight | iit_store -o $snps_iit \n+ #end if\n+#else:\n+  $catcmd $map.src.snps | iit_store -o $map_iit \n+#end if\n+    </configfile>\n+  </configfiles>\n+\n+  <tests>\n+  </tests> \n+\n+  <help>\n+\n+\n+**iit_store**\n+\n+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.  \n+\n+You will want to read the README_\n+\n+Publication_ citation: Thomas D. Wu, Colin K. Watanabe  Bioinformatics 2005 21(9):1859-1875; doi:10.1093/bioinformatics/bti310\n+\n+.. _GMAP: http://research-pub.gene.com/gmap/\n+.. _GSNAP: http://research-pub.gene.com/gmap/\n+.. _README: http://research-pub.gene.com/gmap/src/README\n+.. _Publication: http://bioinformatics.oxfordjournals.org/cgi/content/full/21/9/1859\n+\n+\n+**inputs**\n+\n+  </help>\n+</tool>\n+\n'
b
diff -r 000000000000 -r 10e3476429b5 lib/galaxy/datatypes/gmap.py
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/lib/galaxy/datatypes/gmap.py Fri Oct 05 13:51:49 2012 -0400
[
b'@@ -0,0 +1,472 @@\n+"""\n+GMAP indexes\n+"""\n+import logging\n+import os,os.path,re\n+import galaxy.datatypes.data\n+from galaxy.datatypes.data import Text\n+from galaxy import util\n+from galaxy.datatypes.metadata import MetadataElement\n+\n+log = logging.getLogger(__name__)\n+\n+class GmapDB( Text ):\n+    """\n+    A GMAP DB for indexes\n+    """\n+    MetadataElement( name="db_name", desc="The db name for this index set", default=\'unknown\', set_in_upload=True, readonly=True )\n+    MetadataElement( name="basesize", default="12", desc="The basesize for offsetscomp", visible=True, readonly=True )\n+    MetadataElement( name="kmers", default=[\'\'], desc="The kmer sizes for indexes", visible=True, no_value=[\'\'], readonly=True )\n+    MetadataElement( name="map_dir", desc="The maps directory", default=\'unknown\', set_in_upload=True, readonly=True )\n+    MetadataElement( name="maps", default=[\'\'], desc="The names of maps stored for this gmap gmapdb", visible=True, no_value=[\'\'], readonly=True )\n+    MetadataElement( name="snps", default=[\'\'], desc="The names of SNP indexes stored for this gmapdb", visible=True, no_value=[\'\'], readonly=True )\n+    MetadataElement( name="cmet", default=False, desc="Has a cmet index", visible=True, readonly=True )\n+    MetadataElement( name="atoi", default=False, desc="Has a atoi index", visible=True, readonly=True )\n+    \n+    file_ext = \'gmapdb\'\n+    is_binary = True\n+    composite_type = \'auto_primary_file\'\n+    allow_datatype_change = False\n+\n+    def generate_primary_file( self, dataset = None ):\n+        """ \n+        This is called only at upload to write the html file\n+        cannot rename the datasets here - they come with the default unfortunately\n+        """\n+        return \'<html><head></head><body>AutoGenerated Primary File for Composite Dataset</body></html>\'\n+    \n+    def regenerate_primary_file(self,dataset):\n+        """\n+        cannot do this until we are setting metadata \n+        """\n+        bn = dataset.metadata.db_name\n+        log.info( "GmapDB regenerate_primary_file %s" % (bn))\n+        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)]\n+        for i,name in enumerate(dataset.metadata.maps):\n+            rval.append( \'<li>%s\' % name)\n+        rval.append( \'</ul></html>\' )\n+        f = file(dataset.file_name,\'w\')\n+        f.write("\\n".join( rval ))\n+        f.write(\'\\n\')\n+        f.close()\n+\n+    def set_peek( self, dataset, is_multi_byte=False ):\n+        log.info( "GmapDB set_peek %s" % (dataset))\n+        if not dataset.dataset.purged:\n+            dataset.peek  = "GMAPDB index %s\\n cmet %s\\n atoi %s\\n maps %s" % ( dataset.metadata.db_name,dataset.metadata.cmet,dataset.metadata.atoi,dataset.metadata.maps )\n+            dataset.blurb = "GMAPDB %s" % ( dataset.metadata.db_name )\n+        else:\n+            dataset.peek = \'file does not exist\'\n+            dataset.blurb = \'file purged from disk\'\n+    def display_peek( self, dataset ):\n+        try:\n+            return dataset.peek\n+        except:\n+            return "GMAP index file"\n+\n+    def sniff( self, filename ):\n+        return False\n+    def set_meta( self, dataset, overwrite = True, **kwd ):\n+        """\n+        Expecting:\n+        extra_files_path/<db_name>/db_name>.ref<basesize><kmer>3<index>\n+        extra_files_path/db_name/db_name.ref1[2345]1[2345]3offsetscomp\n+        extra_files_path/db_name/db_name.ref1[2345]1[2345]3positions\n+        extra_files_path/db_name/db_name.ref1[2345]1[2345]3gammaptrs\n+        index maps: \n+        extra_files_path/db_name/db_name.maps/*.iit\n+        """\n+        log.info( "GmapDB set_meta %s %s" % (dataset,dataset.extra_files_path))\n+        pat = \'(.*)\\.((ref)|(met)[atgc][atgc]|(a2i)[atgc][atgc])((\\d\\d)(\\d\\d))?3positions(\\.(.+))?\'\n+        efp = dataset.extra_files_path\n+        flist = os.listdir(efp)\n+        for i,fname in enumerate(flist):\n+            log.info( "GmapDB'..b' == None: # Failed to match \n+                        return False\n+        finally:\n+            fh.close()\n+        return False\n+\n+class SNPAnnotation(IntervalAnnotation):\n+    file_ext = \'gmap_snps\'\n+    """\n+    Example:\n+        >rs62211261 21:14379270 CG\n+        >rs62211262 21:14379281 AT\n+        >rs62211263 21:14379298 WN\n+    Each line must start with a ">" character, then be followed by an\n+    identifier (which may have duplicates).  Then there should be the\n+    chromosomal coordinate of the SNP.  (Coordinates are all 1-based, so\n+    the first character of a chromosome is number 1.)  Finally, there\n+    should be the two possible alleles.  (Previous versions required that\n+    these be in alphabetical order: "AC", "AG", "AT", "CG", "CT", or "GT",\n+    but that is no longer a requirement.)  These alleles must correspond\n+    to the possible nucleotides on the plus strand of the genome.  If the\n+    one of these two letters does not match the allele in the reference\n+    sequence, that SNP will be ignored in subsequent processing as a\n+    probable error.\n+    \n+    GSNAP also supports the idea of a wildcard SNP.  A wildcard SNP allows\n+    all nucleotides to match at that position, not just a given reference\n+    and alternate allele.  It is essentially as if an "N" were recorded at\n+    that genomic location, although the index files still keep track of\n+    the reference allele.  To indicate that a position has a wildcard SNP,\n+    you can indicate the genotype as "WN", where "W" is the reference\n+    allele.  Another indication of a wildcard SNP is to provide two\n+    separate lines at that position with the genotypes "WX" and "WY",\n+    where "W" is the reference allele and "X" and "Y" are two different\n+    alternate alleles.\n+    """\n+    def sniff( self, filename ):\n+        """\n+        Determines whether the file is a gmap SNP annotation file\n+        """\n+        try:\n+            pat = \'>(\\S+)\\s((\\S+):(\\d+)\\s([TACGW][TACGN])$\' #>label chr:position ATCG \n+            fh = open( filename )\n+            count = 0\n+            while True and count < 10:\n+                line = fh.readline()\n+                if not line:\n+                    break #EOF\n+                line = line.strip()\n+                if line: #first non-empty line\n+                    count += 1\n+                    if re.match(pat,line) == None: # Failed to match \n+                        return False\n+        finally:\n+            fh.close()\n+        return False\n+\n+\n+class TallyAnnotation(IntervalAnnotation):\n+    file_ext = \'gsnap_tally\'\n+    """\n+    Output produced by gsnap_tally\n+    Example:\n+        >144 chr20:57268791..57268935\n+        G0\n+        A1(1@7|1Q-3)\n+        A2(1@36,1@1|1Q2,1Q-8)\n+        C2      0.889,0.912,0.889,0.889,0.933,0.912,0.912,0.889,0.889,0.889     -2.66,-2.89,-2.66,-2.66,-3.16,-2.89,-2.89,-2.66,-2.66,-2.66\n+        C1 T1   0.888,0.9,0.888,0.9,0.913,0.9,0.911,0.888,0.9,0.913     -2.66,-2.78,-2.66,-2.78,-2.91,-2.78,-2.89,-2.66,-2.78,-2.91\n+    """\n+    def sniff( self, filename ): # TODO\n+        """\n+        Determines whether the file is a gmap splice site annotation file\n+        """\n+        try:\n+            pat = \'^>(\\d+)\\s((\\S+):(\\d+)\\.\\.(\\d+))$\' #>total chr:position..position\n+            pat2 = \'^[GATCN]\\d.*$\' #BaseCountDeatails\n+            fh = open( filename )\n+            count = 0\n+            while True and count < 10:\n+                line = fh.readline()\n+                if not line:\n+                    break #EOF\n+                line = line.strip()\n+                if line: #first non-empty line\n+                    count += 1\n+                    if re.match(pat,line) == None and re.match(pat2,line) == None: # Failed to match \n+                        return False\n+        finally:\n+            fh.close()\n+        return False\n+\n+class GsnapResult( Text ):\n+    """\n+    The default output format for gsnap.   Can be used as input for gsnap_tally.\n+    """\n+    file_ext = \'gsnap\'\n+\n+\n'
b
diff -r 000000000000 -r 10e3476429b5 snpindex.xml
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/snpindex.xml Fri Oct 05 13:51:49 2012 -0400
[
@@ -0,0 +1,136 @@
+<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>
+  </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>
+
b
diff -r 000000000000 -r 10e3476429b5 tool-data/datatypes_conf.xml
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/tool-data/datatypes_conf.xml Fri Oct 05 13:51:49 2012 -0400
b
@@ -0,0 +1,24 @@
+<?xml version="1.0"?>
+<datatypes>
+    <datatype_files>
+        <datatype_file name="gmap.py"/>
+    </datatype_files>
+    <registration>
+        <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"/>
+    </registration>
+    <sniffers>
+        <sniffer type="galaxy.datatypes.gmap:IntervalAnnotation"/>
+        <sniffer type="galaxy.datatypes.gmap:SpliceSiteAnnotation"/>
+        <sniffer type="galaxy.datatypes.gmap:IntronAnnotation"/>
+        <sniffer type="galaxy.datatypes.gmap:SNPAnnotation"/>
+    </sniffers>
+</datatypes>
b
diff -r 000000000000 -r 10e3476429b5 tool-data/gmap_indices.loc.sample
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/tool-data/gmap_indices.loc.sample Fri Oct 05 13:51:49 2012 -0400
b
@@ -0,0 +1,10 @@
+#This is a sample file distributed with Galaxy that enables tools
+#to use a directory of GMAPDB indexed sequences data files.  You will need
+#to create these data files using gmap_build and then create a gmap_indices.loc file 
+#similar to this one (store it in this directory) that points to 
+#the directories in which those files are stored. The gmap_indices.loc 
+#file has this format (white space characters are TAB characters):
+#
+#<unique_build_id>   <dbkey>   <display_name>   <kmers> <map,map>       <snp,snp>       <file_base_path>
+#hg18   hg18    hg18 (cmet atoi)        12,13,14,15     splicesites,introns     snps    /depot/data2/galaxy/gmap/hg18
+#hg19 hg19 hg19 (cmet atoi) 12,13,14,15 splicesites,introns,snps snps,dbsnp /depot/data2/galaxy/gmap/hg19
b
diff -r 000000000000 -r 10e3476429b5 tool_dependencies.xml
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/tool_dependencies.xml Fri Oct 05 13:51:49 2012 -0400
b
@@ -0,0 +1,21 @@
+<?xml version="1.0"?>
+<tool_dependency>
+    <package name="gmap" version="2011-11-30">
+        <install version="1.0">
+            <actions>
+                <action type="shell_command">wget http://research-pub.gene.com/gmap/src/gmap-gsnap-2011-11-30.tar.gz</action>
+                <action type="shell_command"> ./configure --prefix=bin --with-gmapdb=../gmapdb</action>
+                <action type="shell_command">make</action>
+                <action type="move_directory_files">
+                    <source_directory>bin</source_directory>
+                    <destination_directory>$INSTALL_DIR/bin</destination_directory>
+                </action>
+                <action type="set_environment">
+                    <environment_variable name="PATH" action="prepend_to">$INSTALL_DIR/bin</environment_variable>
+                </action>
+            </actions>
+        </install>
+        <readme>
+        </readme>
+    </package>
+</tool_dependency>