restrict
Behavior:
- Restricts taxonomy terms to descendants of specified ancestor(s).
- Terms can be Taxonomy IDs or scientific names.
- Use
--excludeto invert the filter (exclude matching lines). - Header lines (starting with “#”) are always outputted.
Input:
- Accepts one or more TSV files via
--fileoption. - Reads from standard input by default.
- The input file should contain taxon IDs or scientific names in a specific column.
Output:
- Filtered tab-separated values.
- By default, output is written to standard output.
- Use
--outfileto write to a file instead.
Examples:
-
Restrict to descendants of a specific genus
nwr restrict "Homo" --file input.tsv -
Restrict using taxonomy ID
nwr restrict 9605 --file input.tsv -
Exclude descendants (inverse filter)
nwr restrict "Bacteria" --file input.tsv --exclude -
Specify column and output file
nwr restrict "Mammalia" --file input.tsv -c 2 -o output.tsv -
Multiple ancestors
nwr restrict "Homo" "Pan" --file input.tsv