line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Bio::Tools::EUtilities::Link::UrlLink; |
2
|
|
|
|
|
|
|
$Bio::Tools::EUtilities::Link::UrlLink::VERSION = '1.77'; |
3
|
7
|
|
|
7
|
|
49
|
use utf8; |
|
7
|
|
|
|
|
13
|
|
|
7
|
|
|
|
|
36
|
|
4
|
7
|
|
|
7
|
|
240
|
use base qw(Bio::Root::Root Bio::Tools::EUtilities::EUtilDataI); |
|
7
|
|
|
|
|
13
|
|
|
7
|
|
|
|
|
5680
|
|
5
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
# ABSTRACT: Class for EUtils UrlLinks. |
7
|
|
|
|
|
|
|
# AUTHOR: Chris Fields |
8
|
|
|
|
|
|
|
# OWNER: 2006-2013 Chris Fields |
9
|
|
|
|
|
|
|
# LICENSE: Perl_5 |
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
|
13
|
2
|
|
|
2
|
1
|
1112
|
sub get_dbfrom { return shift->{'_dbfrom'}; } |
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
|
16
|
2
|
|
|
2
|
1
|
11
|
sub get_attribute { return shift->{'_attribute'}; } |
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
|
19
|
2
|
|
|
2
|
1
|
12
|
sub get_icon_url { return shift->{'_iconurl'}; } |
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
|
22
|
2
|
|
|
2
|
1
|
10
|
sub get_subject_type { return shift->{'_subjecttype'}; } |
23
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
sub get_url { |
26
|
2
|
|
|
2
|
1
|
5
|
my $self = shift; |
27
|
|
|
|
|
|
|
# fix Entrz LinkOut URLS without the full URL |
28
|
2
|
50
|
33
|
|
|
23
|
if ($self->{'_url'} && $self->{'_url'} =~ m{^/}) { |
29
|
0
|
|
|
|
|
0
|
$self->{'_url'} = 'https://www.ncbi.nih.gov'.$self->{'_url'}; |
30
|
|
|
|
|
|
|
} |
31
|
2
|
|
|
|
|
9
|
return $self->{'_url'}; |
32
|
|
|
|
|
|
|
} |
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
|
35
|
2
|
|
|
2
|
1
|
10
|
sub get_link_name { return shift->{'_linkname'}; } |
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
|
38
|
2
|
|
|
2
|
1
|
10
|
sub get_provider_name { return shift->{'_provider_name'}; } |
39
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
|
41
|
2
|
|
|
2
|
1
|
12
|
sub get_provider_abbr { return shift->{'_provider_nameabbr'}; } |
42
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
|
44
|
2
|
|
|
2
|
1
|
11
|
sub get_provider_id { return shift->{'_provider_id'}[0]; } |
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
|
47
|
2
|
|
|
2
|
1
|
9
|
sub get_provider_icon_url { return shift->{'_provider_iconurl'}; } |
48
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
|
50
|
2
|
|
|
2
|
1
|
10
|
sub get_provider_url { return shift->{'_provider_url'}; } |
51
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
# private method |
53
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
sub _add_data { |
55
|
6
|
|
|
6
|
|
12
|
my ($self, $data) = @_; |
56
|
6
|
50
|
|
|
|
14
|
if (exists $data->{Provider}) { |
57
|
30
|
|
|
|
|
77
|
map {$self->{'_provider_'.lc $_} = $data->{Provider}->{$_}; |
58
|
6
|
|
|
|
|
10
|
} keys %{$data->{Provider}}; |
|
6
|
|
|
|
|
18
|
|
59
|
6
|
|
|
|
|
19
|
delete $data->{Provider}; |
60
|
|
|
|
|
|
|
} |
61
|
6
|
50
|
|
|
|
15
|
map {$self->{'_'.lc $_} = $data->{$_} if $data->{$_}} keys %$data; |
|
30
|
|
|
|
|
123
|
|
62
|
|
|
|
|
|
|
} |
63
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
sub to_string { |
66
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
67
|
0
|
|
0
|
|
|
|
my $level = shift || 0; |
68
|
0
|
|
|
|
|
|
my $pad = 20 - $level; |
69
|
|
|
|
|
|
|
# order method name |
70
|
0
|
|
|
|
|
|
my %tags = (1 => ['get_link_name' => 'Link Name'], |
71
|
|
|
|
|
|
|
2 => ['get_subject_type' => 'Subject Type'], |
72
|
|
|
|
|
|
|
3 => ['get_dbfrom' => 'DB From'], |
73
|
|
|
|
|
|
|
4 => ['get_attribute' => 'Attribute'], |
74
|
|
|
|
|
|
|
6 => ['get_icon_url' => 'IconURL'], |
75
|
|
|
|
|
|
|
7 => ['get_url' => 'URL'], |
76
|
|
|
|
|
|
|
8 => ['get_provider_name' => 'Provider'], |
77
|
|
|
|
|
|
|
9 => ['get_provider_abbr' => 'ProvAbbr'], |
78
|
|
|
|
|
|
|
10 => ['get_provider_id' => 'ProvID'], |
79
|
|
|
|
|
|
|
11 => ['get_provider_url' => 'ProvURL'], |
80
|
|
|
|
|
|
|
12 => ['get_provider_icon_url' => 'ProvIcon'], |
81
|
|
|
|
|
|
|
); |
82
|
0
|
|
|
|
|
|
my $string = ''; |
83
|
0
|
|
|
|
|
|
for my $tag (sort {$a <=> $b} keys %tags) { |
|
0
|
|
|
|
|
|
|
84
|
0
|
|
|
|
|
|
my ($m, $nm) = ($tags{$tag}->[0], $tags{$tag}->[1]); |
85
|
0
|
|
|
|
|
|
my $content = $self->$m(); |
86
|
0
|
0
|
|
|
|
|
next unless $content; |
87
|
0
|
|
|
|
|
|
$string .= $self->_text_wrap( |
88
|
|
|
|
|
|
|
sprintf("%-*s%-*s:",$level, '',$pad, $nm,), |
89
|
|
|
|
|
|
|
' ' x ($pad).':', |
90
|
|
|
|
|
|
|
$content)."\n"; |
91
|
|
|
|
|
|
|
} |
92
|
0
|
|
|
|
|
|
return $string; |
93
|
|
|
|
|
|
|
} |
94
|
|
|
|
|
|
|
|
95
|
|
|
|
|
|
|
1; |
96
|
|
|
|
|
|
|
|
97
|
|
|
|
|
|
|
__END__ |