# HG changeset patch
# User jjohnson
# Date 1349799207 14400
# Node ID 0ec6c5781381d1af5584da8a9f2bf21202cfde19
Uploaded
diff -r 000000000000 -r 0ec6c5781381 metaphlan.xml
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/metaphlan.xml Tue Oct 09 12:13:27 2012 -0400
@@ -0,0 +1,91 @@
+
+
+metaphlan
+bowtie2
+
+ Metagenomic Phylogenetic Analysis
+
+ metaphlan.py
+ $input
+ --bowtie2db ${GALAXY_DATA_INDEX_DIR}/shared/metaphlan/bowtie2db/mpa
+ --no_map
+ -o $output
+ --bt2_ps $PresetsForBowtie2
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+.. class:: infomark
+
+**Input example:** You can try out MetaPhlAn using the synthetic dataset (250,000 reads) available at: http://huttenhower.sph.harvard.edu/sites/default/files/LC1.fna . There is no need to download the file, you can just copy-and-paste the dataset address in the "Upload File" module inside the "Load Data" link here in the left panel.
+
+.. class:: infomark
+
+**Computational time:** Unless the server is overloaded, you should expect the tool to process ~10,000 reads per second. The synthetic metagenome linked above (250,000 reads) should take no more than 30 seconds to complete.
+
+.. class:: infomark
+
+**Tip:** If your input is in FASTQ you can convert it in FASTA using the corresponding Galaxy module included in the "Convert Format" tools.
+
+---------
+
+**What it does**
+
+MetaPhlAn (Metagenomic Phylogenetic Analysis) is a computational tool for profiling the composition of microbial communities from metagenomic shotgun sequencing data. MetaPhlAn relies on unique clade-specific marker genes identified from reference genomes, allowing orders of magnitude speedups and unambiguous taxonomic assignments.
+
+Although MetaPhlAn can use both BlastN and BowTie2 in the read-to-marker mapping step, this Galaxy module uses only BowTie2 for computational reasons.
+
+For additional information about MetaPhlAn and the MetaPhlAn command line package, please refer to http://huttenhower.sph.harvard.edu/metaphlan or to the paper reported below. Please notice that most of the additional parameters that can be tuned with the command line version are set here to the default values.
+
+---------
+
+**Inputs**
+
+The input file must be a multi-fasta file containing metagenomic reads loaded with the "Get Data" module in the left panel. Reads can be as short as ~40 nt although lengths higher than 70 nt are recommended.
+
+A synthetic metagenome you can use as sample input is available at http://huttenhower.sph.harvard.edu/sites/default/files/LC1.fna
+
+**Outputs**
+
+The output is a two column tab-separated plain file reporting the predicted microbial clades present in the metagenomic samples and the corresponding relative abundances.
+
+All taxonomic levels from domain to species will be reported and higher taxonomic levelis contain the sum of the abundances of its taxonomic leaf nodes (usually species) and, possibly, some lower level "unclassified" clades.
+
+-----
+
+**Citation and contacts**
+
+If you find MetaPhlAn useful in your research, please cite our paper:
+
+| `Nicola Segata`_, Levi Waldron, Annalisa Ballarini, Vagheesh Narasimhan, Olivier Jousson, `Curtis Huttenhower`_.
+| **"Fast and accurate metagenomic profiling of microbial community composition using unique clade-specific marker genes"**
+| Nature Methods, 2012 (in press)
+
+.. _Nicola Segata: nsegata@hsph.harvard.edu
+.. _Curtis Huttenhower: chuttenh@hsph.harvard.edu
+
+If you have any questions or comments, feel free to `contact us`_. Additional information are available at http://huttenhower.sph.harvard.edu/metaphlan and in the FAQ at the same page. You can also join and use our user group at https://groups.google.com/d/forum/metaphlan-users
+
+.. _contact us: nsegata@hsph.harvard.edu
+
+
+
+
+
diff -r 000000000000 -r 0ec6c5781381 metaphlan_to_phyloxml.py
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/metaphlan_to_phyloxml.py Tue Oct 09 12:13:27 2012 -0400
@@ -0,0 +1,76 @@
+#!/usr/bin/env python
+
+"""
+Read metaphaln output summarizing taxonomic distribution and format in PhyloXML format
+
+usage: %prog metaphlan.txt phylo.xml
+"""
+
+import sys
+
+# Metaphlan output looks like:
+# k__Bacteria 99.07618
+# k__Archaea 0.92382
+# k__Bacteria|p__Proteobacteria 82.50732
+# k__Bacteria|p__Proteobacteria|c__Gammaproteobacteria 81.64905
+
+rank_map = { 'k__': 'kingdom', 'p__': 'phylum', 'c__': 'class', 'o__': 'order', 'f__': 'family', 'g__': 'genus', 's__': 'species' }
+
+class Node( object ):
+ """Node in a taxonomy"""
+ def __init__( self, rank=None, name=None ):
+ self.rank = rank
+ self.name = name
+ self.value = None
+ self.children = dict()
+ @staticmethod
+ def from_metaphlan_file( file ):
+ """
+ Build tree from metaphlan output
+ """
+ root = Node()
+ for line in file:
+ taxa, abundance = line.split()
+ parts = taxa.split( "|" )
+ root.add( parts, abundance )
+ return root
+ def add( self, parts, value ):
+ """
+ Parts is a list of node names, recursively add nodes until we reach
+ the last part, and then attach the value to that node.
+ """
+ if len( parts ) == 0:
+ self.value = value
+ else:
+ next_part = parts.pop(0)
+ rank = rank_map[ next_part[:3] ]
+ name = next_part[3:]
+ if name not in self.children:
+ self.children[name] = Node( rank, name )
+ self.children[name].add( parts, value )
+ def __str__( self ):
+ if self.children:
+ return "(" + ",".join( str( child ) for child in self.children.itervalues() ) + "):" + self.name
+ else:
+ return self.name
+ def to_phyloxml( self, out ):
+ print >>out, ""
+ if self.name:
+ print >>out, "%s" % self.name
+ print >>out, "%s%s" % ( self.name, self.rank )
+ if self.value:
+ print >>out, "%s" % self.value
+ ## print >>out, "%s" % self.value
+ for child in self.children.itervalues():
+ child.to_phyloxml( out )
+ print >>out, ""
+
+out = open( sys.argv[2], 'w' )
+
+print >>out, ''
+print >>out, ''
+
+Node.from_metaphlan_file( open( sys.argv[1] ) ).to_phyloxml( out )
+
+print >>out, ''
+print >>out, ''
diff -r 000000000000 -r 0ec6c5781381 metaphlan_to_phyloxml.xml
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/metaphlan_to_phyloxml.xml Tue Oct 09 12:13:27 2012 -0400
@@ -0,0 +1,17 @@
+
+ Converter
+
+metaphlan_to_phyloxml.py $input $output
+
+
+
+
+
+
+
+
+
+
+ MetaPhlAn to PhyloXML Converter
+
+