-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathget_id.m
216 lines (202 loc) · 10.2 KB
/
get_id.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
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
%% get_id
% gets id's of all AmP-supported websites
%%
function [id, id_txt, my_pet_acc] = get_id(my_pet, open, tab)
% created 2021/08/3 by Bas Kooijman, modified 2024/09/14
%% Syntax
% [id, id_txt, my_pet_acc] = <../get_id.m *get_id*>(my_pet, open, tab)
%% Description
% Gets identifiers for all websites that AmP uses for this taxon.
% Some websites apply to all animals, others only for particular taxa.
% The lineage is taken from CoL till 2024/09, then after from Taxo.
% CoL no longer supports automatized searching; insert the species-name in the search-field of the CoL-site that is opened in your browser and
% copy the id in the address field (top-line of your browser) to Matlab.
% ITIS also changed, and no longer supports taxon id's as it seems. AmP will remove the links to ITIS soon.
%
% Input:
%
% * my_pet: character string with name of a taxon
% * open: optional boolean for opening sites in browser (default: 0)
% * tab: optional boolean for opening table in browser (default: 0)
%
% Output:
%
% * id: vector of cells with id's
% * id_txt: vector of cells with labels for id's
% * my_pet_acc: name of accepted species (_ separated)
%% Remarks
% Outputs empty id strings if identification was not successful.
%% Example of use
% get_id('Passer_domesticus', 1, 1)
if ~exist('open','var')
open = 0;
end
if ~exist('tab','var')
tab = 0;
end
links = {...
% general links
'https://www.catalogueoflife.org/col/'; ...
'https://www.itis.gov/'; ...
'https://eol.org/'; ...
'https://en.wikipedia.org/wiki/'; ...
'https://animaldiversity.org/'; ...
'http://taxonomicon.taxonomy.nl/'; ...
'https://marinespecies.org/'; ...
% taxon-specific links
'https://www.molluscabase.org/'; ...
'https://www.ntnu.no/ub/scorpion-files/'; ...
'https://wsc.nmbe.ch/'; ...
'https://www.collembola.org/'; ...
'http://Orthoptera.SpeciesFile.org'; ...
'http://phasmida.speciesfile.org/'; ...
'http://aphid.speciesfile.org/'; ...
'https://diptera.info/'; ...
'http://www.nhm.ac.uk/our-science/data/lepindex/'; ...
'https://www.fishbase.se/summary/'; ...
'https://amphibiaweb.org/search/'; ...
'https://reptile-database.reptarium.cz/'; ...
'https://avibase.bsc-eoc.org/'; ...
'http://datazone.birdlife.org/'; ...
'https://www.departments.bucknell.edu/biology/resources/msw3/'; ...
'https://genomics.senescence.info/'};
address = { ...
% general addresses
'https://www.catalogueoflife.org/data/taxon/'
'https://www.itis.gov/servlet/SingleRpt/SingleRpt?search_topic=TSN&search_value='
'https://eol.org/pages/'
'https://en.wikipedia.org/wiki/'
'https://animaldiversity.org/accounts/'
'http://taxonomicon.taxonomy.nl/TaxonTree.aspx?id='
'https://marinespecies.org/aphia.php?p=taxdetails&id='
% taxon-specific addresses
'https://www.molluscabase.org/aphia.php?p=taxdetails&id='
'https://www.ntnu.no/ub/scorpion-files/'
'https://wsc.nmbe.ch/species/'
'https://www.collembola.org/taxa/'
'http://orthoptera.speciesfile.org/HomePage/Orthoptera/HomePage.aspx'
'http://phasmida.speciesfile.org/HomePage/Phasmida/HomePage.aspx'
'http://lsid.speciesfile.org/urn:lsid:Aphid.speciesfile.org:TaxonName:'
'https://diptera.info/search.php?stext=id_diptera&search=Search&method=OR&forum_id=0&stype=photos'
'http://www.nhm.ac.uk/our-science/data/lepindex/detail/?taxonno='
'https://www.fishbase.de/summary/'
'https://amphibiaweb.org/cgi/amphib_query?rel-common_name=like&where-scientific_name='
'https://reptile-database.reptarium.cz/species?'
'https://avibase.bsc-eoc.org/species.jsp?lang=EN&avibaseid='
'http://datazone.birdlife.org/species/factsheet/'
'https://www.departments.bucknell.edu/biology/resources/msw3/browse.asp?s=y&id='
'https://genomics.senescence.info/species/entry.php?species='};
my_pet = strrep(my_pet, ' ', '_');
% [lin, rank, id_CoL, name_status, my_pet_acc] = lineage_CoL(my_pet);
% if isempty(id_CoL)
% id = ''; id_txt = ''; return
% else
% if ~strcmp(name_status,'accepted name')
% if contains(my_pet_acc,'(')
% my_pet_acc = my_pet; % don't replace name if subgenus is part of the accepted name
% elseif ~strcmp(my_pet, my_pet_acc)
% fprintf(['Warning from get_id: status of ', my_pet, ' is ', name_status, '; continue with accepted name ', my_pet_acc, '\n'])
% end
% end
% end
[~, ~, lin, rank] = lineage_Taxo(my_pet);
select_id(1:7) = true; id = cell(23,1); id_txt = cell(23,1);
my_pet_acc = my_pet;
web 'https://www.catalogueoflife.org/data/search?facet=rank&facet=issue&facet=status&facet=nomStatus&facet=nameType&facet=field&facet=authorship&facet=extinct&facet=environment&limit=50&offset=0&sortBy=taxonomic' -browser
id{1} = input("id_CoL (between strophs): "); id_txt{1} = 'id_CoL';
id{2} = get_id_ITIS(my_pet_acc); id_txt{2} = 'id_ITIS';
if isempty(id{2}) && ~strcmp(my_pet,my_pet_acc); id{2} = get_id_ITIS(my_pet); end
id{3} = get_id_EoL(my_pet_acc); id_txt{3} = 'id_EoL';
if isempty(id{3}) && ~strcmp(my_pet,my_pet_acc); id{3} = get_id_EoL(my_pet); end
id{4} = get_id_Wiki(my_pet_acc); id_txt{4} = 'id_Wiki';
if isempty(id{4}) && ~strcmp(my_pet,my_pet_acc); id{4} = get_id_Wiki(my_pet); end
id{5} = get_id_ADW(my_pet_acc); id_txt{5} = 'id_ADW';
if isempty(id{5}) && ~strcmp(my_pet,my_pet_acc); id{5} = get_id_ADW(my_pet); end
id{6} = get_id_Taxo(my_pet_acc); id_txt{6} = 'id_Taxo';
if isempty(id{6}) && ~strcmp(my_pet,my_pet_acc); id{6} = get_id_Taxo(my_pet); end
id{7} = get_id_WoRMS(my_pet_acc); id_txt{7} = 'id_WoRMS';
if isempty(id{7}) && ~strcmp(my_pet,my_pet_acc); id{7} = get_id_WoRMS(my_pet); end
select_id(8:23) = false;
if ismember(lin(ismember(rank,'Phylum')), 'Mollusca')
select_id(8) = true;
id{7} = get_id_molluscabase(my_pet_acc); id_txt{8} = 'id_molluscabase';
if isempty(id{8}) && ~strcmp(my_pet,my_pet_acc); id{8} = get_id_molluscabase(my_pet); end
elseif ismember(lin(ismember(rank,'Order')), 'Scorpiones')
select_id(9) = true;
id{9} = get_id_scorpion(my_pet_acc); id_txt{9} = 'id_scorpion';
if isempty(id{9}) && ~strcmp(my_pet,my_pet_acc); id{9} = get_id_scorpion(my_pet); end
elseif ismember(lin(ismember(rank,'Order')), 'Araneae')
select_id(10) = true;
id{10} = get_id_spider(my_pet_acc); id_txt{10} = 'id_spider';
if isempty(id{10}) && ~strcmp(my_pet,my_pet_acc); id{10} = get_id_spider(my_pet); end
elseif ismember(lin(ismember(rank,'Class')), 'Entognatha')
select_id(11) = true;
id{11} = get_id_collembola(my_pet_acc); id_txt{11} = 'id_collembola';
if isempty(id{11}) && ~strcmp(my_pet,my_pet_acc); id{11} = get_id_collembola(my_pet); end
elseif ismember(lin(ismember(rank,'Order')), 'Orthoptera')
select_id(12) = true;
id{12} = get_id_orthoptera(my_pet_acc); id_txt{12} = 'id_orthoptera';
if isempty(id{12}) && ~strcmp(my_pet,my_pet_acc); id{12} = get_id_orthoptera(my_pet); end
elseif ismember(lin(ismember(rank,'Order')), 'Phasmatodea')
select_id(13) = true;
id{13} = get_id_phasmida(my_pet_acc); id_txt{13} = 'id_phasmida';
if isempty(id{13}) && ~strcmp(my_pet,my_pet_acc); id{13} = get_id_phasmida(my_pet); end
elseif ismember(lin(ismember(rank,'Family')), 'Aphididae')
select_id(14) = true;
id{14} = get_id_aphid(my_pet_acc); id_txt{14} = 'id_aphid';
if isempty(id{14}) && ~strcmp(my_pet,my_pet_acc); id{14} = get_id_aphid(my_pet); end
elseif ismember(lin(ismember(rank,'Order')), 'Diptera')
select_id(15) = true;
id{15} = get_id_diptera(my_pet_acc); id_txt{15} = 'id_diptera';
if isempty(id{15}) && ~strcmp(my_pet,my_pet_acc); id{15} = get_id_diptera(my_pet); end
address{15} = strrep(address{15}, 'id_diptera', id{15});
elseif ismember(lin(ismember(rank,'Order')), 'Lepidoptera')
select_id(16) = true;
id{8} = get_id_diptera(my_pet_acc); id_txt{16} = 'id_lepidoptera';
if isempty(id{16}) && ~strcmp(my_pet,my_pet_acc); id{16} = get_id_lepidoptera(my_pet); end
address{16} = strrep(address{16}, 'id_diptera', id{16});
elseif ismember(lin(ismember(rank,{'Class','Gigaclass'})), {'Cephalaspidomorphi', 'Myxini', 'Cyclostomata', 'Chondrichthyes', 'Actinopterygii', 'Actinistia', 'Dipnoi'})
select_id(17) = true;
id{17} = get_id_fishbase(my_pet_acc); id_txt{17} = 'id_fishbase';
if isempty(id{17}) && ~strcmp(my_pet,my_pet_acc); id{17} = get_id_fishbase(my_pet); end
elseif ismember(lin(ismember(rank,'Class')), 'Amphibia')
select_id(18) = true;
id{18} = get_id_amphweb(my_pet_acc); id_txt{18} = 'id_amphweb';
if isempty(id{18}) && ~strcmp(my_pet,my_pet_acc); id{18} = get_id_amphweb(my_pet); end
elseif ismember(lin(ismember(rank,'Class')), {'Reptilia','Squamata','Testudines','Crocodilia'})
select_id(19) = true;
id{19} = get_id_ReptileDB(my_pet_acc); id_txt{19} = 'id_ReptileDB';
if isempty(id{19}) && ~strcmp(my_pet,my_pet_acc); id{19} = get_id_ReptileDB(my_pet); end
elseif ismember(lin(ismember(rank,'Class')), 'Aves')
select_id(20:21) = true;
id{20} = get_id_avibase(my_pet_acc); id_txt{20} = 'id_avibase';
id{21} = get_id_birdlife(my_pet_acc); id_txt{21} = 'id_birdlife';
if isempty(id{20}) && ~strcmp(my_pet,my_pet_acc); id{20} = get_id_avibase(my_pet); end
if isempty(id{21}) && ~strcmp(my_pet,my_pet_acc); id{21} = get_id_birdlife(my_pet); end
elseif ismember(lin(ismember(rank,'Class')), 'Mammalia')
select_id(22) = true;
id{22} = get_id_MSW3(my_pet_acc); id_txt{22} = 'id_msw3';
if isempty(id{22}) && ~strcmp(my_pet,my_pet_acc); id{22} = get_id_MSW3(my_pet); end
elseif ismember(lin(ismember(rank,'Class')), {'Amphibia','Reptilia','Squamata','Testudines','Crocodilia','Aves','Mammalia'})
select_id(23) = true;
id{23} = get_id_AnAge(my_pet_acc); id_txt{23} = 'id_AnAge';
if isempty(id{23}) && ~strcmp(my_pet,my_pet_acc); id{23} = get_id_AnAge(my_pet); end
end
id = id(select_id); id_txt = id_txt(select_id);
ind = 1:23; ind = ind(select_id); n = length(id);
if open
for i = 1:n
if isempty(id{i})
web(links{ind(i)},'-browser');
else
if strfind(address{ind(i)}, 'diptera')
web(strrep(address{15}, 'id_diptera', id{i}),'-browser');
else
web([address{ind(i)}, id{i}],'-browser');
end
end
end
end
if tab
prt_tab({id_txt, id}, {'id','code'},'id')
end