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 Please email comments or questions to the
public Ensembl
21 developers list at <http:
23 Questions may also be sent to the Ensembl help desk at
28 Bio::EnsEMBL::Xref::Parser::ZFINDescParser
32 A parser
class to parse the ZFIN file for descriptions.
34 -species = danio_rerio
38 -columns = [acc desc label ignored ignored]
42 my $parser = Bio::EnsEMBL::Xref::Parser::ZFINDescParser->new(
45 files => [
'zfin_genes.txt'],
55 package XrefParser::ZFINDescParser;
71 my ($self, $ref_arg) = @_;
73 my $source_id = $ref_arg->{source_id};
74 my $species_id = $ref_arg->{species_id};
75 my $files = $ref_arg->{files};
76 my $verbose = $ref_arg->{verbose}
78 if ( (!defined $source_id) || (!defined $species_id) || (!defined $files) ) {
79 confess
"Need to pass source_id, species_id and files as pairs";
82 my $file = @{$files}[0];
85 #ZDB-GENE-050102-6 WITHDRAWN:zgc:92147 WITHDRAWN:zgc:92147 0
86 #ZDB-GENE-060824-3 apobec1 complementation factor a1cf 0
87 #ZDB-GENE-090212-1 alpha-2-macroglobulin-like a2ml 15 ZDB-PUB-030703-1
93 my $file_io = $self->get_filehandle($file);
95 if ( !defined $file_io ) {
96 confess
"Can't open ZFINDesc file '$file'\n";
99 my $input_file = Text::CSV->new({
103 }) or confess
"Cannot use file '$file': " . Text::CSV->error_diag();
106 # 2 extra columns are ignored
107 $input_file->column_names( [
'zfin',
'desc',
'label'] );
109 while ( my $data = $input_file->getline_hr( $file_io ) ) {
110 # skip if WITHDRAWN: this precedes both desc and label
111 if ( $data->{
'label'} =~ /\A WITHDRAWN:/xms ) {
116 acc => $data->{
'zfin'},
117 label => $data->{
'label'},
118 desc => $data->{
'desc'},
119 source_id => $source_id,
120 species_id => $species_id,
127 $input_file->eof or confess
"Error parsing file $file: " . $input_file->error_diag();
131 print
"$count ZFINDesc xrefs added, $withdrawn withdrawn entries ignored\n";