~ubuntu-branches/ubuntu/trusty/bioperl/trusty-proposed

« back to all changes in this revision

Viewing changes to Bio/Biblio/IO.pm

  • Committer: Bazaar Package Importer
  • Author(s): Charles Plessy
  • Date: 2009-03-10 07:19:11 UTC
  • mfrom: (1.2.3 upstream)
  • Revision ID: james.westby@ubuntu.com-20090310071911-fukqzw54pyb1f0bd
Tags: 1.6.0-2
* Removed patch system (not used):
  - removed instuctions in debian/rules;
  - removed quilt from Build-Depends in debian/control.
* Re-enabled tests:
  - uncommented test command in debian/rules;
  - uncommented previously missing build-dependencies in debian/control.
  - Re-enabled tests and uncommented build-dependencies accordingly.
* Removed libmodule-build-perl and libtest-harness-perl from
  Build-Depends-Indep (provided by perl-modules).
* Better cleaning of empty directories using find -type d -empty -delete
  instead of rmdir in debian/rules (LP: #324001).

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
# $Id: IO.pm,v 1.17.4.3 2006/10/02 23:10:12 sendu Exp $
 
1
# $Id: IO.pm 15257 2008-12-24 05:27:05Z cjfields $
2
2
#
3
3
# BioPerl module for Bio::Biblio::IO
4
4
#
49
49
    # again reading all citation but now a callback defined in your
50
50
    # code is used (note that the reading starts already when new()
51
51
    # is called)
52
 
    $io = new Bio::Biblio::IO ('-format'   => 'medlinexml',
 
52
    $io = Bio::Biblio::IO->new('-format'   => 'medlinexml',
53
53
                               '-file'     => $testfile,
54
54
                               '-callback' => \&callback);
55
55
    sub callback {
62
62
 
63
63
    use Bio::Biblio;
64
64
    use Bio::Biblio::IO;
65
 
    my $xml = new Bio::Biblio->get_by_id ('12368254');
 
65
    my $xml = Bio::Biblio->new->get_by_id ('12368254');
66
66
    my $reader = Bio::Biblio::IO->new ('-data' => $xml,
67
67
                                       '-format' => 'medlinexml');
68
68
 
73
73
  #And, finally, the resulting citation can be received in different
74
74
  #output formats:
75
75
 
76
 
    $io = new Bio::Biblio::IO ('-format' => 'medlinexml',
 
76
    $io = Bio::Biblio::IO->new('-format' => 'medlinexml',
77
77
                               '-result' => 'raw');
78
78
  #--- OR ---
79
79
 
80
 
    $io = new Bio::Biblio::IO ('-format' => 'medlinexml',
 
80
    $io = Bio::Biblio::IO->new('-format' => 'medlinexml',
81
81
                               '-result' => 'medline2ref');
82
82
 
83
83
  #--- OR ---
84
84
 
85
 
    $io = new Bio::Biblio::IO ('-format' => 'pubmedxml',
 
85
    $io = Bio::Biblio::IO->new('-format' => 'pubmedxml',
86
86
                               '-result' => 'pubmed2ref');
87
87
 
88
88
=head1 DESCRIPTION
111
111
I<-result>. One result type is I<raw> and it is represented by a
112
112
simple, not blessed hash table:
113
113
 
114
 
    $io = new Bio::Biblio::IO ('-result' => 'raw');
 
114
    $io = Bio::Biblio::IO->new('-result' => 'raw');
115
115
 
116
116
What other result formats are available depends on the module who
117
117
reads the citations in the first place. At the moment, the following
118
118
ones are available:
119
119
 
120
 
    $io = new Bio::Biblio::IO ('-result' => 'medline2ref');
 
120
    $io = Bio::Biblio::IO->new('-result' => 'medline2ref');
121
121
 
122
122
This is a default result format for reading citations by the
123
123
I<medlinexml> module. The C<medlinexml> module is again the default
124
124
one. Which means that you can almost omit arguments (you still need to
125
125
say where the citations come from):
126
126
 
127
 
    $io = new Bio::Biblio::IO ('-file' => 'data/medline_data.xml');
 
127
    $io = Bio::Biblio::IO->new('-file' => 'data/medline_data.xml');
128
128
 
129
129
Another result format available is for PUBMED citations (which is a
130
130
super-set of the MEDLINE citations having few more tags):
131
131
 
132
 
    $io = new Bio::Biblio::IO ('-format' => 'pubmedxml',
 
132
    $io = Bio::Biblio::IO->new('-format' => 'pubmedxml',
133
133
                               '-result' => 'pubmed2ref',
134
134
                               '-data'   => $citation);
135
135
 
136
136
Or, because C<pubmed2ref> is a default one for PUBMED citations, you can say just:
137
137
 
138
 
    $io = new Bio::Biblio::IO ('-format' => 'pubmedxml',
 
138
    $io = Bio::Biblio::IO->new('-format' => 'pubmedxml',
139
139
                               '-data'   => $citation);
140
140
 
141
141
Both C<medline2ref> and C<pubmed2ref> results are objects defined in
211
211
 
212
212
use strict;
213
213
 
214
 
use Symbol();
 
214
use Symbol;
215
215
 
216
216
use base qw(Bio::Root::Root Bio::Root::IO);
217
217