Repository 'tmap_wrapper'
hg clone https://toolshed.g2.bx.psu.edu/repos/nilshomer/tmap_wrapper

Changeset 0:7cbfd271d207 (2011-06-07)
Next changeset 1:40ade4f81a30 (2011-09-23)
Commit message:
Migrated tool version 0.0.19 from old tool shed archive to new tool shed repository
added:
tmap_wrapper_0.0.19/tmap_index.loc.sample
tmap_wrapper_0.0.19/tmap_wrapper.py
tmap_wrapper_0.0.19/tmap_wrapper.xml
b
diff -r 000000000000 -r 7cbfd271d207 tmap_wrapper_0.0.19/tmap_index.loc.sample
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/tmap_wrapper_0.0.19/tmap_index.loc.sample Tue Jun 07 17:28:45 2011 -0400
b
@@ -0,0 +1,42 @@
+#This is a sample file distributed with Galaxy that enables tools
+#to use a directory of TMAP indexed sequences data files. You will need
+#to create these data files and then create a tmap_index.loc file
+#similar to this one (store it in this directory) that points to
+#the directories in which those files are stored. The tmap_index.loc
+#file has this format (longer white space characters are TAB characters):
+#
+#<unique_build_id>   <dbkey>   <display_name>   <file_path>
+#
+#So, for example, if you had phiX indexed stored in 
+#/depot/data2/galaxy/phiX/base/, 
+#then the tmap_index.loc entry would look like this:
+#
+#phiX174   phiX   phiX Pretty   /depot/data2/galaxy/phiX/base/phiX.fa
+#
+#and your /depot/data2/galaxy/phiX/base/ directory
+#would contain phiX.fa.* files:
+#
+#-rw-r--r--  1 nilshomer  staff    68B Jan 27 15:53 /data/mapping/genomes/DH10B/DH10B.fa.tmap.anno
+#-rw-r--r--  1 nilshomer  staff   172M Jan 27 15:53 /data/mapping/genomes/DH10B/DH10B.fa.tmap.bwt
+#-rw-r--r--  1 nilshomer  staff   1.1M Jan 27 15:53 /data/mapping/genomes/DH10B/DH10B.fa.tmap.pac
+#-rw-r--r--  1 nilshomer  staff   172M Jan 27 15:53 /data/mapping/genomes/DH10B/DH10B.fa.tmap.rbwt
+#-rw-r--r--  1 nilshomer  staff   1.1M Jan 27 15:53 /data/mapping/genomes/DH10B/DH10B.fa.tmap.rpac
+#-rw-r--r--  1 nilshomer  staff   572K Jan 27 15:54 /data/mapping/genomes/DH10B/DH10B.fa.tmap.rsa
+#-rw-r--r--  1 nilshomer  staff   572K Jan 27 15:54 /data/mapping/genomes/DH10B/DH10B.fa.tmap.sa
+#...etc...
+#
+#Your tmap_index.loc file should include an entry per line for each
+#index set you have stored. The "file" in the path does not actually
+#exist, but it is the prefix for the actual index files.  For example:
+#
+#phiX174              phiX   phiX174          /depot/data2/galaxy/phiX/base/phiX.fa
+#hg18canon            hg18   hg18 Canonical   /depot/data2/galaxy/hg18/base/hg18canon.fa
+#hg18full             hg18   hg18 Full        /depot/data2/galaxy/hg18/base/hg18full.fa
+#/orig/path/hg19.fa   hg19   hg19             /depot/data2/galaxy/hg19/base/hg19.fa
+#...etc...
+#
+#Note that for backwards compatibility with workflows, the unique ID of
+#an entry must be the path that was in the original loc file, because that
+#is the value stored in the workflow for that parameter. That is why the
+#hg19 entry above looks odd. New genomes can be better-looking.
+#
b
diff -r 000000000000 -r 7cbfd271d207 tmap_wrapper_0.0.19/tmap_wrapper.py
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/tmap_wrapper_0.0.19/tmap_wrapper.py Tue Jun 07 17:28:45 2011 -0400
[
b'@@ -0,0 +1,439 @@\n+#!/usr/bin/env python\n+\n+# TODO\n+# - map1/map2/map3 specific options\n+\n+"""\n+Runs TMAP on Ion Torrent data.\n+Produces a SAM file containing the mappings.\n+Works with TMAP version 0.0.19 or higher.\n+\n+usage: tmap_wrapper.py [options]\n+    --threads: The number of threads to use\n+    --ref: The reference genome to use or index\n+    --fastq: The fastq file to use for the mapping\n+    --output: The file to save the output (SAM format)\n+    --params: Parameter setting to use (pre_set or full)\n+    --fileSource: Whether to use a previously indexed reference sequence or one from history (indexed or history)\n+    --matchScore: The match score\n+    --mismatchPenalty: The ismatch penalty\n+    --gapOpenPenalty: The gap open penalty\n+    --gapExtensPenalty: The gap extension penalty\n+    --flowPenalty: The flow score penalty\n+    --flowOrder: The flow order ([ACGT]{4+} or "sff")\n+    --bandWidth: The band width\n+    --globalMap: The soft-clipping type (0 - allow on the right and left, 1 - allow on the left, 2 - allow on the right, 3 - do not allow soft-clipping)\n+    --duplicateWindow: Remove duplicate alignments from different algorithms within this bp window (-1 to disable)\n+    --scoringThreshold: The score threshold divided by the match score \n+    --queueSize: The queue size for the reads\n+    --outputFilter: The output filter (0 - unique best hits, 1 - random best hit, 2 - all best htis, 3 - all alignments)\n+    --rgTag: The flag to specify RG tag(s) in the SAM header\n+    --rgTagID: The RG ID tag to add to the SAM header\n+    --rgTagCN: The RG CN tag to add to the SAM header\n+    --rgTagDS: The RG DS tag to add to the SAM header\n+    --rgTagDT: The RG DT tag to add to the SAM header\n+    --rgTagLB: The RG LB tag to add to the SAM header\n+    --rgTagPI: The RG PI tag to add to the SAM header\n+    --rgTagPL: The RG PL tag to add to the SAM header\n+    --rgTagPU: The RG PU tag to add to the SAM header\n+    --rgTagSM: The RG SM tag to add to the SAM header\n+    --filterIndependently: Apply the output filter for each algorithm independently\n+\n+    --map1: Flag to run map1 in the first stage\n+    --map1SeedLength: The k-mer length to seed CALs (-1 to disable)\n+    --map1SeedMismatches: The maximum number of mismatches in the seed \n+    --map1SecondarySeedLength: The secondary seed length (-1 to disable)\n+    --map1NumEdits: The maximum number of edits or false-negative probability assuming the maximum error rate\n+    --map1BaseError: The assumed per-base maximum error rate\n+    --map1Mismatches: The maximum number of or (read length) fraction of mismatches \n+    --map1GapOpens: The maximum number of or (read length) fraction of indel starts \n+    --map1GapExtensions: The maximum number of or (read length) fraction of indel extensions \n+    --map1MaxCALsDeletion: The maximum number of CALs to extend a deletion \n+    --map1EndIndels: Indels are not allowed within this number of bps from the end of the read \n+    --map1MaxOptimalCALs: Stop searching when INT optimal CALs have been found \n+    --map1MaxNodes: The maximum number of alignment nodes \n+\n+    --map2: Flag to run map2 in the first stage\n+    --map2Coefficient: The coefficient of length-threshold adjustment \n+    --map2SeedIntervalSize: The maximum seeding interval size \n+    --map2ZBest: Keep the z-best nodes during prefix trie traversal\n+    --map2ReverseTrigger: The # seeds to trigger reverse alignment \n+\n+    --map3: Flag to run map3 in the first stage\n+    --map3SeedLength: The k-mer length to seed CALs (-1 tunes to the genome size) \n+    --map3SeedMaxHits: The maximum number of hits returned by a seed \n+    --map3SeedWindow: The window of bases in which to group seeds \n+    --map3HPEnumeration: The single homopolymer error difference for enumeration \n+    \n+    --MAP1: Flag to run MAP1 in the second stage\n+    --MAP1SeedLength: The k-mer length to seed CALs (-1 to disable)\n+    --MAP1SeedMismatches: The maximum number of mismatches in the seed \n+    --MAP1'..b'ndarySeedLength, options.MAP1NumEdits, \\\n+                    options.MAP1BaseError, options.MAP1Mismatches, \\\n+                    options.MAP1GapOpens, options.MAP1GapExtensions, options.MAP1MaxCALsDeletion, \\\n+                    options.MAP1EndIndels, options.MAP1MaxOptimalCALs, options.MAP1MaxNodes )\n+        else:\n+            MAP1_options = \'\'\n+        # map2 - stage two\n+        if options.MAP2 == \'true\':\n+            MAP2_options = \'MAP2 %s\' % \\\n+                    map2_parse( options.MAP2Coefficient, options.MAP2SeedIntervalSize, \\\n+                    options.MAP2ZBest, options.MAP2ReverseTrigger )\n+        else:\n+            MAP2_options = \'\'\n+        # map3 - stage two\n+        if options.MAP3 == \'true\':\n+            MAP3_options = \'MAP3 %s\' % \\\n+                    MAP3_parse( options.MAP3SeedLength, options.MAP3SeedMaxHits, \\\n+                    options.MAP3SeedWindow, options.MAP3HPEnumeration )\n+        else:\n+            MAP3_options = \'\'\n+\n+    #mapping_cmds \n+    # prepare actual mapping and generate mapping commands\n+    cmd2 = \'tmap mapall -f %s -r %s -F fastq %s -v %s %s %s %s %s %s > %s\' % \\\n+            ( ref_file_name, fastq, mapall_options, \n+                    map1_options, map2_options, map3_options,\n+                    MAP1_options, MAP2_options, MAP3_options,\n+                    options.output )\n+    # perform alignments\n+    buffsize = 1048576\n+    try:\n+        # need to nest try-except in try-finally to handle 2.4\n+        try:\n+            # align\n+            try:\n+                tmp = tempfile.NamedTemporaryFile( dir=tmp_dir ).name\n+                tmp_stderr = open( tmp, \'wb\' )\n+                proc = subprocess.Popen( args=cmd2, shell=True, cwd=tmp_dir, stderr=tmp_stderr.fileno() )\n+                returncode = proc.wait()\n+                tmp_stderr.close()\n+                # get stderr, allowing for case where it\'s very large\n+                tmp_stderr = open( tmp, \'rb\' )\n+                stderr = \'\'\n+                try:\n+                    while True:\n+                        stderr += tmp_stderr.read( buffsize )\n+                        if not stderr or len( stderr ) % buffsize != 0:\n+                            break\n+                except OverflowError:\n+                    pass\n+                tmp_stderr.close()\n+                if returncode != 0:\n+                    raise Exception, stderr\n+            except Exception, e:\n+                raise Exception, \'Error mapping sequence. \' + str( e )\n+            # remove header if necessary\n+            if options.suppressHeader == \'true\':\n+                tmp_out = tempfile.NamedTemporaryFile( dir=tmp_dir)\n+                tmp_out_name = tmp_out.name\n+                tmp_out.close()\n+                try:\n+                    shutil.move( options.output, tmp_out_name )\n+                except Exception, e:\n+                    raise Exception, \'Error moving output file before removing headers. \' + str( e )\n+                fout = file( options.output, \'w\' )\n+                for line in file( tmp_out.name, \'r\' ):\n+                    if not ( line.startswith( \'@HD\' ) or line.startswith( \'@SQ\' ) or line.startswith( \'@RG\' ) or line.startswith( \'@PG\' ) or line.startswith( \'@CO\' ) ):\n+                        fout.write( line )\n+                fout.close()\n+            # check that there are results in the output file\n+            if os.path.getsize( options.output ) > 0:\n+                sys.stdout.write( \'TMAP completed\' )\n+            else:\n+                raise Exception, \'The output file is empty. You may simply have no matches, or there may be an error with your input file or settings.\'\n+        except Exception, e:\n+            stop_err( \'The alignment failed.\\n\' + str( e ) )\n+    finally:\n+        # clean up temp dir\n+        if os.path.exists( tmp_index_dir ):\n+            shutil.rmtree( tmp_index_dir )\n+        if os.path.exists( tmp_dir ):\n+            shutil.rmtree( tmp_dir )\n+\n+if __name__=="__main__": __main__()\n'
b
diff -r 000000000000 -r 7cbfd271d207 tmap_wrapper_0.0.19/tmap_wrapper.xml
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/tmap_wrapper_0.0.19/tmap_wrapper.xml Tue Jun 07 17:28:45 2011 -0400
[
b'@@ -0,0 +1,450 @@\n+<tool id="tmap_wrapper" name="Map with TMAP" version="0.0.19">\n+\t<description>for Ion Torrent</description>\n+\t<parallelism method="basic"></parallelism>\n+\t<command interpreter="python">\n+\t\ttmap_wrapper.py \n+\n+\t\t## reference source\n+\t\t--fileSource=$genomeSource.refGenomeSource\n+\t\t#if $genomeSource.refGenomeSource == "history":\n+\t\t\t##build index on the fly\n+\t\t\t--ref="${genomeSource.ownFile}"\n+\t\t\t--dbkey=$dbkey\n+\t\t#else:\n+\t\t\t##use precomputed indexes\n+\t\t\t--ref="${ filter( lambda x: str( x[0] ) == str( $genomeSource.indices ), $__app__.tool_data_tables[ \'tmap_indexes\' ].get_fields() )[0][-1] }"\n+\t\t\t--do_not_build_index\n+\t\t#end if\n+\n+\t\t## input fastq\n+\t\t--fastq=$input\n+\n+\t\t## output file\n+\t\t--output=$output\n+\n+\t\t## run parameters\n+\t\t--params=$params.source_select\n+\t\t#if $params.source_select != "pre_set":\n+\t\t\t--mapall=$params.mapall.source_select\n+\t\t\t#if $params.mapall.source_select == "true":\n+\t\t\t\t--threads=$params.mapall.threads\n+\t\t\t\t--matchScore=$params.mapall.matchScore\n+\t\t\t\t--mismatchPenalty=$params.mapall.mismatchPenalty\n+\t\t\t\t--gapOpenPenalty=$params.mapall.gapOpenPenalty\n+\t\t\t\t--gapExtensPenalty=$params.mapall.gapExtensPenalty\n+\t\t\t\t--flowPenalty=$params.mapall.flowPenalty\n+\t\t\t\t--flowOrder=$params.mappll.flowOrder\n+\t\t\t\t--bandWidth=$params.mapall.bandWidth\n+\t\t\t\t--globalMap=$params.mapall.globalMap\n+\t\t\t\t--duplicateWindow=$params.mapall.duplicateWindow\n+\t\t\t\t--scoringThreshold=$params.mapall.scoringThreshold\n+\t\t\t\t--queueSize=$params.mapall.queueSize\n+\t\t\t\t--outputFilter=$params.mapall.outputFilter\n+\t\t\t\t--rgTag=$params.mapall.rgTag.source_select\n+\t\t\t\t#if $params.mapall.rgTag.source_select == "true":\n+\t\t\t\t\t--rgTagID=$params.mapall.rgTag.rgTagID\n+\t\t\t\t\t--rgTagCN=$params.mapall.rgTag.rgTagCN\n+\t\t\t\t\t--rgTagDS=$params.mapall.rgTag.rgTagDS\n+\t\t\t\t\t--rgTagDT=$params.mapall.rgTag.rgTagDT\n+\t\t\t\t\t--rgTagLB=$params.mapall.rgTag.rgTagLB\n+\t\t\t\t\t--rgTagPI=$params.mapall.rgTag.rgTagPI\n+\t\t\t\t\t--rgTagPL=$params.mapall.rgTag.rgTagPL\n+\t\t\t\t\t--rgTagPU=$params.mapall.rgTag.rgTagPU\n+\t\t\t\t\t--rgTagSM=$params.mapall.rgTag.rgTagSM\n+\t\t\t\t#end if\n+\t\t\t\t--filterIndependently=$params.mapall.filterIndependently \n+\t\t\t#end if\n+\t\t\t--map1=$params.map1.source_select\n+\t\t\t#if $params.map1.source_select == "true":\n+\t\t\t\t--map1SeedLength=$params.map1.map1SeedLength\n+\t\t\t\t--map1SeedMismatches=$params.map1.map1SeedMismatches\n+\t\t\t\t--map1SecondarySeedLength=$params.map1.map1SecondarySeedLength\n+\t\t\t\t--map1NumEdits=$params.map1.map1NumEdits\n+\t\t\t\t--map1BaseError=$params.map1.map1BaseError\n+\t\t\t\t--map1Mismatches=$params.map1.map1Mismatches\n+\t\t\t\t--map1GapOpens=$params.map1.map1GapOpens\n+\t\t\t\t--map1GapExtensions=$params.map1.map1GapExtensions\n+\t\t\t\t--map1MaxCALsDeletion=$params.map1.map1MaxCALsDeletion\n+\t\t\t\t--map1EndIndels=$params.map1.map1EndIndels\n+\t\t\t\t--map1MaxOptimalCALs=$params.map1.map1MaxOptimalCALs\n+\t\t\t\t--map1MaxNodes=$params.map1.map1MaxNodes\n+\t\t\t#end if\n+\t\t\t--map2=$params.map2.source_select\n+\t\t\t#if $params.map2.source_select == "true":\n+\t\t\t\t--map2Coefficient=$params.map2.map2Coefficient\n+\t\t\t\t--map2SeedIntervalSize=$params.map2.map2SeedIntervalSize\n+\t\t\t\t--map2ZBest=$params.map2.map2ZBest\n+\t\t\t\t--map2ReverseTrigger=$params.map2.map2ReverseTrigger\n+\t\t\t#end if\n+\t\t\t--map3=$params.map3.source_select\n+\t\t\t#if $params.map3.source_select == "true":\n+\t\t\t\t--map3SeedLength=$params.map3.map3SeedLength\n+\t\t\t\t--map3SeedMaxHits=$params.map3.map3SeedMaxHits\n+\t\t\t\t--map3SeedWindow=$params.map3.map3SeedWindow\n+\t\t\t\t--map3HPEnumeration=$params.map3.map3HPEnumeration\n+\t\t\t#end if\n+\t\t\t--MAP1=$params.MAP1.source_select\n+\t\t\t#if $params.MAP1.source_select == "true":\n+\t\t\t\t--MAP1SeedLength=$params.MAP1.MAP1SeedLength\n+\t\t\t\t--MAP1SeedMismatches=$params.MAP1.MAP1SeedMismatches\n+\t\t\t\t--MAP1SecondarySeedLength=$params.MAP1.MAP1SecondarySeedLength\n+\t\t\t\t--MAP1NumEdits=$params.MAP1.MAP1NumEdits\n+\t\t\t\t--MAP1BaseError=$params.MAP1.MAP1BaseError\n+\t\t\t\t--MAP1Mismatches=$params.MAP1.MAP1Mismatches\n+\t\t\t\t--MAP1GapOpens=$params.MAP1.MAP1GapOpens\n+\t\t\t\t--MAP1GapExtensions=$params.MAP1.MAP1GapExtensions\n+\t\t\t\t--MAP1MaxCALs'..b"2  FLAG   bitwise FLAG\n+  3  RNAME  Reference sequence NAME\n+  4  POS    1-based leftmost POSition/coordinate of clipped sequence\n+  5  MAPQ   MAPping Quality (Phred-scaled)\n+  6  CIGAR  extended CIGAR string\n+  7  MRNM   Mate Reference sequence NaMe ('=' if same as RNAME)\n+  8  MPOS   1-based Mate POSition\n+  9  ISIZE  Inferred insert SIZE\n+  10 SEQ    query SEQuence on the same strand as the reference\n+  11 QUAL   query QUALity (ASCII-33 gives the Phred base quality)\n+  12 OPT    variable OPTional fields in the format TAG:VTYPE:VALU\n+  \n+The flags are as follows::\n+\n+    Flag  Description\n+  ------  -------------------------------------\n+  0x0001  the read is paired in sequencing\n+  0x0002  the read is mapped in a proper pair\n+  0x0004  the query sequence itself is unmapped\n+  0x0008  the mate is unmapped\n+  0x0010  strand of the query (1 for reverse)\n+  0x0020  strand of the mate\n+  0x0040  the read is the first read in a pair\n+  0x0080  the read is the second read in a pair\n+  0x0100  the alignment is not primary\n+\n+It looks like this (scroll sideways to see the entire example)::\n+\n+  QNAME\tFLAG\tRNAME\tPOS\tMAPQ\tCIAGR\tMRNM\tMPOS\tISIZE\tSEQ\tQUAL\tOPT\n+  HWI-EAS91_1_30788AAXX:1:1:1761:343\t4\t*\t0\t0\t*\t*\t0\t0\tAAAAAAANNAAAAAAAAAAAAAAAAAAAAAAAAAAACNNANNGAGTNGNNNNNNNGCTTCCCACAGNNCTGG\thhhhhhh;;hhhhhhhhhhh^hOhhhhghhhfhhhgh;;h;;hhhh;h;;;;;;;hhhhhhghhhh;;Phhh\n+  HWI-EAS91_1_30788AAXX:1:1:1578:331\t4\t*\t0\t0\t*\t*\t0\t0\tGTATAGANNAATAAGAAAAAAAAAAATGAAGACTTTCNNANNTCTGNANNNNNNNTCTTTTTTCAGNNGTAG\thhhhhhh;;hhhhhhhhhhhhhhhhhhhhhhhhhhhh;;h;;hhhh;h;;;;;;;hhhhhhhhhhh;;hhVh\n+\n+-------\n+\n+**TMAP settings**\n+\n+All of the options have a default value. You can change most of them. Most of the options in TMAP have been implemented here.\n+\n+------\n+\n+**TMAP parameter list**\n+\n+This is an exhaustive list of TMAP options implemented here:\n+\n+For the **global** options::\n+\n+  -A INT      score for a match [5]\n+  -M INT      the mismatch penalty [3]\n+  -O INT      the indel start penalty [3]\n+  -E INT      the indel extend penalty [1]\n+  -X INT      the flow score penalty [7]\n+  -w INT      the band width [50]\n+  -g          map the full read [false]\n+  -W INT      remove duplicate alignments from different algorithms within this bp window (-1 to disable) [128]\n+  -T INT      score threshold divided by the match score [30]\n+  -q INT      the queue size for the reads (-1 disables) [65536]\n+  -n INT      the number of threads [1]\n+  -a INT      output filter [1]\n+\t\t  0 - unique best hits\n+ \t\t  1 - random best hit\n+ \t\t  2 - all best hits\n+ \t\t  3 - all alignments\n+  -R STRING   the RG tags to add to the SAM header [(null)]\n+\n+For **mapall** options::\n+\n+  -I          apply the output filter for each algorithm separately [false]\n+ \n+For **map1** options::\n+\n+  -l INT      the k-mer length to seed CALs (-1 to disable) [32]\n+  -s INT      maximum number of mismatches in the seed [3]\n+  -m NUM      maximum number of or (read length) fraction of mismatches [number: 2]\n+  -o NUM      maximum number of or (read length) fraction of indel starts [number: 1]\n+  -e NUM      maximum number of or (read length) fraction of indel extensions [number: 6]\n+  -d INT      the maximum number of CALs to extend a deletion [10]\n+  -i INT      indels are not allowed within INT number of bps from the end of the read [5]\n+  -b INT      stop searching when INT optimal CALs have been found [32]\n+  -Q INT      maximum number of alignment nodes [2000000]\n+ \n+For **map2** options::\n+\n+  -c FLOAT    coefficient of length-threshold adjustment [5.5]\n+  -S INT      maximum seeding interval size [3]\n+  -b INT      Z-best [1]\n+  -N INT      # seeds to trigger reverse alignment [5]\n+ \n+For **map3** options::\n+\n+  -l INT      the k-mer length to seed CALs (-1 tunes to the genome size) [-1]\n+  -S INT      the maximum number of hits returned by a seed [8]\n+  -b INT      the window of bases in which to group seeds [50]\n+  -H INT      single homopolymer error difference for enumeration [0]\n+\n+  </help>\n+</tool>\n+\n+\n"