3 See the NOTICE file distributed with
this work
for additional information
4 regarding copyright ownership.
6 Licensed under the Apache License, Version 2.0 (the
"License");
7 you may not use
this file except in compliance with the License.
8 You may obtain a copy of the License at
12 Unless required by applicable law or agreed to in writing, software
13 distributed under the License is distributed on an
"AS IS" BASIS,
14 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 See the License
for the specific language governing permissions and
16 limitations under the License.
20 package XrefParser::GramenePathwayParser;
30 Parse pathway dumps from Gramene. File format (and example data):
33 enzyme_name fatty acid (omega-1)-hydroxylase
38 pathway_name sphingolipid biosynthesis (plants)
42 Ken Youens-Clark E<lt>kclark@cshl.eduE<gt>.
47 use Text::RecordParser::Tab;
48 use base
'XrefParser::BaseParser';
51 my ($self, $args) = @_;
52 my $source_id = $args->{
'source_id'};
53 my $species_id = $args->{
'species_id'};
54 my $files = $args->{
'files'};
55 my $release_file = $args->{
'rel_file'};
56 my $verbose = $args->{
'verbose'};
57 my $file = ref $files eq
'ARRAY' ? shift @$files :
'';
60 printf STDERR
"%s called without a 'files' argument\n%s",
61 __PACKAGE__, Dumper($args);
65 my $p = Text::RecordParser::Tab->new( $file );
67 my $direct_xref_count = 0;
68 while ( my $rec = $p->fetchrow_hashref ) {
69 my $gene = $rec->{
'gene_name'} or next;
71 if ( my $ec = $rec->{
'ec'} ) {
72 my $ec_xref_id = $self->add_xref({
73 source_id => $source_id,
74 species_id => $species_id,
78 info_type =>
'DIRECT',
81 $self->add_direct_xref( $ec_xref_id, $gene,
'Gene',
'DIRECT' );
85 if ( my $pathway_id = $rec->{
'pathway_id'} ) {
86 my $pathway_xref_id = $self->add_xref({
87 source_id => $source_id,
88 species_id => $species_id,
90 label => $rec->{
'pathway_name'},
95 $self->add_direct_xref( $pathway_xref_id, $gene,
'Gene',
'DIRECT' );
100 printf
"Parsed pathway Ids from file '%s,' added %s direct_xrefs\n",
101 $file, $direct_xref_count;