/
lineage.m
44 lines (34 loc) · 1.07 KB
/
lineage.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
%% lineage
% gets list of taxa to which a taxon belongs
%%
function classification = lineage(taxon)
% created 2015/09/18 by Bernd Brandt
%% Syntax
% classification = <../lineage.m *lineage*> (taxon)
%% Description
% gets all taxa in the add_my_pet collection to which a particular taxon belongs
%
% Input:
%
% * character string with name of taxon
%
% Output:
%
% * cell string of ordered taxa to which that taxon belongs, starting with Animalia
%% Remarks
% The root is Animalia.
% The classification follows that of Wikipedia
%% Example of use
% classification = lineage('Gorilla_gorilla')
WD = pwd; % store current path
taxa = which('lineage.pl'); % locate DEBtool_M/taxa/
taxa = taxa(1:end - 10); % path to DEBtool_M/taxa/
cd(taxa) % goto taxa
try
classification = textscan(perl('lineage.pl', taxon), '%s');
classification = classification{1};
catch
disp(['Warning from lineage: Name ', taxon, ' is not recognized as taxon'])
end
cd(WD) % goto original path
end