Neatbo.

Rooted Newick taxa pruning

Keep or remove named taxa from a declared rooted Newick tree while retaining the original root, unknown edge lengths, annotations and exact decimal contractions.

Browser-local processingInputRooted Newick / taxa JSONOutputNewick / JSON / CSVUp to 5 MiB per file · File limit: 1
  1. 1Add input
  2. 2Adjust settings
  3. 3Get your result

Tool input and files are processed in this browser without being uploaded.

Your input

Inputs are kept temporarily in this tab when switching tools. Refreshing or closing clears them; large results may need to be regenerated.

⌘ / Ctrl + Enter to run

or drag and drop it here

Files stay on this device. Your originals stay unchanged.

.nwk · .newick · .tree · .txt

Up to 5 MiB per file · File limit: 1

    0 characters · 0 bytes
    Options

    Complete the required options first. You can keep the defaults for the rest.

    Preparing the tool…

    Before you start

    Supply one rooted tree and a JSON list of exact leaf labels. Trace every kept, removed, missing or repeated request to the original tree; download the changed Newick with full provenance.

    How to use this tool

    1. Choose one rooted UTF-8 tree and confirm the rooted-tree declaration. Enter exact labels as a JSON array.
    2. Choose keep or remove; review kept/removed taxa, unmatched requests and exact edge changes.
    3. Download pruned Newick and full JSON/CSV. Check original-root paths and unknown-length states before using the result.

    Supported inputs and limits

    One UTF-8 single Newick tree up to 5 MiB, optional BOM, plus taxa JSON array up to 1 MiB. Up to 50,000 nodes, 10,000 internal-parenthesis depth and 10,000 requested taxa; each decoded label and numeric token up to 4,096 UTF-16 units; exponent absolute value up to 100. Complete JSON, CSV and Newick together must fit 20 MiB.

    Explicitly declare the tree rooted. Keep/remove use exact case-sensitive labels with literal underscores; quoted labels and doubled single quotes are supported. Duplicate source leaf labels are ambiguous and reject; duplicate requests and unmatched labels remain separately reported.

    The original root and its edge remain. Only an unlabeled, unannotated non-root unary node whose incoming and surviving-child lengths both exist is contracted; decimal sums are exact, including values outside float64. Missing lengths remain unknown and never become zero.

    Surviving internal labels/support and comments stay attached to their nodes. Unknown or annotated unary nodes remain. This is not MRCA extraction, re-rooting, unrooted minimum-subtree search, strict minimum-node optimization or biological inference.

    Anonymous leaves and unsupported leading directives, including [&U], are outside this profile; [&R] is retained. These restrictions do not redefine valid Newick. Removing every leaf rejects the batch; change the mode or request list to retain at least one leaf.

    Full JSON preserves original sources and hashes, all original node/length spans, every request including duplicates, kept/removed/unmatched taxa and exact contractions. CSV includes every source taxon and unmatched unique request. Preview shows 200 rows/2,000 UTF-16 units per cell; copying large reports gives only a labelled preview. Complete downloads are atomic.

    Worked example

    Example input

    ((raccoon,bear),((sea_lion,seal),((monkey,cat),weasel)),dog);
    Example options
    {"secondary":"[\"raccoon\",\"sea_lion\"]","params":{"rooted":true,"mode":"keep","spreadsheetSafe":true}}

    Example output

    {"source":{"name":"pasted.txt","bytes":61,"sha256":"012acf1a865f4aaf4df104c3f133fd2d35fcaa2c567e3a4bfa007cdb09a5b2be","encoding":"UTF-8","bomRetained":false},"sourceText":"((raccoon,bear),((sea_lion,seal),((monkey,cat),weasel)),dog);","taxaSource":{"text":"[\"raccoon\",\"sea_lion\"]","bytes":22,"sha256":"86125ef83d644c9874454f8a09481021f4920040bf9cd01c163cab4ad0974a2b"},"summary":{"inputNodes":14,"inputTaxa":8,"keptTaxa":2,"removedTaxa":6,"notFound":0,"requestedTaxa":2,"duplicateRequests":0,"contractions":0,"maxDepth":4,"originalRootRetained":true,"status":"rooted-taxa-pruned"},"requestedTaxa":["raccoon","sea_lion"],"uniqueRequestedTaxa":2,"duplicateRequests":[],"inputNodes":14,"maxDepth":4,"originalRootRetained":true,"rootDirective":"","nodeRecords":[{"index":0,"name":null,"rawName":"","comments":[],"rawLength":null,"children":[1,4,13],"sourceSpan":{"utf8Start":0,"utf8Bytes":60},"lengthSpan":null},{"index":1,"name":null,"rawName":"","comments":[],"rawLength":null,"children":[2,3],"sourceSpan":{"utf8Start":1,"utf8Bytes":14},"lengthSpan":null},{"index":2,"name":"raccoon","rawName":"raccoon","comments":[],"rawLength":null,"children":null,"sourceSpan":{"utf8Start":2,"utf8Bytes":7},"lengthSpan":null},{"index":3,"name":"bear","rawName":"bear","comments":[],"rawLength":null,"children":null,"sourceSpan":{"utf8Start":10,"utf8Bytes":4},"lengthSpan":null},{"index":4,"name":null,"rawName":"","comments":[],"rawLength":null,"children":[5,8],"sourceSpan":{"utf8Start":16,"utf8Bytes":39},"lengthSpan":null},{"index":5,"name":null,"rawName":"","comments":[],"rawLength":null,"children":[6,7],"sourceSpan":{"utf8Start":17,"utf8Bytes":15},"lengthSpan":null},{"index":6,"name":"sea_lion","rawName":"sea_lion","comments":[],"rawLength":null,"children":null,"sourceSpan":{"utf8Start":18,"utf8Bytes":8},"lengthSpan":null},{"index":7,"name":"seal","rawName":"seal","comments":[],"rawLength":null,"children":null,"sourceSpan":{"utf8Start":27,"utf8Bytes":4},"lengthSpan":null},{"index":8,"name":null,"rawName":"","comments":[],"rawLength":null,"children":[9,12],"sourceSpan":{"utf8Start":33,"utf8Bytes":21},"lengthSpan":null},{"index":9,"name":null,"rawName":"","comments":[],"rawLength":null,"children":[10,11],"sourceSpan":{"utf8Start":34,"utf8Bytes":12},"lengthSpan":null},{"index":10,"name":"monkey","rawName":"monkey","comments":[],"rawLength":null,"children":null,"sourceSpan":{"utf8Start":35,"utf8Bytes":6},"lengthSpan":null},{"index":11,"name":"cat","rawName":"cat","comments":[],"rawLength":null,"children":null,"sourceSpan":{"utf8Start":42,"utf8Bytes":3},"lengthSpan":null},{"index":12,"name":"weasel","rawName":"weasel","comments":[],"rawLength":null,"children":null,"sourceSpan":{"utf8Start":47,"utf8Bytes":6},"lengthSpan":null},{"index":13,"name":"dog","rawName":"dog","comments":[],"rawLength":null,"children":null,"sourceSpan":{"utf8Start":56,"utf8Bytes":3},"lengthSpan":null}],"contractionRecords":[],"keptTaxa":["raccoon","sea_lion"],"removedTaxa":["bear","seal","monkey","cat","weasel","dog"],"notFound":[],"mode":"keep","rootPolicy":"original-root-inclusive-declared-paths-not-MRCA","contractions":0,"underscoreMode":"literal-preserve","annotatedUnary":"retained","scope":"User-declared rooted ordinary single Newick. Original root and root edge retained. Unknown edge lengths are not zero; only unlabeled/unannotated non-root unary nodes with both known finite decimals contract by exact arithmetic. No rerooting, unrooted/MRCA subtree, strict minimum nodes or biological inference."}

    When something does not work

    Confirm the rooted profile, correct Newick/JSON syntax and choose keep/remove deliberately. Retain at least one named leaf. Rename ambiguous duplicate source labels using a trusted workflow; reduce source, requests or full contraction-report size after a limit rejection. Cancellation publishes no partial tree.

    Frequently asked questions

    Is the output the smallest subtree containing the requested taxa?

    It retains the original root and declared root paths. It does not select the MRCA or re-root. Annotated and unknown-length unary nodes stay, so no strict minimum-node claim is made.

    What happens to an unknown edge length?

    It remains unknown. The parent is retained when either length needed for contraction is missing; the tool does not insert a zero or infer a distance.

    Are underscores converted to spaces?

    No. This profile uses literal underscores. Quote labels with spaces or special punctuation and supply the decoded label exactly in the JSON request list.

    Documentation & further reading

    Related tools