[Bioperl-l] extract and write a pdb chain

Brian Osborne bosborne11 at verizon.net
Fri Dec 11 20:37:45 UTC 2009


Joan,

It looks to me like the first argument to the add_chain() method has  
to be a Model object, the second is the Chain itself. See Structure/ 
Entry.pm, for example. However if you're seeing some documentation  
that says something else then tell us where, it needs to be corrected.

In Bio::Structure an Entry consists of one or Models, each of which  
has one or more Chains. This allows you to build macromolecular  
complexes (an Entry), which could have more than one defined proteins  
or protein complexes (Models).

Brian O.

On Dec 11, 2009, at 11:44 AM, Joan Segura Mora wrote:

> 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
>
> _______________________________________________
> Bioperl-l mailing list
> Bioperl-l at lists.open-bio.org
> http://lists.open-bio.org/mailman/listinfo/bioperl-l




More information about the Bioperl-l mailing list