Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl-Sensitive Sunglasses
 
PerlMonks  

Re: How to select specific lines from a file

by pvaldes (Chaplain)
on Apr 30, 2014 at 00:13 UTC ( [id://1084414]=note: print w/replies, xml ) Need Help??


in reply to How to select specific lines from a file

If you need to parse, write, change and manipulate PDB files you should probably make an effort and consider bioperl. This code is untested and positively wrong, (the docs of BIO::Structure are starting to bite me like a goliath tiger fish), but you can start playing with this..

use strict; use warnings; use Bio::Structure::IO; #use Data::Dumper; my $in = Bio::Structure::IO->new(-file => "myfile.pdb", -format => 'PDB'); while ( my $struc = $in->next_structure() ){ print "Structure: ", $struc->id; for my $model ($struc->get_models){ print "model: ", $model->id; for my $chain ($struc->get_chains) { if($chain->id eq "A"){ print "we have an A!"; foreach my $res ($struc->get_residues($chain)){ print "Yeah, Honestly, I don't know what I'm doing here"; foreach my $atom ($struc->get_atoms($res)){ print "This is the ATOM ",$atom->id;} } } last; } last; }}

mmmh, or maybe use Chemistry::File::PDB?

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://1084414]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others lurking in the Monastery: (4)
As of 2024-04-24 19:04 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found