This repository has been archived by the owner on Dec 22, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathpedigree.m
69 lines (57 loc) · 2.07 KB
/
pedigree.m
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
57
58
59
60
61
62
63
64
65
66
67
68
%% pedigree
% gets classification tree of a taxon
%%
function [tree, nm, val, units, label] = pedigree(taxon, var)
% created 2015/09/18 by Bernd Brandt; modified 2017/12/14 by Bas Kooijman
%% Syntax
% tree = <../pedigree.m *pedigree*> (taxon)
%% Description
% gets a tree of all species in the add_my_pet collection that belong to a
% particular taxon and writes the value of a parameter or statistic behind
% entry names.
%
% Input:
%
% * taxon: optional character string with name of taxon (default 'Animalia')
% * var: character string with parameter or statistic
%
% Output:
%
% * character string with a tree of all species in the add_my_pet collection that belong to that taxon
% * nm: n-cellstring with names of entries (non-empty if var is specified)
% * val: n-vector with values for parameter or statistic (non-empty if var is specified)
% * units: charactore string with units (non-empty if var is specified)
% * label: charactore string with label (non-empty if var is specified)
%% Remarks
% The default root is Animalia.
% If chosen as taxon, a tree of all species in the collection results.
% New lines are written with char(10), tabs with char(9).
% The classification follows that of Wikipedia.
% See <prtStat.html *prtStat*> for lists without tree.
% See <treeview_taxa.html *treeview_taxa*> for an interactive tree in html.
%% Example of use
% tree = pedigree or tree = pedigree('Mollusca') or pedigree('Alcidae', 'p_M')
WD = pwd; % store current path
taxa = which('pedigree.pl'); %
taxa = taxa(1:end - 11); %
cd(taxa) % goto taxa
if ~exist('taxon', 'var')
taxon = 'Animalia';
end
try
tree = perl('pedigree.pl', taxon);
catch
disp('Name of taxon is not recognized')
end
cd(WD) % goto original path
if ~exist('var', 'var')
nm = []; val = []; label = []; units = [];
else
[nm, val, units, label] = prtStat(taxon, var, 0);
n = length(nm);
for i = 1:n
tree = strrep(tree,nm{i},[nm{i}, ' ', num2str(val(i)), ' ', units]);
end
tree = [label, ': ', tree];
end
end