/usr/share/perl5/GO/Parsers/ncbi_taxon_names_parser.pm is in libgo-perl 0.15-5.
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 | # $Id: ncbi_taxon_names_parser.pm,v 1.2 2004/11/24 02:28:02 cmungall Exp $
#
#
# see also - http://www.geneontology.org
# - http://www.godatabase.org/dev
#
# You may distribute this module under the same terms as perl itself
package GO::Parsers::ncbi_taxon_names_parser;
=head1 NAME
GO::Parsers::ncbi_taxon_names_parser - OBO Flat file parser object
=head1 SYNOPSIS
do not use this class directly; use GO::Parser
=cut
=head1 DESCRIPTION
=cut
use Exporter;
use Text::Balanced qw(extract_quotelike extract_bracketed);
use base qw(GO::Parsers::base_parser);
use Carp;
use FileHandle;
use strict qw(subs vars refs);
sub parse_fh {
my ($self, $fh) = @_;
my @stags = ();
my $curr_id;
$self->start_event('taxon_set');
while (<$fh>) {
chomp;
my @vals = split(/\s*\|\s*/,$_);
my ($id,$val,$xx,$tag) = @vals;
if ($curr_id && $id != $curr_id) {
$self->event(taxon=>[
[id=>$curr_id],
@stags
]);
@stags = ();
}
$tag = lc($tag);
$tag =~ s/\s/_/g;
$tag =~ tr/a-z0-0_//cd;
push(@stags, [$tag=>$val]);
if ($tag eq 'scientific_name') {
# lump subspecies in with species;
# eg genus=Homo, species=sapiens neanderthalensis
my ($genus,$species) = ($val =~ /^(\S+)\s+(.*)/);
push(@stags, [genus=>$genus],[species=>$species]);
}
$curr_id = $id;
}
$self->event(taxon=>[
[id=>$curr_id],
@stags
]);
$self->end_event('taxon_set');
return;
}
1;
|