[Bioperl-l] (no subject)
jurgen.pletinckx at algonomics.com
Fri May 28 08:10:22 EDT 2004
Let's see now... I'll pass on the first question, as Stefan
already answered it.
# II) next problems while using the Bio::Structure::IO
# #!/usr/bin/perl -w
# use Bio::Structure::IO;
# $structio = Bio::Structure::IO->new(-file => "1cam.pdb",
# -format => 'PDB');
# $struc = $structio->next_structure; # returns an Entry object
# $pseq = $struc->seqres; # returns a PrimarySeq object, thus
# $partial_sequence=$pseq->subseq(1,20); # returns a sequence string
# print "Sequence from 1 to 20 is: $partial_sequence\n";
# This is my output:
# Sequence from 1 to 20 is: XSHHWGYGKHNGPEHWHKDF
# (in cleanup) Can't call method "CLEAR" on an undefined value at
# F:/Perl/site/lib/Bio/Structure/Entry.pm line 776, <GEN0> line 2431 during
# global destruction.
# I am wondering about the second position "S", this resisue is not defined in
# the crystal structure. What does the error message mean? And how to get rid
# of it?
Firstly, method 'seqres' gives you the content of the SEQRES lines from
the pdb file, and these start out as
SEQRES 1 260 ACE SER HIS HIS TRP GLY TYR GLY LYS HIS ASN GLY PRO 1CAM 45
so XSHH... is acceptable. As long as you accept being given the contents
of SEQRES rather than the actual sequence being present in the file, that
Secondly, the error message - hmmm. I get the same message using this
script as you do, so don't worry about your set-up or script... And it
doesn't depend on the particular file being parsed either...
Ah. Oh boy. If you use "my $struc = $structio->next_structure;", i.e.
you prepend the word "my" to the 5th line, the error doesn't occur. Hm.
Using "my $variable" means $variable is now a lexical (think local)
rather than a global variable, which is usually a good thing. I had no
idea using global variables could cause garbage collection/object de-
struction to go wrong, though. I will need to follow up on this.
# III) How to get the atoms at a certain residue? Just adding these two lines:
# @atoms = $struc->get_atoms(20); # Atom objects, given a Residue
# print "Atoms at residue 20 are: @atoms\n";
# give me a bunch of error messages....
Right. get_atoms expects a residue _object_ as input. There is currently
no way of getting the residue at position 20 without explicitly looking
$structio = Bio::Structure::IO->new(-file => "/PDB/ca/pdb1cam.ent");
my $struc = $structio->next_structure;
for my $chain ($struc->get_chains)
my $chainid = $chain->id;
# one-letter chaincode if present, 'default' otherwise
for my $res ($struc->get_residues($chain))
my $resid = $res->id;
# format is 3-lettercode - dash - residue number, e.g. PHE-20
if ($resid =~ /-20$/)
for my $atom ($struc->get_atoms($res))
Also note that $atom is an Atom object, and printing it directly
will give something like "Bio::Structure::Atom=HASH(0x10522a64)"
- you need methods like id, tempfactor, x, ... to access any of
the values of the atom record.
Hope this helps!
More information about the Bioperl-l