[BioRuby] Bio.pdb doubt ...
Alex Gutteridge
alexg at ruggedtextile.com
Thu Feb 21 10:27:56 UTC 2008
I shouldn't have posted code without testing first!
The problem is that the PDB parser reads the solvent (water) molecules
into a separate chain. So in this case we have the protein chain and
the water 'chain'. My naive multichain? method then reports you have
two chains.
A reasonable workaround is to check each chain to see if it actually
contains any residues. We can test this my retrieving the residue
array for each chain and checking if its size is greater than 0. So
our multichain? method becomes a bit more complex:
irb(main):029:0> module Bio
irb(main):030:1> class PDB
irb(main):031:2> def multichain?
irb(main):032:3> self.chains.select{|chain| chain.residues.size >
0}.size > 1
irb(main):033:3> end
irb(main):034:2> end
irb(main):035:1> end
=> nil
irb(main):036:0> Bio::PDB.new(IO.read('1TCA.pdb')).multichain?
=> false
irb(main):037:0> Bio::PDB.new(IO.read('1A7B.pdb')).multichain?
=> true
DISCLAIMER: You still might run into edge cases with things like bound
ligands and so on. If these are small peptides they will be considered
as separate chains even if you don't think they should be. One way
round this would be to alter the residue size test in the code above
to look for chains with more than x residues (where x could be 5,10,30
or so) to filter out very small chains. You'll have to make that call
according to your needs and particular research.
On 20 Feb 2008, at 18:01, K. Shameer wrote:
> Hi Alex,
>
> I used this code to check chain identifiers. But I noticed the code is
> giving true for multichain and single chain entries.
>
> Can you please have a look at the code,
>
> require 'bio'
> module Bio
> class PDB
> def multichain?
> self.chains.size > 1
> end
> end
> end
> inputpdb = ARGV[0]
> if ARGV[0] == nil
> puts "please give an argument"
> end
> test = Bio::PDB.new(IO.read(inputpdb)).multichain?
> print test,"\n"
>
> I run this code using chain.rb test/1tca.pdb -> out put was
> 'true'(this
> shouldbe false - there is only one chain in 1TCA) and out put was
> 'true'
> for 1a7b as well.
>
> Thanks in advance,
> Shameer
>
> PS. Now I am going to try Goto's code.
>
>
>
>
> _______________________________________________
> BioRuby mailing list
> BioRuby at lists.open-bio.org
> http://lists.open-bio.org/mailman/listinfo/bioruby
>
More information about the BioRuby
mailing list