Bio::Biblio::IO(3pm)
πΈ Bio::Biblio::IO π
okay bestie, welcome to Bio::Biblio::IO(3pm) β a User Contributed Perl Documentation moment. this is the whole vibe, let's go β¨
β¨ NAME β¨
Bio::Biblio::IO β handling the bibliographic references π
π VERSION π
version 1.70 π
π¦ SYNOPSIS π¦
no cap, here's the whole thing, copy it exactly:
use Bio::Biblio::IO;
# getting citations from a file
$in = Bio::Biblio::IO->new ('-file' => 'myfile.xml' ,
'-format' => 'medlinexml');
# --- OR ---
# getting citations from a string
$in = Bio::Biblio::IO->new ('-data' => '<MedlineCitation>...</MedlineCitation>' ,
'-format' => 'medlinexml');
#--- OR ---
# getting citations from a string if IO::String is installed
use IO::String;
$in = Bio::Biblio::IO->new ('-fh' => IO::String->new ($citation),
'-format' => 'medlinexml');
$in = Bio::Biblio::IO->new(-fh => $io_handle , '-format' => 'medlinexml');
#--- OR ---
# getting citations from any IO handler
$in = Bio::Biblio::IO->new('-fh' => $io_handle ,
'-format' => 'medlinexml');
# now, having $in, we can read all citations
while ( my $citation = $in->next_bibref() ) {
&do_something_with_citation ($citation);
}
#--- OR ---
# again reading all citation but now a callback defined in your
# code is used (note that the reading starts already when new()
# is called)
$io = Bio::Biblio::IO->new('-format' => 'medlinexml',
'-file' => $testfile,
'-callback' => \&callback);
sub callback {
my $citation = shift;
print $citation->{'_identifier'} . "\n";
}
#Now, to actually get a citation in an XML format,
#use I<Bio::Biblio> module which returns an XML string:
use Bio::Biblio;
use Bio::Biblio::IO;
my $xml = Bio::Biblio->new->get_by_id ('12368254');
my $reader = Bio::Biblio::IO->new ('-data' => $xml,
'-format' => 'medlinexml');
while (my $citation = $reader->next_bibref()) {
#... do something here with $citation
}
#And, finally, the resulting citation can be received in different
#output formats:
$io = Bio::Biblio::IO->new('-format' => 'medlinexml',
'-result' => 'raw');
#--- OR ---
$io = Bio::Biblio::IO->new('-format' => 'medlinexml',
'-result' => 'medline2ref');
#--- OR ---
$io = Bio::Biblio::IO->new('-format' => 'pubmedxml',
'-result' => 'pubmed2ref');
π DESCRIPTION π
Bio::Biblio::IO is a handler module for accessing bibliographic citations. the citations can show up in all different formats β the whole premise is that there's a corresponding module that knows that format living in the Bio::Biblio::IO directory (like Bio::Biblio::IO::medlinexml, for example π§). the format (and like, the module name too) is given by the argument -format.
once you've got an instance of the "Bio::Biblio::IO" class in your hands, you read citations by calling the method next_bibref over and over:
while (my $citation = $reader->next_bibref()) {
... do something here with $citation
}
β οΈ but lowkey? this might mean all the citations were already read into memory. if you're expecting a huge amount of citations, maybe pick the callback option instead. you specify your subroutine in the "new()" method and it gets called everytime a new citation is available (peep the example up in SYNOPSIS π).
the citations returned by next_bibref, or handed to your callback routine, can be in different formats depending on the argument -result. one result type is raw and it's represented by a simple, <em>not blessed</em> hash table:
$io = Bio::Biblio::IO->new('-result' => 'raw');
what other result formats are available depends on the module who reads the citations in the first place. at the moment, the following ones are available:
$io = Bio::Biblio::IO->new('-result' => 'medline2ref');
this is the default result format for reading citations by the medlinexml module. and the "medlinexml" module is again the default one. which means you can almost omit arguments entirely (you still need to say where the citations come from, bestie, that part is not optional π«Ά):
$io = Bio::Biblio::IO->new('-file' => 'data/medline_data.xml');
another result format available is for PUBMED citations (which is a super-set of the MEDLINE citations having few more tags, iconic honestly):
$io = Bio::Biblio::IO->new('-format' => 'pubmedxml',
'-result' => 'pubmed2ref',
'-data' => $citation);
or, because "pubmed2ref" is a default one for PUBMED citations, you can say just:
$io = Bio::Biblio::IO->new('-format' => 'pubmedxml',
'-data' => $citation);
both "medline2ref" and "pubmed2ref" results are objects defined in the directory "Bio::Biblio". β¨
π ATTRIBUTES π
fh
just fh. that's the whole bit. it's giving mysterious, and honestly? we love that for it. π
π METHODS π
new
newFh
next_bibref
- Usage:
$citation = stream->next_bibref - Function: Reads the next citation object from the stream and returns it.
- Returns: a
Bio::Biblio::Refcitation object, or something else (depending on the'-result'argument given in the'new()'method). - Args: none
DESTROY
TIEHANDLE
READLINE
π₯ INTERNAL METHODS π₯
(these are the backstage ones, the stage crew of this module π)
_initialize
_load_format_module
- Usage:
$class->_load_format_module ($format) - Returns:
1on success,undefon failure - Args:
'format'should contain the last part of the name of a module who does the real implementation
it does (in run-time, no less β±οΈ) a similar thing as
require Bio::Biblio::IO::$format
and it throws an exception if it fails to find and load the module (for example, because of the compilation errors in the module). rude, but fair. π
_guess_format
- Usage:
$class->_guess_format ($filename) - Returns: string with a guessed format of the input data (e.g.
'medlinexml') - Args: a file name whose extension can help to guess its format
it makes an expert guess what kind of data are in the given file β but bestie, be prepared that $filename may be empty. π
π SEE ALSO π
- an example script
eg/biblio-soap.pl- it has many options and its own help. the relevant options to this IO module are
"-f"(specifying what file to read) and"-O"(specifying what result format to achieve). π«
- it has many options and its own help. the relevant options to this IO module are
- OpenBQS home page
- Comments to the Perl client
π FEEDBACK π
Mailing lists
user feedback is an integral part of the evolution of this and other Bioperl modules. send your comments and suggestions preferably to the Bioperl mailing list. your participation is much appreciated π«Ά
bioperl-l@bioperl.org - General discussion
http://bioperl.org/wiki/Mailing_lists - About the mailing lists
Support
please direct usage questions or support issues to the mailing list:
bioperl-l@bioperl.org
rather than to the module maintainer directly. many experienced and reponsive experts will be able look at the problem and quickly address it. please include a thorough description of the problem with code and data examples if at all possible. π
Reporting bugs
report bugs to the Bioperl bug tracking system to help us keep track of the bugs and their resolution. bug reports can be submitted via the web:
https://redmine.open-bio.org/projects/bioperl/
βοΈ LEGAL βοΈ
Authors
Martin Senger <senger@ebi.ac.uk> π
Copyright and License
this software is Copyright (c) by 2002 European Bioinformatics Institute and released under the license of the same terms as the perl 5 programming language system itself. β
and that's the whole page, bestie!! this was Bio::Biblio::IO(3pm) from the User Contributed Perl Documentation, brought to you by perl v5.36.0 on 2023-02-14 β yes, a Valentine's Day release, we're obsessed, main character energy fr fr ππ
ππ¦πΈ
π¦ where this page comes from
- debian trixie: libbio-biblio-perl 1.70-2 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu noble: libbio-biblio-perl 1.70-2 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu resolute: libbio-biblio-perl 1.70-2 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu stonking: libbio-biblio-perl 1.70-2 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms