Mangal.jl - Introduction

import PkgPkg.activate(".")Pkg.add("Mangal")Pkg.add("EcologicalNetworks")import Mangalusing EcologicalNetworksCompter le nombre de réseaux qui sont disponibles
count(Mangal.MangalNetwork)count(Mangal.MangalDataset)count(Mangal.MangalReferenceTaxon)On va chercher un dataset qui contient un terme spécifique
havens_dataset = Mangal.datasets("q" => "havens")[1]Combien de réseaux dans ce jeu de données ?
count(Mangal.MangalNetwork, havens_dataset)On veut récupérer ces réseaux
havens_networks = Mangal.networks(havens_dataset)On veut les interactions entre les différentes espèces
count(Mangal.MangalInteraction, havens_networks[50])Convertir un MangalNetwork en EcologicalNetworks
N1 = convert(UnipartiteNetwork, havens_networks[1])Chaque noeud contient des metadata
species(N1)species(N1)[1].taxon.gbifOn peut maintenant compter les motifs
?find_motiffind_motif(N::T1, m::T2) where {T1<:AbstractEcologicalNetwork, T2<:BinaryNetwork}
Returns an array of tuples, in which each tuple contains the species that are part of the motif. The length of the array gives the number of times the motif was found. For probabilistic networks, the tuple also contains the probability of observing the species in the correct conformation for the motif, as well as the variance.
References
Milo, R., Shen-Orr, S., Itzkovitz, S., Kashtan, N., Chklovskii, D., Alon, U.,
Network motifs: simple building blocks of complex networks. Science 298,
824–7. https://doi.org/10.1126/science.298.5594.824
Poisot, T., Cirtwill, A.R., Cazelles, K., Gravel, D., Fortin, M.-J., Stouffer, D.B., 2016. The structure of probabilistic networks. Methods in Ecology and Evolution 7, 303–312. https://doi.org/10.1111/2041-210X.12468
On peut créer notre propre motif
linear_food_chain = UnipartiteNetwork([false true false; false false true; false false false])On peut maintenant chercher notre motif dans le réseau N1
list_sp = find_motif(N1, linear_food_chain)list_sp[1]On peut extraire le sous-graph formé par ces trois espèces.
N1[list_sp[1]...]using LinearAlgebraN1[list_sp[1]...].A |> diagnodiagonal(N1[list_sp[1]...]).ACombien de chaînes trophiques linéaires
 length(find_motif(N1, linear_food_chain))