-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathget_id_AnAge.m
49 lines (39 loc) · 950 Bytes
/
get_id_AnAge.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
%% get_id_AnAge
% gets id of AnAge
%%
function id = get_id_AnAge(my_pet, open)
% created 2021/08/03 by Bas Kooijman
%% Syntax
% id = <../get_id_AnAge.m *get_id_Ange*>(my_pet, open)
%% Description
% Gets identifier for Animal Ageing and Longevity Database
%
% Input:
%
% * my_pet: character string with name of a taxon
% * open: optional boolean for opening in browser (default: 0)
%
% Output:
%
% * id: character string with id accepted name in AnAge
%% Remarks
% Outputs empty string if identification was not successful.
%% Example of use
% id = get_id_AnAge('Bufo_bufo',1)
address = 'https://genomics.senescence.info/species/entry.php?species=';
if ~exist('open','var')
open = 0;
end
id = strrep(my_pet,' ','_');
try
check = urlread([address, id]);
if ~isempty(strfind(check, 'not found'))
id = ''; return
end
catch
fprintf('AnAge cannot be reached\n');
id = ''; return
end
if open
web([address, id],'-browser');
end