Skip to main content

Taxonomic trees (cladograms) from Wikipedia-scraped data.

Project description

Taxopedia

Build taxonomic trees (cladograms) from Wikipedia-scraped data.

Installation

Use the package manager pip to install taxopedia.

pip install taxopedia

Getting Started

import taxopedia

# create a tree... and get a bag of parsed biota boxes!
tree, bag = taxopedia.search("Bears", comprehensive=True)

# pretty print the tree
print(tree.pretty())

# export multiple formats
tree.to_txt("tree_Ursidae.txt")    # plain-text dendrogram
tree.to_html("page_Ursidae.html")  # diagram with images
tree.to_csv("table_Ursidae.csv")   # filled-out tabular data

Tree Manipulation

# take a clone of a tree (to prevent mutation)
cutting = tree.clone()

# finding a node
bears = cutting.find("Ursidae")

# trim cousins (other children of all parents)
bears.exclude_cousins()

# return to the root (topmost parent)
cutting = bears.root()

# re-root the tree
bears = cutting.from_pov("Ursidae")

Saving and Loading Progress

# save the biota bag (so you don't have to scrape it again!)
taxopedia.dump_bag("bag_Ursidae.json", bag)

# loading the biota bag
bag = taxopedia.load_bag("bag_Ursidae.json")

# how to get a tree from a bag
tree = taxopedia.make_tree(bag)

Example Exports

See docs folder for raw files.

Rendered HTML

Click on the image to see a live preview.

docs/page_Ursidae.png

Tabular Data

Click on this link to view a CSV output.

docs/table_Ursidae.csv

Plain-Text Dendrogram

Kingdom: Animalia
└── Phylum: Chordata
    └── Class: Mammalia
        └── Order: Carnivora
            └── Suborder: Caniformia (Caniforms)
                └── Infraorder: Arctoidea
                    └── Family: Ursidae (Bears)
                        ├── Genus: Ursus
                        │   ├── Species: U. arctos (Brown bear)
                        │   │   ├── Subspecies: U. a. arctos (Eurasian brown bear)
                        │   │   ├── Subspecies: U. a. arctos / pyrenaicus (Cantabrian brown bear)
                        │   │   ├── Subspecies: U. a. beringianus (Kamchatka brown bear)
                        │   │   ├── Subspecies: U. a. collaris (East Siberian brown bear)
                        │   │   ├── Subspecies: U. a. gobiensis
                        │   │   ├── Subspecies: U. a. horriblis (Grizzly bear)
                        │   │   ├── Subspecies: U. a. isabellinus (Himalayan brown bear)
                        │   │   ├── Subspecies: U. a. lasiotus (Ussuri brown bear)
                        │   │   ├── Subspecies: U. a. marsicanus / arctos (Marsican brown bear)
                        │   │   ├── Subspecies: U. a. middendorffi / horribilis (Kodiak bear, Alaska Peninsula brown bear)
                        │   │   ├── Subspecies: U. a. pruinosus
                        │   │   ├── Subspecies: U. a. stikeenensis (Stickeen brown bear)
                        │   │   ├── Subspecies: U. a. syriacus (Syrian brown bear)
                        │   │   ├── Subspecies: U. a. ungavaesis / horribilis (Ungava brown bear)
                        │   │   ├── Subspecies: † U. a. californicus (California grizzly bear)
                        │   │   ├── Subspecies: † U. a. crowtheri (Atlas bear)
                        │   │   ├── Subspecies: † U. a. horriblis (Mexican grizzly bear)
                        │   │   └── Subspecies: † U. a. priscus
                        │   ├── Species: U. americanus (American black bear)
                        │   │   ├── Subspecies: U. a. carlottae (Haida Gwaii black bear)
                        │   │   ├── Subspecies: U. a. cinnamomum (Cinnamon Bear)
                        │   │   ├── Subspecies: U. a. emmonsii (Glacier bear)
                        │   │   ├── Subspecies: U. a. floridanus (Florida black bear)
                        │   │   ├── Subspecies: U. a. hamiltoni (Newfoundland black bear)
                        │   │   ├── Subspecies: U. a. kermodei (Kermode bear)
                        │   │   └── Subspecies: U. a. luteolus (Louisiana black bear)
                        │   ├── Species: U. thibetanus (Asian black bear)
                        │   │   ├── Subspecies: U. t. formosanus (Formosan black bear)
                        │   │   ├── Subspecies: U. t. gedrosianus (Balochistan black bear)
                        │   │   ├── Subspecies: U. t. japonicus (Japanese bear)
                        │   │   ├── Subspecies: U. t. laniger (Himalayan black bear)
                        │   │   └── Subspecies: U. t. ussuricus (Ussuri black bear)
                        │   ├── Species: U. arctos × U. maritimus
                        │   │   └── Subspecies: U. a. sitkensis (ABC Islands bear)
                        │   ├── Species: U. maritimus (Polar bear)
                        │   │   └── Subspecies: † U. m. tyrannus
                        │   ├── Species: U. deningeri
                        │   ├── Species: U. dolinensis
                        │   ├── Species: U. etruscus
                        │   ├── Species: U. ingressus
                        │   ├── Species: U. minimus
                        │   ├── Species: U. rossicus
                        │   └── Species: † U. spelaeus (Cave bear)
                        ├── Genus: † Kretzoiarctos
                        │   └── Species: † K. beatrix
                        ├── Genus: † Zaragocyon
                        │   └── Species: † Z. daamsi (Zaragocyon)
                        ├── Tribe: Ailuropodini
                        │   └── Genus: † Ailurarctos
                        ├── Subfamily: Ailuropodinae
                        │   ├── Genus: Ailuropoda (Panda)
                        │   │   ├── Species: A. melanoleuca (Giant panda)
                        │   │   │   └── Subspecies: A. m. qinlingensis (Qinling panda/Brown panda)
                        │   │   ├── Species: A. baconi
                        │   │   └── Species: A. microta
                        │   ├── Genus: † Miomaci
                        │   └── Tribe: † Indarctini
                        │       └── Genus: † Indarctos
                        ├── Subfamily: Tremarctinae
                        │   ├── Genus: Tremarctos
                        │   │   ├── Species: T. ornatus (Spectacled bear)
                        │   │   └── Species: † T. floridanus
                        │   ├── Genus: Plionarctos
                        │   ├── Genus: † Arctodus (Short-faced bear)
                        │   └── Genus: † Arctotherium
                        ├── Subfamily: † Hemicyoninae
                        │   ├── Genus: † Cephalogale
                        │   ├── Genus: † Dinocyon
                        │   ├── Genus: † Hemicyon
                        │   ├── Genus: † Phoberocyon
                        │   ├── Genus: † Phoberogale
                        │   └── Genus: † Plithocyon
                        ├── Subfamily: Ursinae
                        │   ├── Genus: Melursus
                        │   │   └── Species: M. ursinus (Sloth bear)
                        │   │       └── Subspecies: M. u. inornatus (Sri Lankan sloth bear)
                        │   └── Genus: Helarctos
                        │       └── Species: H. malayanus (Sun bear)
                        ├── Subfamily: † Ursavinae
                        │   └── Tribe: † Ursavini
                        │       └── Genus: † Ursavus
                        └── Subfamily: † Agriotheriinae
                            └── Genus: † Agriotherium

License

MIT

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

taxopedia-1.1.3.tar.gz (5.0 kB view details)

Uploaded Source

Built Distribution

taxopedia-1.1.3-py3-none-any.whl (4.8 kB view details)

Uploaded Python 3

File details

Details for the file taxopedia-1.1.3.tar.gz.

File metadata

  • Download URL: taxopedia-1.1.3.tar.gz
  • Upload date:
  • Size: 5.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/3.8.0 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.56.1 CPython/3.8.5

File hashes

Hashes for taxopedia-1.1.3.tar.gz
Algorithm Hash digest
SHA256 b3adef89d90583b8955ac3e74157a1b9a755e9bfc53c9f297c3d3bf020e8e74c
MD5 6d6ccb236908b12b6dbb5cc304781d02
BLAKE2b-256 354cb2e663d4c3e0295a5663f5657a9afc155647be758f11f47917a0a548b528

See more details on using hashes here.

File details

Details for the file taxopedia-1.1.3-py3-none-any.whl.

File metadata

  • Download URL: taxopedia-1.1.3-py3-none-any.whl
  • Upload date:
  • Size: 4.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/3.8.0 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.56.1 CPython/3.8.5

File hashes

Hashes for taxopedia-1.1.3-py3-none-any.whl
Algorithm Hash digest
SHA256 1e9cb968c6174675703a051556c9efbae026a543d65c301f7b76bc8473c5535a
MD5 022fb2ab7bef692c17ffc6b6a96716d3
BLAKE2b-256 e1fbe4bce22560b335dbe4cf3788e37c77761c4cea6e36d83d00129eec56afdf

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page