Navigation
General
Java Library
Python Library

First steps

What is the PhyloData Python library?

The library allows you to access experiments on PhyloData using Python. It is designed to make handling data as easy as possible, so that you can focus on more interesting things.

Installation

Install the library using pip:

pip install phylodata --upgrade

Download an experiment

Go find an interesting experiment and click on Use Experiment, or simply try the following snippet:

from phylodata import load_experiment

experiment = load_experiment("munro-2019-climate-6tvf", version=1)

print("Paper title:", experiment.paper.title)

PhyloData downloads all relevant files into the data/munro-2019-climate-6tvf folder. However, you don’t have to juggle with file paths to access the files:

from phylodata import load_experiment, FileType

experiment = load_experiment("munro-2019-climate-6tvf", version=1)
trees_file = experiment.get_file_of_type(FileType.POSTERIOR_TREES)

print("Trees file path:", trees_file.local_path)

This means that you will never have to worry about where and how the files are stored. You can always run the same script and it just works - no matter if it is on your local computer, a remote server, or on the computer of a friend.

Next steps

Now that you’ve seen the basic way to download an experiment, you should explore the main concepts of the library: