Skip to content
DocRountreePublic

Latest commit

 

History

178 Commits

Folders and files

Repository files navigation

TreeFern icon

TreeFern

A lightweight, free and open-source editor for cladograms.

Build Latest release License Platforms

Download for Windows Download for Linux Open in your browser

TreeFern showing the whole Tree of life

TreeFern is written in C++ with Qt 6. Cladograms are stored as plain JSON files: every edit is saved immediately, and changes made to the file by other programs are picked up live.

You can also use TreeFern in your browser, on desktop or phone, with no install. The web version opens the same JSON files, includes the sample trees, and supports editing by mouse, keyboard or touch. Files can be dropped onto the page, recently opened files are listed in the File menu, and once the site is installed as an app (from the browser's install button) it can open .json files from your file manager.

Contents

Features

  • Four layouts (Ctrl+1 to Ctrl+4 on the desktop, 1 to 4 on the web)
    • Standard: a tapered branching tree in which heavier daughter clades curve away from their mother clade, inspired by the OneZoom viewer. Spread, shrink and curl can be adjusted from the keyboard.
    • Disks: nested circle packing, with each daughter clade drawn as a disk inside its mother clade.
    • Rectangular cladogram: the right-angled tree of journal figures, with the tips aligned in a column and labelled beside it, and clade names placed along their branches.
    • Circular cladogram: the same tree around a circle, with the root at the center and the tip labels radiating outward.
  • Editing: add daughter clades, rename clades and attach free-form notes to them, collapse or expand subtrees, delete subtrees, and move a subtree to a new mother clade with cut and paste.
  • Pictures in the notes: drag pictures onto a clade, the side panel or the Edit box. They are kept in the cladogram file, scaled to at most 1200 px.
  • Autosave and live sync: each change is written to disk atomically, and the file is reloaded automatically if another program modifies it.
  • Search and navigation: find clades by name from the side panel, follow the trail of mother clades above the selection, and move around the tree entirely by keyboard or entirely by mouse.
  • Export: save the current view or the whole tree as a PNG image (at 1x, 2x or 4x resolution) or a scalable SVG, optionally with a transparent background, or copy it to the clipboard.
  • Command palette: Ctrl+K finds any command by typing part of its name.
  • Dark and light themes.
  • Remembered preferences: layout, theme and recently opened files persist between sessions.

Download

Prebuilt packages are attached to each release.

Platform File Notes
Windows 10/11 (64-bit) TreeFern-Setup.exe Installer. Installs for the current user and does not require administrator rights.
Windows 10/11 (64-bit) treefern-windows.zip Portable version. Unzip and run treefern.exe.
Linux (x86-64) TreeFern-x86_64.AppImage Single self-contained file. Requires glibc 2.35 or newer (Ubuntu 22.04, Debian 12, Fedora 36 or later).
All TreeFern-samples.zip Sample cladograms. The Windows packages already include them next to treefern.exe.

Windows: the installer is not code-signed, so Windows SmartScreen may show "Windows protected your PC". Click More info, then Run anyway.

Linux: make the AppImage executable,

chmod +x TreeFern-x86_64.AppImage

then run it:

./TreeFern-x86_64.AppImage

macOS packages are not yet supported; macOS users can build from source.

Building from source

Requirements

  • A C++17 compiler (GCC, Clang or MSVC)
  • CMake 3.16 or newer
  • Qt 6 with the Widgets and Svg modules

Installing the dependencies:

System Command
Debian, Ubuntu, Mint sudo apt install build-essential cmake qt6-base-dev qt6-svg-dev
Fedora sudo dnf install gcc-c++ cmake qt6-qtbase-devel qt6-qtsvg-devel
Arch, Manjaro sudo pacman -S base-devel cmake qt6-base qt6-svg
openSUSE sudo zypper install gcc-c++ cmake qt6-base-devel qt6-svg-devel
macOS (Homebrew) brew install cmake qt
Windows Install Qt 6 with the Qt Online Installer and CMake, or use vcpkg.

Build

git clone https://github.com/DocRountree/treefern.git
cd treefern
cmake -B build -DCMAKE_BUILD_TYPE=Release
cmake --build build -j

The program is a single source file, so downloading just main.cpp and CMakeLists.txt into one directory and running the last two commands also works.

Usage

Start TreeFern from your application menu, by double-clicking the executable, or from a terminal:

./build/treefern                 # reopen the last file, or show the start prompt
./build/treefern cladogram.json  # open a file, creating it from the sample tree if it does not exist

Typical workflow:

  1. Click a clade to select it. Its name, position in the tree and notes appear in the side panel.
  2. Press F to focus the camera on the clade's node.
  3. Press the up arrow key to select the daughter clade, or the down arrow to select the mother clade.
  4. Press A or D to add a daughter clade, S to add a sister clade, or E to edit the clade's name and notes. While adding, press Enter to add the clade, Shift+Enter to add it and start a daughter of it, or Shift+Tab to add it and start a sister. Tab moves to the info box.
  5. To move a subtree, select it and press X, then select the new mother clade and press V.
  6. Press K to colour the clade and everything inside it.
  7. Press Ctrl+Z to undo any mistake.

Press Ctrl+K to find any other command by name.

There is no save command: every change is written to the file as soon as it is made. Use File > Save As to continue editing under a new file name.

Sample cladograms are in the samples directory.

File format

A cladogram is a JSON object with the id of the root clade and a flat list of clades. Every clade except the root names its mother clade in parent.

{
  "root": "a1",
  "nodes": [
    { "id": "a1", "name": "Root Clade", "info": "The big clade.", "collapsed": false },
    { "id": "b2", "parent": "a1", "name": "Daughter Clade 1", "info": "One of the little clades.", "collapsed": false },
    { "id": "c3", "parent": "a1", "name": "Daughter Clade 2", "info": "Another little clade.", "collapsed": true }
  ]
}
Field Type Description
id string Unique identifier for the clade
parent string Id of the mother clade; omitted for the root
name string Display name
info string Free-form notes, shown in the side panel
collapsed boolean Whether the clade's descendants are hidden
title string Optional, at the top level: the name the web app's Samples menu shows for a file in samples/ (otherwise the root clade's name)
images array of strings Optional pictures for the notes, as PNG or JPEG data URLs (data:image/jpeg;base64,…)
color string Optional color as "#rrggbb", inherited by the clade's descendants; omitted when the clade uses its mother clade's colour

Because the format is plain JSON, files can be generated or edited by scripts and other tools while TreeFern is open; it reloads them automatically. Clades whose parent chain does not reach the root are ignored when a file is loaded.

Screenshots

Zooming from Proto-Indo-European into German
Zooming from Proto-Indo-European into German in samples/indo-european.json

Standard layout Disks layout
Standard layout Disks layout
Rectangular cladogram layout Circular cladogram layout
Rectangular cladogram layout Circular cladogram layout
Light mode
Light mode

License

TreeFern is free software, distributed under the terms of the GNU General Public License, version 3. See LICENSE for the full text.

TreeFern uses the Qt toolkit, which is available under the GNU GPL and LGPL. The Windows and Linux packages include unmodified Qt libraries.