0.0.58 • Published 4 years ago

globi-data v0.0.58

Weekly downloads
2
License
MIT
Repository
github
Last release
4 years ago

eol-globi-data-js

Build Status Code Climate NPM NPM

A javascript libray to help find out what species interact (e.g. eats, is eaten by) with. Data provided via Global Biotic Interactions (GloBI, https://globalbioticinteractions.org).

example

If you'd like to see more that the samples below, please see test/ and example/ directories.

var consoleDiv = document.getElementById('console');

// lookup some species by some string 'sea otter'
var closeMatchCallback = function(closeMatches) {
    closeMatches.forEach(function(closeMatch){
        // log scientific names of matches
        console.log(closeMatch.scientificName);
        var p = document.createElement('p');
        p.innerHTML = 'close match for sea otter [' + closeMatch.scientificName + ']';
        consoleDiv.appendChild(p);
    });
};
globiData.findCloseTaxonMatches('sea otter', closeMatchCallback);

// find out what a sea otter (Enhydra lutris) eats. . .
var search =  {sourceTaxonScientificName: 'Enhydra lutris', interactionType: 'preysOn'};
var callback = function(interactions) {
    interactions.forEach(function(interaction) {
        var p = document.createElement('p');
        p.innerHTML = '[' + interaction.source.name  + '] preys on ['  + interaction.target.name + ']';
        consoleDiv.appendChild(p);
    });
};
globiData.findSpeciesInteractions(search, callback);

// lookup some more info (including image urls) about the sea otter
var infoCallback = function(taxonInfo) {
    var name = taxonInfo.commonName + ' (<i>' + taxonInfo.scientificName + '</i>)';
    var infoDiv = document.createElement('div');
    infoDiv.innerHTML = '<table class="image"><caption align="bottom">' + name + '</caption>'
            + '<tr><td><img src="' + taxonInfo.thumbnailURL + '"/></td></tr></table>';
    consoleDiv.appendChild(infoDiv);
};
globiData.findTaxonInfo('Enhydra lutris', infoCallback);

Build Status

usage

Make sure to include eol-globi-data-js in your project / page.

Node Package Manager (NPM)

var globiData = require('globi-data');

for example node project that uses globi-data see: http://github.com/jhpoelen/eol-globi-js .

Directly into html

include globi-data-dist.js in your web resources and include using script tag.

...
<script src="globi-data-dist.js" charset="utf-8">
...

For example web project, see github repository http://github.com/eol-globi/eol-globi.github.io that is deployed using github pages here: http://eol-globi.github.io .

methods

globiData.findInteractionTypes(callback)

Returns available interaction types.

globiData.findSpeciesInteractions(searchOptions, callback)

Provides a list of interactions to callback specific to search options. Possible search options are:

  1. sourceTaxonScientificName

  2. targetTaxonScientificName

  3. interactionType

  4. lat / lng: latitude, longitude of interactions.

  5. nw_lat, nw_lng, se_lat, se_lng: spatial rectangle specified by north west and south east positions:

    nw(lat,lng) ------  ne
    |                    |
    |                    |
    sw ----------------se(lat,lng)

    an example of search options, where we'd like to find the prey of Hardhead Catfish (Ariopsis felis) in a specific area:

    options = {sourceTaxonScientificName: 'Ariopsis felis',
               interactionType: 'preysOn',
               nw_lat:30.52, nw_lng:-99.51, se_lat: 20.52, se_lng:-82.75}

    or example of search options, where we'd like to find which Arthropods (Arthropoda) of Hardhead Catfish (Ariopsis felis) in a specific area:

     options = {sourceTaxonScientificName: 'Ariopsis felis',
                  targetTaxonScientificName: 'Arthropoda'
                interactionType: 'preysOn',
                nw_lat:30.52, nw_lng:-99.51, se_lat: 20.52, se_lng:-82.75}

    example of returned interactions: two interactions where Hardhead Catfish (Ariopsis felis) eats Chordates (Chordata) and Palaemonid Shrimps (Palaemonidae):

    [
       {
           "source":{"name":"Ariopsis felis"},
           "target":{"name":"Chordata"},
           "type":"preysOn"
       },
       {
           "source":{"name":"Ariopsis felis"},
           "target":{"name":"Palaemonidae"},
           "type":"preysOn"
       }
    ]

    globiData.findCloseTaxonMatches(searchString, callback)

    Find close taxonomic (organism, species names) matches to provided input string.

For instance, close taxonomic matches with search string sea ottr are:

{ [{scientificName: 'Enhydra lutris',
    commonNames: [ { name: 'Seeotter', lang: 'de' },{ name: 'sea otter', lang: 'en'} ],
     path: ['Animalia', 'Chordata', 'Mammalia', 'Carnivora', 'Mustelidae', 'Enhydra', 'Enhydra lutris']},
   ...]

globiData.findSources(callback)

Find the sources that contributed one or more studies. Result is a list of string.

// example of results

globiData.findStudyStats(search, callback)

Find statistics about individual studies that contributed interaction datasets to GloBI. Optionally, you can provide a source variable in the search object to limit studies to a specific source.

// stats for only SPIRE studies
var search = { source: 'SPIRE' }
var callback = function(statList) {
    console.log('study statistics:' + statList);
}
globi.findStudyStats(search, callback);

// stats for all studies, notice the empty search option object
globi.findStudyStats({}, callback);

example of information retrieved:

[ { reference: 'Nick Fotheringham Effects of Offshore Oil Field Structures on Their Biotic Environment: Benthos and Plankton',
totalInteractions: 138,
totalSourceTaxa: 23,
totalTargetTaxa: 28 },
{ reference: 'Christian RR, Luczkovich JJ (1999) Organizing and understanding a winter\'s seagrass foodweb network through effective trophic levels. Ecol Model 117:99-124',
totalInteractions: 270,
totalSourceTaxa: 82,
totalTargetTaxa: 85 } ]

globiData.findStats(search, callback)

Find statistics across all datasets. Optionally you can limit the statistics to studies contributed by a specific source.

// stats for only SPIRE studies
var search = { source: 'SPIRE' }
var callback = function(stats) {
    console.log('aggregate statistics:' + statList);
}
globi.findStats(search, callback);

// stats aggregated across all studies, notice the empty search option object
globi.findStats({}, callback);

example of resulting statistics object:

{ numberOfStudies: 251, totalInteractions: 431842, totalSourceTaxa: 10194, totalTargetTaxa: 19477 }
0.0.58

4 years ago

0.0.57

5 years ago

0.0.56

5 years ago

0.0.55

5 years ago

0.0.54

7 years ago

0.0.53

7 years ago

0.0.52

7 years ago

0.0.51

7 years ago

0.0.50

7 years ago

0.0.49

7 years ago

0.0.48

7 years ago

0.0.47

7 years ago

0.0.46

8 years ago

0.0.45

8 years ago

0.0.44

9 years ago

0.0.43

9 years ago

0.0.41

9 years ago

0.0.40

9 years ago

0.0.39

9 years ago

0.0.38

9 years ago

0.0.37

9 years ago

0.0.36

9 years ago

0.0.35

9 years ago

0.0.34

9 years ago

0.0.33

9 years ago

0.0.32

9 years ago

0.0.31

9 years ago

0.0.30

9 years ago

0.0.29

9 years ago

0.0.28

9 years ago

0.0.27

9 years ago

0.0.26

9 years ago

0.0.25

9 years ago

0.0.24

9 years ago

0.0.23

10 years ago

0.0.22

10 years ago

0.0.21

10 years ago

0.0.20

10 years ago

0.0.19

10 years ago

0.0.18

10 years ago

0.0.17

10 years ago

0.0.16

10 years ago

0.0.15

10 years ago

0.0.14

10 years ago

0.0.13

10 years ago

0.0.12

10 years ago

0.0.11

11 years ago

0.0.10

11 years ago

0.0.9

11 years ago

0.0.8

11 years ago

0.0.6

11 years ago

0.0.5

11 years ago

0.0.4

11 years ago

0.0.3

11 years ago

0.0.2

11 years ago

0.0.1

11 years ago