# Introduction to Mangal.jl

The goal of this vignette is to explain the core design principles of the Mangal package. Other vignettes present more realistic use-cases.

using Mangal

## Database status

ObjectTotal number
Datasets172
Networks1386
Interactions128331
Nodes28408
Reference taxon6874

## Types

The package exposes resources from the <mangal.io> database in a series of types, whose fields are all documented in the manual. Every object in the mangal.io hierarchy is represented by its type:

objecttypedefinition
datasetMangalDatasetdescription of a dataset, and references
networkMangalNetworkfiner description of a network, including positions
interactionsMangalInteractiontaxonomic entities involved and metadata
nodeMangalNodedescription of the node in the original dataset
backboneMangalReferenceTaxonactual taxonomic entity reconciled against backbones
referenceMangalReferencebibliographic information
attributeMangalAttributekey/value (used e.g. for interaction strength)

## A note on speed

The package is designed to facilitate the user experience: as objects are nested within one another, we will retrieve the full hierarchy instead of just pointing you to the id of the parent/childrens. For example, this means than querying a MangalInteraction will return not only the interaction itself, but also the MangalNode for each species involved and their MangalReferenceTaxon. This results in a larger number of queries, i.e. you initially wait longer to get your data.

One clear advantage is that the data that are returned are complete, and so can be used directly. Note also that the package uses a caching mechanism to speed up this process; in short, a MangalNode or MangalReferenceTaxon are only queried one, and then read from cache when they are next part of an interaction.

## Queries

Almost all functions in the package accept query arguments, which are simply given as a series of pairs.