# HG changeset patch
# User iuc
# Date 1501920121 14400
# Node ID 6843a0db2da00b86303df4a31bf31c7937583017
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_kallisto_index_builder commit 3b54163c4f7daff76fcc589c4a9057bb03904380
diff -r 000000000000 -r 6843a0db2da0 data_manager/kallisto_index_builder.py
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/data_manager/kallisto_index_builder.py Sat Aug 05 04:02:01 2017 -0400
@@ -0,0 +1,82 @@
+#!/usr/bin/env python
+# Based heavily on the Bowtie 2 data manager wrapper script by Dan Blankenberg
+from __future__ import print_function
+
+import argparse
+import os
+import subprocess
+import sys
+from json import dumps, loads
+
+DEFAULT_DATA_TABLE_NAME = "kallisto_indexes"
+
+
+def get_id_name( params, dbkey, fasta_description=None):
+ # TODO: ensure sequence_id is unique and does not already appear in location file
+ sequence_id = params['param_dict']['sequence_id']
+ if not sequence_id:
+ sequence_id = dbkey
+
+ sequence_name = params['param_dict']['sequence_name']
+ if not sequence_name:
+ sequence_name = fasta_description
+ if not sequence_name:
+ sequence_name = dbkey
+ return sequence_id, sequence_name
+
+
+def build_kallisto_index( data_manager_dict, options, params, sequence_id, sequence_name ):
+ data_table_name = options.data_table_name or DEFAULT_DATA_TABLE_NAME
+ target_directory = params[ 'output_data' ][0]['extra_files_path']
+ if not os.path.exists( target_directory ):
+ os.mkdir( target_directory )
+ fasta_base_name = os.path.split( options.fasta_filename )[-1]
+ sym_linked_fasta_filename = os.path.join( target_directory, fasta_base_name )
+ os.symlink( options.fasta_filename, sym_linked_fasta_filename )
+ args = [ 'kallisto', 'index' ]
+ args.extend( [ sym_linked_fasta_filename, '-i', sequence_id ] )
+ proc = subprocess.Popen( args=args, shell=False, cwd=target_directory )
+ return_code = proc.wait()
+ if return_code:
+ print("Error building index.", file=sys.stderr)
+ sys.exit( return_code )
+ data_table_entry = dict( value=sequence_id, dbkey=options.fasta_dbkey, name=sequence_name, path=sequence_id )
+ _add_data_table_entry( data_manager_dict, data_table_name, data_table_entry )
+
+
+def _add_data_table_entry( data_manager_dict, data_table_name, data_table_entry ):
+ data_manager_dict['data_tables'] = data_manager_dict.get( 'data_tables', {} )
+ data_manager_dict['data_tables'][ data_table_name ] = data_manager_dict['data_tables'].get( data_table_name, [] )
+ data_manager_dict['data_tables'][ data_table_name ].append( data_table_entry )
+ return data_manager_dict
+
+
+def main():
+ # Parse Command Line
+ parser = argparse.ArgumentParser()
+ parser.add_argument( '--output', dest='output', action='store', type=str, default=None )
+ parser.add_argument( '--fasta_filename', dest='fasta_filename', action='store', type=str, default=None )
+ parser.add_argument( '--fasta_dbkey', dest='fasta_dbkey', action='store', type=str, default=None )
+ parser.add_argument( '--fasta_description', dest='fasta_description', action='store', type=str, default=None )
+ parser.add_argument( '--data_table_name', dest='data_table_name', action='store', type=str, default='kallisto_indexes' )
+ options = parser.parse_args()
+
+ filename = options.output
+
+ params = loads( open( filename ).read() )
+ data_manager_dict = {}
+
+ if options.fasta_dbkey in [ None, '', '?' ]:
+ raise Exception( '"%s" is not a valid dbkey. You must specify a valid dbkey.' % ( options.fasta_dbkey ) )
+
+ sequence_id, sequence_name = get_id_name( params, dbkey=options.fasta_dbkey, fasta_description=options.fasta_description )
+
+ # build the index
+ build_kallisto_index( data_manager_dict, options, params, sequence_id, sequence_name )
+
+ # save info to json file
+ open( filename, 'w' ).write( dumps( data_manager_dict ) )
+
+
+if __name__ == "__main__":
+ main()
diff -r 000000000000 -r 6843a0db2da0 data_manager/kallisto_index_builder.xml
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/data_manager/kallisto_index_builder.xml Sat Aug 05 04:02:01 2017 -0400
@@ -0,0 +1,51 @@
+
+ index builder
+
+ kallisto
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+`__ is a program for
+quantifying abundances of transcripts from RNA-Seq data, or more generally of
+target sequences using high-throughput sequencing reads. It is based on the
+novel idea of pseudoalignment for rapidly determining the compatibility of
+reads with targets, without the need for alignment. On benchmarks with standard
+RNA-Seq data, kallisto can quantify 30 million human reads in less than 3
+minutes on a Mac desktop computer using only the read sequences and a
+transcriptome index that itself takes less than 10 minutes to build.
+Pseudoalignment of reads preserves the key information needed for
+quantification, and kallisto is therefore not only fast, but also as accurate
+as existing quantification tools. In fact, because the pseudoalignment
+procedure is robust to errors in the reads, in many benchmarks kallisto
+significantly outperforms existing tools.
+]]>
+
+
+ 10.1038/nmeth.3317
+
+
diff -r 000000000000 -r 6843a0db2da0 data_manager_conf.xml
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/data_manager_conf.xml Sat Aug 05 04:02:01 2017 -0400
@@ -0,0 +1,20 @@
+
+
+
+
+
+
+
+
\ No newline at end of file
diff -r 000000000000 -r 6843a0db2da0 tool-data/all_fasta.loc.sample
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/tool-data/all_fasta.loc.sample Sat Aug 05 04:02:01 2017 -0400
@@ -0,0 +1,18 @@
+#This file lists the locations and dbkeys of all the fasta files
+#under the "genome" directory (a directory that contains a directory
+#for each build). The script extract_fasta.py will generate the file
+#all_fasta.loc. This file has the format (white space characters are
+#TAB characters):
+#
+#
+#
+#So, all_fasta.loc could look something like this:
+#
+#apiMel3 apiMel3 Honeybee (Apis mellifera): apiMel3 /path/to/genome/apiMel3/apiMel3.fa
+#hg19canon hg19 Human (Homo sapiens): hg19 Canonical /path/to/genome/hg19/hg19canon.fa
+#hg19full hg19 Human (Homo sapiens): hg19 Full /path/to/genome/hg19/hg19full.fa
+#
+#Your all_fasta.loc file should contain an entry for each individual
+#fasta file. So there will be multiple fasta files for each build,
+#such as with hg19 above.
+#
diff -r 000000000000 -r 6843a0db2da0 tool-data/kallisto_indexes.loc.sample
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/tool-data/kallisto_indexes.loc.sample Sat Aug 05 04:02:01 2017 -0400
@@ -0,0 +1,33 @@
+# kallisto_indexes.loc.sample
+# This is a *.loc.sample file distributed with Galaxy that enables tools
+# to use a directory of indexed data files. This one is for kallisto.
+# See the wiki: http://wiki.galaxyproject.org/Admin/NGS%20Local%20Setup
+# First create these data files and save them in your own data directory structure.
+# Then, create a kallisto_indexes.loc file to use those indexes with tools.
+# Copy this file, save it with the same name (minus the .sample),
+# follow the format examples, and store the result in this directory.
+# The file should include an one line entry for each index set.
+# The path points to the "basename" for the set, not a specific file.
+# It has four text columns seperated by TABS.
+#
+#
+#
+# So, for example, if you had sacCer3 indexes stored in:
+#
+# /depot/data2/galaxy/sacCer3/kallisto_indexes/
+#
+# containing sacCer3 genome and sacCer3.*.ht2 files, such as:
+#
+# -rw-rw-r-- 1 dave dave 12M Sep 23 13:57 sacCer3.fa
+# -rw-rw-r-- 1 dave dave 2.9M Sep 23 13:57 sacCer3.kallisto
+#
+# then the kallisto_indexes.loc entry could look like this:
+#
+#sacCer3 sacCer3 S. cerevisiae Apr. 2011 (SacCer_Apr2011/sacCer3) (sacCer3) /depot/data2/galaxy/sacCer3/kallisto_indexes/sacCer3.kallisto
+#
+#More examples:
+#
+#mm10 mm10 Mouse (mm10) /depot/data2/galaxy/kallisto_indexes/mm10
+#dm3 dm3 D. melanogaster (dm3) /depot/data2/galaxy/kallisto_indexes/dm3
+#
+#
diff -r 000000000000 -r 6843a0db2da0 tool_data_table_conf.xml.sample
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/tool_data_table_conf.xml.sample Sat Aug 05 04:02:01 2017 -0400
@@ -0,0 +1,13 @@
+
+
+
+
+ value, dbkey, name, path
+
+
+
+
+ value, dbkey, name, path
+
+
+