This file is indexed.

/usr/share/perl5/GO/Metadata/Panther.pm is in libgo-perl 0.15-1.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

  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
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
package GO::Metadata::Panther;
use strict;
use warnings;
use Exporter;
use Memoize;
use List::Util qw/sum first/;
use Data::Dumper;
use Carp;

use base qw/GO::Metadata::UniProt::Species Exporter/;
our @EXPORT_OK = qw/panther_codes panther_all valid_panther_codes/;


=head1 NAME

GO::Metadata::Panther - Species info for data used by Panther Clusters

=head1 SYNOPSIS

 use GO::Metadata::Panther;
 my $s = GO::Metadata::Panther->code('YEAST');

=head1 DESCRIPTION

Inherits functions from L<GO::Metadata::UniProt::Species>.

Accesses information related to species in the Panther F<seq2pthr.gz>
file.  This file can be fetched from:
L<ftp://ftp.pantherdb.org/genome/pthr7.0/>

=cut

# Information needed but not provided by UniProt's speclist.txt file.

our %species =
  (
   #
   # A
   #

   ANOGA => { prefer => [ qw/ENSEMBL UniProtKB/ ] },
   ARATH => { id_filter => sub {
		  if ($_[0] eq 'gene') {
		      return ('TAIR', "locus:$_[1]");
		  }
		  return @_;
	      }
	    },
   AQUAE => {},
   ASHGO => { also_node => [ 284811 ] },

   #
   # B
   #

   BACSU => {},
   BACTN => {},
   BOVIN => { prefer => [ 'UniProtKB',  'ENSEMBL' ] },
   BRAJA => {},

   #
   # C
   #

   CAEBR => {},
   CAEEL => { prefer => [ 'WB' ],
	      id_filter => sub {
		  $_[0] = 'WB' if ($_[1] =~ m/^WB/);
		  return @_;
	      }
	    },
   CANFA => { prefer => [ 'ENSEMBL' ] },
   CHLTA => {},
   CHLRE => {},
   CHLAA => {},
   CIOIN => { prefer => [ 'ENSEMBL' ] },

   #
   # D
   #

   DANRE => { prefer => [ 'ZFIN', 'ENSEMBL', 'UniProtKB' ] },
   DEIRA => {},
   DICDI => {},
   DROME => { prefer => [ 'FB' ],
	      id_filter => sub {
		  $_[0] = 'FB' if ($_[1] =~ m/^FB/);
		  return @_;
	      }
	    },

   #
   # E
   #

   EMENI => {},
   ENTHI => {},
   ECOLI => { also_node => [ 562, 511145 ],
	      prefer    => [ 'EcoCyc', 'UniProtKB' ] },

   #
   # G
   #

   CHICK => { prefer => [ 'UniProtKB', 'ENSEMBL', 'NCBI' ] },
   GEOSL => {},
   GLOVI => { also_node => [ 251221 ] },


   #
   # H
   #

   HUMAN => { prefer => [ 'UniProtKB', 'ENSEMBL' ] },

   #
   # L
   #

   LEIMA => { also_node => [ 347515 ] },
   LEPIN => {},

   #
   # M
   #

   MACMU => { prefer => [ 'UniProtKB', 'ENSEMBL' ] },
   METAC => {},
   MONDO => { prefer => [ 'ENSEMBL' ] },
   MOUSE => { prefer => [ 'MGI', 'UniProtKB', 'ENSEMBL' ],
	      id_filter => sub {
	      	  if (($_[0] eq 'MGI') and ($_[1] !~ m/^MGI:/)) {
	      	      return ('MGI', "MGI:$_[1]");
	      	  }
	      	  return @_;
	      }
	    },

   #
   # N
   #

   NEUCR => {},

   #
   # O
   #

   ORNAN => { prefer => [ 'ENSEMBL' ] },
   ORYSJ => {},

   #
   # P
   #

   PANTR => { prefer => [ 'ENSEMBL', 'UniProtKB' ] },
   PLAYO => {},
   PSEA7 => {},

   #
   # R
   #

   RAT => {  prefer => [ 'RGD', 'UniProtKB', 'ENSEMBL' ] },

   #
   # S
   #

   YEAST => {},
   SCHPO => {},
   STRCO => {},
   STRPU => {},
   SULSO => {},

   #
   # T
   #

   FUGRU => { is => 'TAKRU' },
   TAKRU => { was => 'FUGRU',
	      prefer => [ 'ENSEMBL' ],
	    },
   TETTH => { also_node => [ 312017 ] },
   THEMA => {},

   #
   # X
   #

   XENTR => { prefer => [ 'UniProtKB', 'ENSEMBL' ] },
);

=head2 Exportable Subroutines

=over

=item panther_codes()

Returns the list of UniProt species codes that are used in Panther clusters.

=cut
sub panther_codes{
    return map {
	defined $species{$_}->{is} ? () : $_;
    } keys %species;
}
sub codes{
    carp "Please use panther_codes() instead of codes()";
    panther_codes(@_);
}


=item GO::Metadata::Panther->panther_all()

Returns a list of C<GO::Metadata::Panther> objects that are used in Panther clusters.

=cut
sub panther_all{
    my $c = shift;
    return $c->new(panther_codes());
}
sub all {
    carp 'Please panther_all() instead if all()';
    return shift()->panther_all(@_);
}

=item valid_codes(...)

Returns a true value in every argument is a UniProt species code used
in Panther cluster.  Otherwise returns false.

=cut
sub valid_panther_codes{
    for my $code (@_) {
	return undef if (!exists $species{$code});
    }
    return '1';
}


=back

=head2 OO Function

=over

=item GO::Metadata::Panther-E<gt>new(...);

This basically hands things off to L<GO::Metadata::UniProt::Species>'s
new function.   Populates that with other Panther/GO specific
information, and does some error correction.

=cut
our %_new_cache;
sub new{
    my $c = shift;

    my @have;
    my @all = map {
	if ($_new_cache{$_}) {
	    push @have, $_new_cache{$_};
	    ();
	} else {
	    $_;
	}
    } @_;

    ##########
    # Fix up also_node entries (see ECOLI)
    @all = map {
	my $all = $_;
	my $out = $all;
	if ($all =~ m/^\d+$/) {
	  BLA:
	    for my $code (keys %species) {
		for my $node (@{ $species{$code}->{also_node} }) {
		    if ($all eq $node) {
			$out = $code;
			last BLA;
		    }
		}
	    }
	}
	$out;
    } @all;
    # This bugs me
    ##########

    @all = map {
	if (!$_->ncbi_taxon_id()) {
	    warn 'Skipping unknown NCBI taxon ID, check: SELECT * FROM species WHERE ncbi_taxa_id=0';
	    ();
	} else {
	    $_;
	}
    } $c->SUPER::new(map {
	if ($species{$_} && $species{$_}->{is}) {
	    warn "$_ -> $species{$_}->{is}";
	    $species{$_}->{is};
	} else {
	    $_;
	}
    } @all) if (scalar @all);

    for (@all) {
	if ($species{$_->code()}) {
	    while (my ($k,$v) = each %{ $species{$_->code} }) {
		$_->{$k} = $v;
	    }
	} else {
	    warn $_->code . ' Not a Panther family.';
	}
    }

    for my $all (@all) {
	$_new_cache{$all->{node}} = $all;
	$_new_cache{$all->{code}} = $all;
    }
    push @all, @have;

    return undef   if (0 == scalar @all);
    return $all[0] if (1 == scalar @all);
    return @all;
}


=item $s->ncbi_taxa_ids()

Returns the list of NCBI taxa identifiers associated with the UniProt
species code.  In a perfect word this will only every return one
value.  In any case, the first value will be the actual numeric
identifier associated.

=cut
sub ncbi_ids{
    my $s = shift;
    my @out = ($s->{node});
    push @out, @{ $s->{also_node} } if ($s->{also_node});
    return @out;
}

=item $s->prefers()

Returns a list of id types (generally to be populated in
C<dbxref.xref_dbname>) in order of preference of use.  If a null list,
we have never encountered a conflict that needed resolving.

=cut
sub prefers{
    my $s = shift;

    if ($s->{prefer}) {
	return @{ $s->{prefer} };
    }
    return qw/UniProtKB/;
}

# this is not fully in use.
sub reject{
    my $s = shift;

    if ($s->{reject}) {
	return @{ $s->{reject} };
    }
    return qw/GeneID/;
}

# sub prefered{
#     my $s = shift;
#     my $v = shift

#     return first { $v eq $_ } $s->preferes();
# }

sub id_filter{
    my $s = shift;
    my ($k, $v) = (shift, shift);
    $k = 'UniProtKB' if ($k =~ m/UniProt/i);

    if ($s->{id_filter}) {
	return &{ $s->{id_filter} }($k, $v);
    }
    return ($k, $v);
}


=back

=head2 SEE ALSO

L<GO::Metadata::UniProt::Species>

=head2 AUTHOR

Sven Heinicke E<lt>sven@genomics.princeton.edu</gt>

=cut

1;