[BioRuby] bio.pdb doubt

K. Shameer shameer at ncbs.res.in
Wed Feb 20 16:01:54 UTC 2008


Dear Alex & Goto,

Thanks for two different and interesting flavors of Bioruby. Eventhough, I
was looking for a simple way like Alex explained. I will go through
Naohisa's detailed code as well. Thanks for the excellent support that you
guys are giving to newbies like me.

I was not able to check my email for last few days. Sorry if there was any
delay in replies.

Cheers,
K. Shameer
Computational Biology Group
NCBS - TIFR



> My posts don't seem to make it to the mailing list from this address,
> so I'm reposting - sorry if people get this twice!
>
> Shameer,
>
> There's no specific method for testing for multi-chain/single chain
> proteins and there are some interesting edge cases (does a small
> peptide bound to a large enzyme count as a chain for instance) where
> Naohisa's method may give different answers, but one simple way it
> just to grab the chains for as an array and check it's size:
>
> Bio::PDB.new(IO.read('1TIM.pdb')).chains.size
>
> And because this is Ruby you can always define your own convenience
> method on the Bio::PDB class:
>
> irb(main):007:0> module Bio
> irb(main):008:1> class PDB
> irb(main):009:2> def multichain?
> irb(main):010:3> self.chains.size > 1
> irb(main):011:3> end
> irb(main):012:2> end
> irb(main):013:1> end
> => nil
> irb(main):014:0> Bio::PDB.new(IO.read('1TIM.pdb')).multichain?
> => true
>
> AlexG
>
> On 20 Feb 2008, at 13:53, Naohisa GOTO wrote:
>
>> Dear Shameer,
>>
>> Information of chains for each macromolecule is described in
>> 'COMPND' record. In BioRuby, Bio::PDB#record method can be used.
>> Because the information obtained by the method is sometimes
>> naive, processing of the data would be needed.
>>
>> Below is a sample program:
>>
>>  require 'bio'
>>
>>  def parse_COMPND(pdb)
>>    molecules = []
>>    current_molecule = nil
>>    pdb.record('COMPND')[0].compound.each do |a|
>>      case a[0]
>>      when 'MOL_ID'
>>        current_molecule = {}
>>        molecules.push current_molecule
>>      when 'CHAIN'
>>        chains = a[1].split(/\s*\,\s*/)
>>        current_molecule[:chains] = chains
>>      end
>>      current_molecule[a[0]] = a[1]
>>    end
>>    molecules
>>  end
>>
>>  pdb1 = Bio::FlatFile.open('pdb1fjg.ent') { |f| f.next_entry }
>>  pdb2 = Bio::FlatFile.open('pdb1a0d.ent') { |f| f.next_entry }
>>
>>  [ pdb1, pdb2 ].each do |pdb|
>>    compounds = parse_COMPND(pdb)
>>    compounds.each do |c|
>>      p c['MOLECULE']
>>      p c[:chains]
>>    end
>>  end
>>
>> The meanings of the 'COMPND' record is described in
>> PDB file format document:
>> http://www.wwpdb.org/documentation/format23/sect2.html#COMPND
>>
>> --
>> Naohisa Goto
>> ngoto at gen-info.osaka-u.ac.jp /ng at bioruby.org
>>




More information about the BioRuby mailing list