Skip to main content

A Python package for building SCN and CWN models.

Project description

Caryocar

Caryocar is a Python package for building Species-Collector Networks (SCNs) and Collector CoWorking Networks(CWNs) models from species occurrence data, as introduced in my MSc thesis. SCNs and CWNs extend the social network analytics and can be used for understanding the social structure behind biological collections. This package is built on top of NetworkX.

Supporting documents

  • New perspectives on analyzing data from biological collections based on social network analytics [MSc thesis].
  • On the social structure behind biological collections [Preprint].
  • Package documentation coming soon...

Example Usage

Create a Species-Collector Network (SCN) from a list of collectors and species:

>>> cols=[ ['col1','col2','col3'],
           ['col1','col2'],
           ['col2','col3'],
           ['col4','col5'],
           ['col4'],
           ['col5','col4'] ]

>>> spp=['sp1','sp2','sp3','sp2','sp3','sp2']

>>> scn = SpeciesCollectorsNetwork( species=spp, collectors=cols )

>>> scn.nodes(data=True)
{ 'sp1': {'bipartite': 1, 'count': 1}, 
  'col1': {'bipartite': 0, 'count': 2}, 
  'col2': {'bipartite': 0, 'count': 3}, 
  'col3': {'bipartite': 0, 'count': 2}, 
  'sp2': {'bipartite': 1, 'count': 3}, 
  'sp3': {'bipartite': 1, 'count': 2}, 
  'col4': {'bipartite': 0, 'count': 3}, 
  'col5': {'bipartite': 0, 'count': 2} }

>>> scn.edges(data=True)
[ ('sp1', 'col1', {'count': 1}), 
  ('sp1', 'col2', {'count': 1}), 
  ('sp1', 'col3', {'count': 1}), 
  ('col1', 'sp2', {'count': 1}), 
  ('col2', 'sp2', {'count': 1}), 
  ('col2', 'sp3', {'count': 1}), 
  ('col3', 'sp3', {'count': 1}), 
  ('sp2', 'col4', {'count': 2}), 
  ('sp2', 'col5', {'count': 2}), 
  ('sp3', 'col4', {'count': 1}) ]    

Create a Collector CoWorking Network (CWN) from a list of collector cliques:

	>>> collectors = [ ['a','b','c'], ['d','e'], ['a','c'] ]
>>> cwn = CoworkingNetwork(cliques=collectors)

>>> cwn.nodes(data=True)
{ 'a': {'count': 2}, 
  'b': {'count': 1}, 
  'c': {'count': 2}, 
  'd': {'count': 1}, 
  'e': {'count': 1} }    

>>> cwn.edges(data=True)
[ ('a', 'b', {'count': 1, 'taxons': None, 'weight_hyperbolic': 0.5}), 
  ('a', 'c', {'count': 2, 'taxons': None, 'weight_hyperbolic': 1.5}), 
  ('b', 'c', {'count': 1, 'taxons': None, 'weight_hyperbolic': 0.5}), 
  ('d', 'e', {'count': 1, 'taxons': None, 'weight_hyperbolic': 1.0}) ]

Install

This package is still experimental, and should ideally be run from a conda virtual environment, which is specified in the environment.yml file. In order to create the virtual environment clone this repository, make sure you have conda installed and use one of the following commands, from the root of the repository:

$ conda env create -f environment.yml

Then you should activate it with the following command:

  • On Linux:

    $ source activate caryocar

  • On Windows:

    $ activate caryocar

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

caryocar-0.0.1.tar.gz (15.7 kB view details)

Uploaded Source

Built Distribution

caryocar-0.0.1-py3-none-any.whl (19.9 kB view details)

Uploaded Python 3

File details

Details for the file caryocar-0.0.1.tar.gz.

File metadata

  • Download URL: caryocar-0.0.1.tar.gz
  • Upload date:
  • Size: 15.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.12.1 pkginfo/1.4.2 requests/2.18.4 setuptools/39.1.0 requests-toolbelt/0.8.0 tqdm/4.28.1 CPython/3.6.5

File hashes

Hashes for caryocar-0.0.1.tar.gz
Algorithm Hash digest
SHA256 a826837ef70f2a7c83443ca048271f2ae1b53f39f9613f28febcb11bff420dae
MD5 04f9bf07b28c6d976088bae0901039c2
BLAKE2b-256 86690cea33e01ddbe656c1064855c7af9bafccdcdec7106cab8066f0053413f1

See more details on using hashes here.

File details

Details for the file caryocar-0.0.1-py3-none-any.whl.

File metadata

  • Download URL: caryocar-0.0.1-py3-none-any.whl
  • Upload date:
  • Size: 19.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.12.1 pkginfo/1.4.2 requests/2.18.4 setuptools/39.1.0 requests-toolbelt/0.8.0 tqdm/4.28.1 CPython/3.6.5

File hashes

Hashes for caryocar-0.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 e410a89432b39697443d2dfbd20ecb12af6fe68b993e76bd88d3221e727335fa
MD5 eff5942341f275d614b1a4f24ad533f4
BLAKE2b-256 d99173bb84c4706c1c0a1c6007c3c925cb88b002e15aaf0a952aaf870745b407

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