Example #1
0
    def phylogenetic_diversity_clade(self, options):
        """Calculate phylogenetic diversity of named groups."""

        check_file_exists(options.decorated_tree)
        
        pd = PhylogeneticDiversity()
        pd.pd_clade(options.decorated_tree, options.output_file, options.taxa_list, options.rep_list)
Example #2
0
    def phylogenetic_diversity(self, options):
        """Calculate phylogenetic diversity of extant taxa."""

        check_file_exists(options.tree)
        check_file_exists(options.taxa_list)

        pd = PhylogeneticDiversity()
        rtn = pd.pd(options.tree, options.taxa_list, options.per_taxa_pg_file)
        total_pd, num_in_taxa, in_pd, num_out_taxa, out_pd = rtn
        total_taxa = num_in_taxa + num_out_taxa
        in_pg = total_pd - out_pd

        # report phylogenetic diversity (PD) and gain (PG)
        print('')
        print('\tNo. Taxa\tPD\tPercent PD')
        print('%s\t%d\t%.2f\t%.2f%%' %
              ('Full tree', total_taxa, total_pd, 100))

        print('%s\t%d\t%.2f\t%.3f%%' % ('Outgroup taxa (PD)', num_out_taxa,
                                        out_pd, out_pd * 100 / total_pd))

        print('%s\t%d\t%.2f\t%.3f%%' %
              ('Ingroup taxa (PD)', num_in_taxa, in_pd,
               (in_pd) * 100 / total_pd))

        print(
            '%s\t%d\t%.2f\t%.3f%%' %
            ('Ingroup taxa (PG)', num_in_taxa, in_pg, in_pg * 100 / total_pd))
Example #3
0
    def phylogenetic_diversity_clade(self, options):
        """Calculate phylogenetic diversity of named groups."""

        check_file_exists(options.decorated_tree)

        pd = PhylogeneticDiversity()
        pd.pd_clade(options.decorated_tree, options.taxa_list,
                    options.output_file)
Example #4
0
    def phylogenetic_diversity(self, options):
        """Calculate phylogenetic diversity of extant taxa."""
        
        check_file_exists(options.tree)
        check_file_exists(options.taxa_list)
        
        pd = PhylogeneticDiversity()
        rtn = pd.pd(options.tree, options.taxa_list, options.rep_list, options.per_taxa_pg_file)
        
        total_pd, in_taxa, in_taxa_derep, in_pd, out_taxa, out_taxa_derep, out_pd = rtn
        total_taxa = in_taxa + out_taxa
        total_taxa_derep = in_taxa_derep + out_taxa_derep
        in_pg = total_pd - out_pd
                                            
        # report phylogenetic diversity (PD) and gain (PG)
        print ''
        print '\tNo. Taxa\tNo. Dereplicated Taxa\tPD\tPercent PD'
        
        print '%s\t%d\t%d\t%.2f\t%.2f%%' % ('Full tree', total_taxa, total_taxa_derep, total_pd, 100)
        
        print '%s\t%d\t%d\t%.2f\t%.3f%%' % ('Outgroup taxa (PD)',
                                            out_taxa,
                                            out_taxa_derep,
                                            out_pd, 
                                            out_pd * 100 / total_pd)

        print '%s\t%d\t%d\t%.2f\t%.3f%%' % ('Ingroup taxa (PD)',
                                            in_taxa,
                                            in_taxa_derep,
                                            in_pd, 
                                            (in_pd) * 100 / total_pd)   
                                        
        print '%s\t%d\t%d\t%.2f\t%.3f%%' % ('Ingroup taxa (PG)',
                                            in_taxa,
                                            in_taxa_derep,
                                            in_pg, 
                                            in_pg * 100 / total_pd)