Skip to main content

Build Status codecov Code style: black

Medeina

Medeina is a python package for automating the construction of species interaction webs, such as food webs, or pollination webs.The package allows both management of a data store of interactions, and functions needed to make use of the data store in building a cumulative interaction web. For convenience, Medeina comes with a pre-loaded data store of 2,740,185 interactions, coming from 38,865 unique species, which is de-compressed and readily available from the first use. A list of the datasets that come native with Medeina can be found here under 'dataset_lists'.

Features

The Web Class

For creating species interaction webs, you will need a list of species from your environment. The project will standardise these names for you, by using the EcoNameTranslator package (a slightly more powerful version of the R taxize package). The species names can be in any format- whether scientific species name, scientific names at higher taxonomic ranks, or common English name (although this should be used with caution). Under the hood, Medeina translates these forms to scientific species names when matching possible interactions.

You may also specify a taxonomic rank, which will dictate to what extent similarity of species can be used to infer interactions, which can help you find interaction store data undersampling. The default is exact string name matching, but you may also specify Genus, Family, Class, Order, Phylum and Kingdom.

When the cumulative interaction web has been computed, it can be interpreted as either a list of tuples, a numpy matrix, or a networkx object.

The WebStore

If you would like to add your own species interaction dataset to Medeina, you can do so with the WebStore object. CSV file formats are taken, and your data may be in list format (where each row is an individual interaction), or a matrix. The names in your interaction dataset are also parsed and translated to scientific species names for Medeina to use. Take a look at the official documentation() for examples of how to add datasets in a range of formats.

Quick Examples

Building an interaction web out-of-the-box

from Medeina import Web
w = Web()       
species_data = ['Panthera Tigris','Gazelle', 'Equus']
result = w.apply(species_data)
print(result.to_list())
# [('Panthera Tigris','hello')...]

Tailoring the interaction data store

from Medeina import Web
web = Web()
pollination_web = 
    web.filter_by_interaction_type(  
        ["pollination"]
    )
british_pollination_web = 
    pollination_web.filter_by_country(
        ["United Kingdom"]
    )
...   
result = british_pollination_web.apply(
            species=[...]
         )
result = w.apply(species_data)
print(result.to_list())
# [('Panthera Tigris','hello')...]

Adding your own interaction data

from Medeina import WebStore
store = WebStore()
# Specify data properties
dct = {}
dct['source'] = 'Davies(2020)'
...
dct['encoding'] = {}
dct['encoding']['interactionFormat'] = 'pair'
dct['encoding']['head'] = 'Predator'
dct['encoding']['tail'] = 'Prey'
dct['encoding']['evidencedBy'] = 'Evidence'
dct['encoding']['path'] = "C:/Users/..."
# Read, Index, and Add Interactions
store.add_interactions(dct)
# For exporting data from the WebStore
store.export_data(path="C:/Users/...", \ 
                  datasets=[2,4..])
from Medeina import Web
w = Web()       
species_data = ['Panthera Tigris','Gazelle', 'Equus']
result = w.apply(species_data)
# A csv of the links, meta data,
#  and the original links that led to 
# the inference
result.audit("C:/...")  

Metadata

Release files for Medeina 2.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for Medeina 2.1
File Size Uploaded
Medeina-2.1.tar.gz 9.1 MB Details

Built distribution (wheel)

Table of built distributions (wheels) for Medeina 2.1
File Interpreter ABI Platform
Medeina-2.1-py3-none-any.whl Python 3 none any Details

Total release size: 18.2 MB

Release files / Medeina-2.1.tar.gz

Download URL Medeina-2.1.tar.gz
Size 9.1 MB
Tags Source
SHA-256 checksum
How to use checksums
3ac3af2df1a2ff08b4a6fbf865b32cfa80d381ab9d545a8c0da86f9e0d5f4b9a
BLAKE2b-256 checksum
How to use checksums
e84c38671cd4d973aa7b2ef05cd66721f452fe62bb3a00033e4c152f55676fc5
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.1.1 pkginfo/1.5.0.1 requests/2.24.0 setuptools/46.4.0 requests-toolbelt/0.9.1 tqdm/4.46.0 CPython/3.6.8

Release files / Medeina-2.1-py3-none-any.whl

Download URL Medeina-2.1-py3-none-any.whl
Size 9.1 MB
Tags Python 3
SHA-256 checksum
How to use checksums
2239a53dd277c53bc3e16635bf70b6dd87b2d461d5380d98130708c52ef26372
BLAKE2b-256 checksum
How to use checksums
914090cd71d9d940b80e516050e39c7c0ea4bb6c135b7d71575ecfc7e200cff9
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.1.1 pkginfo/1.5.0.1 requests/2.24.0 setuptools/46.4.0 requests-toolbelt/0.9.1 tqdm/4.46.0 CPython/3.6.8

Release history Release notifications | RSS feed

This release

2.1 This release

2 release files

2.0

2 release files

1.7

1 release file

1.6

2 release files

1.5

2 release files

1.4

2 release files

1.3

2 release files

1.1

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page