# HG changeset patch # User bebatut # Date 1464855714 14400 # Node ID b0cd2569ccfbbe3a6fed1de62f0c090ce785db38 # Parent 7838137cbc7f4753efdbf2c39d90700f415b7b8f planemo upload for repository https://github.com/ASaiM/galaxytools/tree/master/tools/humann2/ commit 79571d981d7d56657699be8aa24a40a36a8d0ab5-dirty diff -r 7838137cbc7f -r b0cd2569ccfb README.rst --- a/README.rst Thu Jun 02 02:31:20 2016 -0400 +++ b/README.rst Thu Jun 02 04:21:54 2016 -0400 @@ -2,10 +2,11 @@ =========================== Galaxy should be able to automatically install the dependencies, i.e. the -MetaPhlAn2 binaries. +HUMAnN2 binaries and its dependencies. After installation, you must tell Galaxy about the defaut database with -clade-specific marker genes, and where to find it: +clade-specific marker genes used for taxonomic profiling (MetaPhlAn2), and where +to find it: * Put the ``metaphlan2_db.loc`` file in the ``tool-data/`` folder, after uncommenting last line * Download whole MetaPhlan2 source code: https://bitbucket.org/biobakery/metaphlan2/get/2.5.0.zip diff -r 7838137cbc7f -r b0cd2569ccfb humann2.xml --- a/humann2.xml Thu Jun 02 02:31:20 2016 -0400 +++ b/humann2.xml Thu Jun 02 04:21:54 2016 -0400 @@ -38,15 +38,17 @@ && #end if - #if $metaphlan2_db.metaphlan2_db_selector == "history" - mkdir ref_db - && - bowtie2-build $metaphlan2_db.metaphlan2_db_sequences ref_db/ref_db - && - python $__tool_directory__/transform_json_to_pkl.py - --json_input $metaphlan2_db_metadata - --pkl_output ref_db/metadata.pkl - && + #if $taxonomic_profile.taxonomic_profile_test == "false" + #if $taxonomic_profile.metaphlan2_db_choice.metaphlan2_db_selector == "history" + `mkdir ref_db` + && + bowtie2-build $taxonomic_profile.metaphlan2_db_choice.metaphlan2_db_sequences ref_db/ref_db + && + python $__tool_directory__/transform_json_to_pkl.py + --json_input $metaphlan2_db_metadata + --pkl_output ref_db/metadata.pkl + && + #end if #end if humann2 @@ -56,9 +58,9 @@ #if $taxonomic_profile.taxonomic_profile_test == "true": --taxonomic-profile $taxonomic_profile.taxonomic_profile_file #else - #if $metaphlan2_db.metaphlan2_db_selector == "cached" - #set $table = dict([(_[0], _[2]) for _ in $metaphlan2_db.cached_metaphlan2_db.input.options.tool_data_table.data]) - #set $db_choice = $metaphlan2_db.cached_metaphlan2_db.value + #if $taxonomic_profile.metaphlan2_db_choice.metaphlan2_db_selector == "cached" + #set $table = dict([(_[0], _[2]) for _ in $taxonomic_profile.metaphlan2_db_choice.cached_metaphlan2_db.input.options.tool_data_table.data]) + #set $db_choice = $taxonomic_profile.metaphlan2_db_choice.cached_metaphlan2_db.value #set $metaphlan_option += " --bowtie2db " + $table[$db_choice] #set $metaphlan_option += " --mpa_pkl " + $table[$db_choice] + ".pkl" #else @@ -66,7 +68,6 @@ #set $metaphlan_option += " --mpa_pkl " + ref_db/metadata.pkl #end if #end if - --metaphlan-options="$metaphlan_option" --evalue $e_value @@ -110,11 +111,10 @@ - + - + @@ -122,7 +122,7 @@ - + diff -r 7838137cbc7f -r b0cd2569ccfb transform_json_to_pkl.py --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/transform_json_to_pkl.py Thu Jun 02 04:21:54 2016 -0400 @@ -0,0 +1,28 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- + +import cPickle as pickle +import bz2 +import json +import argparse + +def transform_json_to_pkl(args): + with open(args.json_input, 'r') as json_file: + json_str = json_file.read() + metadata = json.loads(json_str) + + for marker in metadata["markers"]: + metadata["markers"][marker]["ext"] = set(metadata["markers"][marker]["ext"]) + + pkl_output = bz2.BZ2File(args.pkl_output, 'w') + pickle.dump(metadata, pkl_output, pickle.HIGHEST_PROTOCOL) + pkl_output.close() + +if __name__ == '__main__': + parser = argparse.ArgumentParser() + parser.add_argument('--json_input', required=True) + parser.add_argument('--pkl_output', required=True) + + args = parser.parse_args() + + transform_json_to_pkl(args)