[Bioperl-l] extract and write a pdb chain
Joan Segura Mora
umjsm at leeds.ac.uk
Fri Dec 11 11:44:42 EST 2009
Hello,
I am trying to do a very easy think but I don't get it. I want to write
in a file a chain of a pdb. I have try a lot of thinks but what I think
that it should work is the next script:
use Bio::Structure::IO;
use strict;
my $structio = Bio::Structure::IO->new(-file => "101m.pdb",'-format' =>
'pdb');
my $struc = $structio->next_structure;
my $new_entry = Bio::Structure::Entry->new( -id => 'structure_id');
for my $chain ($struc->get_chains) {
if($chain->id eq "A"){
$new_entry->chain($chain);
last;
}
}
my $out = Bio::Structure::IO->new(-file => ">out.pdb",'-format' =>
'pdb');#
$out->write_structure($new_entry);
it doesn't. I get the next error:
------------- EXCEPTION: Bio::Root::Exception -------------
MSG: add_chain: first argument needs to be a Model object ()
STACK: Error::throw
STACK:
Bio::Root::Root::throw /usr/local/share/perl/5.8.8/Bio/Root/Root.pm:368
STACK:
Bio::Structure::Entry::add_chain /usr/local/share/perl/5.8.8/Bio/Structure/Entry.pm:335
STACK:
Bio::Structure::Entry::get_chains /usr/local/share/perl/5.8.8/Bio/Structure/Entry.pm:391
STACK:
Bio::Structure::Entry::chain /usr/local/share/perl/5.8.8/Bio/Structure/Entry.pm:304
STACK: read_pdb.pl:10
-----------------------------------------------------------
As far I understand the documentation, the method chain of the object
Bio::Structure::Entry requires an as input an object of type Chain.
Any solution will be very welcome.
best regards,
Joan
More information about the Bioperl-l
mailing list