-
Notifications
You must be signed in to change notification settings - Fork 0
/
suppmat.Jmd
57 lines (51 loc) · 1.75 KB
/
suppmat.Jmd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
---
title: Supplementary material
---
~~~julia; echo=false
using DataFrames
using CSV: CSV
using Latexify
using LaTeXStrings
~~~
This table lists the full interactions in the curated predicted Canadian
metaweb, and indicates the probability based on the phylogenetic model,
the interaction of the species pairs in Europe, and the interaction of the
species pairs in the GLOBI and Newfoundland (SL) dataset.
~~~julia; echo=false
glnew = DataFrame(CSV.File("artifacts/globi_diet.csv"))
rename!(glnew, :from => :Predator)
rename!(glnew, :to => :Prey)
glnew.GLOBI = fill(true, size(glnew, 1));
slnew = DataFrame(CSV.File("artifacts/newfoundland.csv"))
rename!(slnew, :from => :Predator)
rename!(slnew, :to => :Prey)
slnew.Newfoundland = fill(true, size(slnew, 1));
rename!(slnew, :Newfoundland => Symbol("SL"));
~~~
~~~julia; echo=false, results="hidden"
colfor(x::Missing) = ""
colfor(x::Bool) = x ? "+" : ""
function genusize(x::String)
g, s = split(x, " ")
return "*$(g) $(s)*"
end
~~~
~~~julia; echo=false
cm = DataFrame(CSV.File("artifacts/canadian_thresholded.csv"))
cmu = DataFrame(CSV.File("artifacts/canadian_uncorrected.csv"))
select!(cmu, [:from, :to, :int])
cm = leftjoin(cm, cmu, on=[:from => :from, :to => :to])
sort!(cm, [:from, :to])
rename!(cm, :from => :Predator)
rename!(cm, :to => :Prey)
rename!(cm, :score => Symbol("\$P(i,j)\$"))
cm = leftjoin(cm, slnew, on=[:Predator => :Predator, :Prey => :Prey])
cm = leftjoin(cm, glnew, on=[:Predator => :Predator, :Prey => :Prey])
cm.SL = [colfor(x) for x in cm.SL]
cm.GLOBI = [colfor(x) for x in cm.GLOBI]
cm.int = [colfor(x) for x in cm.int]
rename!(cm, :int => Symbol("Europe"))
cm.Predator = [genusize(x) for x in cm.Predator]
cm.Prey = [genusize(x) for x in cm.Prey]
latexify(cm, latex=false, env=:mdtable)
~~~