Skip to content
Steve Bond edited this page Sep 30, 2015 · 5 revisions

--prune_taxa, -pt

Description

Remove taxa with IDs matching specified regex pattern(s). Note that the regex search is greedy, and a match anywhere in the ID will cause the leaf to be pruned. If you need the entire ID to be matched, use the '^...$' syntax ('^' specifies the beginning of the string, and '$' specifies the end).

Argument(s)

Regular expression ( str )

One or more regex patterns, separated by spaces. If there are any special characters in the expression, then ensure the string is enclosed in quotes.

Examples

Input file: fir.nex

#NEXUS

BEGIN TAXA;
    DIMENSIONS NTAX=6;
    TAXLABELS
        firSA25b
        firSA24a
        firSA25a
        firSA26b
        firSA24b
        firSA26a
  ;
END;

BEGIN TREES;
    TREE fir1 = [&U] ((firSA25b:2.0,firSA24a:1.0),((firSA25a:1.0,(firSA26b:3.0,firSA24b:1.0)),firSA26a:1.0)):2.0;
END;

Input tree

#### fir1 ####
                                                    /----------------- firSA25b
/---------------------------------------------------+                          
|                                                   \----------------- firSA24a
|                                                                              
+                                  /---------------------------------- firSA25a
|                /-----------------+                                           
|                |                 |                /----------------- firSA26b
\----------------+                 \----------------+                          
                 |                                  \----------------- firSA24b
                 |                                                             
                 \---------------------------------------------------- firSA26a

Usage example 1

$: pb fir.nex -pt firSA25b firSA26a

Usage example 2 (equivalent to example 1 for this input file)

$: pb fir.nex -pt '(5b|6a)'

Output

#NEXUS

BEGIN TAXA;
    DIMENSIONS NTAX=4;
    TAXLABELS
        firSA24a
        firSA25a
        firSA26b
        firSA24b
  ;
END;

BEGIN TREES;
    TREE fir1 = [&U] (firSA24a:1.0,(firSA25a:1.0,(firSA26b:3.0,firSA24b:1.0))):2.0;
END;

Output tree

#### fir1 ####
/--------------------------------------------------------------------- firSA24a
+                                                                              
|                      /---------------------------------------------- firSA25a
\----------------------+                                                       
                       |                      /----------------------- firSA26b
                       \----------------------+                                
                                              \----------------------- firSA24b

Main Toolkit Pages





Further Reading

Clone this wiki locally