Create pdf file for huge phylogenetic tree

Page content

Viewing and annotation of a huge phylogenetic tree, especially with hundreds or even thousamds taxa, is always a problem. This post provides a method to split a phylogenetic tree into multiple pages of a PDF file by pdfposter.

1. Install pdfposter

There are several ways to install this utility.

1.1 Install via OS package manager

sudo apt-get install pdfposter

1.2 Install via pip

  • Note: It depends Pythonn 3.x

  • Install for all users:

sudo pip install pdftools.pdfposter
  • For user without root previlege, or for current user only:
pip install --user pdftools.pdfposter

2. Export PDF file for phylogenetic tree

Open phylogenetic tree file by FigTree and make annotations if necessary. Then export the tree in PDF file format. It could be viewed by Linux Document Viewer and presented as a “long” PDF file.

  • Note: It recommended to export the PDF file under Linux system, since FigTree may not work well for huge tree in Windows system.

3. Split the “long” PDF file into multi-pages

Run pdfposter as:

# Split *in.pdf* to several pages, with 1 A4-portrait width, 
# and GUESS how many pages for A4 it needed, and output to *out.pdf*.

pdfposter -p1x999a4 in.pdf out.pdf

Now the “long” PDF file in.pdf have been splitted into multi-pages in out.pdf.

For more commands and details, please refer pdfposter document.

Reference

  1. pdfposter github page: https://gitlab.com/pdftools/pdfposter
  2. pdfposter document: https://pdfposter.readthedocs.io/en/stable/