2
# BioPerl module Bio::Biblio::IO::pubmed2ref.pm
4
# Please direct questions and support issues to <bioperl-l@bioperl.org>
6
# Cared for by Martin Senger <senger@ebi.ac.uk>
7
# For copyright and disclaimer see below.
9
# POD documentation - main docs before the code
13
Bio::Biblio::IO::pubmed2ref - A converter of a raw hash to PUBMED citations
27
User feedback is an integral part of the evolution of this and other
28
Bioperl modules. Send your comments and suggestions preferably to
29
the Bioperl mailing list. Your participation is much appreciated.
31
bioperl-l@bioperl.org - General discussion
32
http://bioperl.org/wiki/Mailing_lists - About the mailing lists
36
Please direct usage questions or support issues to the mailing list:
38
I<bioperl-l@bioperl.org>
40
rather than to the module maintainer directly. Many experienced and
41
reponsive experts will be able look at the problem and quickly
42
address it. Please include a thorough description of the problem
43
with code and data examples if at all possible.
47
Report bugs to the Bioperl bug tracking system to help us keep track
48
of the bugs and their resolution. Bug reports can be submitted via the
51
https://redmine.open-bio.org/projects/bioperl/
55
Martin Senger (senger@ebi.ac.uk)
59
Copyright (c) 2002 European Bioinformatics Institute. All Rights Reserved.
61
This module is free software; you can redistribute it and/or modify
62
it under the same terms as Perl itself.
66
This software is provided "as is" without warranty of any kind.
70
Here is the rest of the object methods. Internal methods are preceded
76
# Let the code begin...
79
package Bio::Biblio::IO::pubmed2ref;
83
use base qw(Bio::Biblio::IO::medline2ref);
86
# ---------------------------------------------------------------------
90
# ---------------------------------------------------------------------
93
my ($self, $source) = @_;
96
my $article = $$source{'article'};
97
if (defined $article) {
98
if (defined $$article{'journal'}) {
99
$result = $self->_new_instance ('Bio::Biblio::PubmedJournalArticle');
100
$result->type ('JournalArticle');
101
} elsif (defined $$article{'book'}) {
102
$result = $self->_new_instance ('Bio::Biblio::PubmedBookArticle');
103
$result->type ('BookArticle');
105
$result->type ('PubmedArticle');
108
$result = $self->_new_instance ('Bio::Biblio::Ref') unless defined $result;
113
my ($self, $source) = @_;
114
my $result = $self->SUPER::convert ($source->{'Citation'});
116
# here we do PUBMED's specific stuff
117
my $pubmed_data = $$source{'PubmedData'};
118
if (defined $pubmed_data) {
120
# ... just take it (perhaps rename it)
121
$result->pubmed_status ($$pubmed_data{'publicationStatus'}) if defined $$pubmed_data{'publicationStatus'};
122
$result->pubmed_provider_id ($$pubmed_data{'providerId'}) if defined $$pubmed_data{'providerId'};
123
$result->pubmed_article_id_list ($$pubmed_data{'pubmedArticleIds'}) if defined $$pubmed_data{'pubmedArticleIds'};
124
$result->pubmed_url_list ($$pubmed_data{'pubmedURLs'}) if defined $$pubmed_data{'pubmedURLs'};
126
# ... put all dates from all 'histories' into one array
127
if (defined $$pubmed_data{'histories'}) {
129
foreach my $history ( @{ $$pubmed_data{'histories'} } ) {
130
my $ra_pub_dates = $$history{'pubDates'};
131
foreach my $pub_date ( @{ $ra_pub_dates } ) {
133
my $converted_date = &Bio::Biblio::IO::medline2ref::_convert_date ($pub_date);
134
$history{'date'} = $converted_date if defined $converted_date;
135
$history{'pub_status'} = $$pub_date{'pubStatus'} if defined $$pub_date{'pubStatus'};
136
push (@history_list, \%history);
139
$result->pubmed_history_list (\@history_list);