[Bioperl-l] Bio::Index::PDB
Brian Osborne
brian_osborne at cognia.com
Tue Oct 14 08:18:56 EDT 2003
Shawn,
Both Bio::Index::Fasta and Bio::DB::Fasta allow you to stipulate the key you
want to use, as in:
my $inx = Bio::Index::Fasta->new( -filename => $file_name . ".idx",
-write_flag => 1 );
$inx->id_parser(\&get_id);
# make the index
$inx->make_index($file_name);
# where get_id() could look like:
# here is where the retrieval key is specified
sub get_id {
my $header = shift;
$header =~ /^>.*\bsp\|([A-Z]\d{5}\b)/;
$1;
}
I've found this capability to be very useful myself.
Brian O.
-----Original Message-----
From: bioperl-l-bounces at portal.open-bio.org
[mailto:bioperl-l-bounces at portal.open-bio.org]On Behalf Of Shawn Hoon
Sent: Monday, October 13, 2003 9:18 PM
To: BioPerl List
Subject: [Bioperl-l] Bio::Index::PDB
Hi,
I wrote an indexer along the lines of the sequence index modules for
PDB structure files.
Basically a lot of copying from Bio::Index::Fasta
Basically 2 modules added:
Bio::Index::AbstractStructure (which inherits from Bio::Index::Abstract)
Bio::Index::PDB
Usage:
use Bio::Index::PDB;
use strict;
my $Index_File_Name = shift;
my $inx = Bio::Index::PDB->new('-filename' => $Index_File_Name);
my $out = Bio::Structure::IO->new('-format' => 'pdb','-fh' =>
\*STDOUT);
foreach my $id (@ARGV) {
my $struct= $inx->fetch($id); # Returns Bio::Structure object
$out->write_structure($struct);
}
Is this along the lines of how indexers are implemented? If so, I will
go ahead and commit them.
shawn
_______________________________________________
Bioperl-l mailing list
Bioperl-l at portal.open-bio.org
http://portal.open-bio.org/mailman/listinfo/bioperl-l
More information about the Bioperl-l
mailing list