[BioRuby-cvs] bioruby/lib/bio/db/pdb pdb.rb,1.5,1.6
Naohisa Goto
ngoto at pub.open-bio.org
Sun Dec 18 12:37:16 EST 2005
Update of /home/repository/bioruby/bioruby/lib/bio/db/pdb
In directory pub.open-bio.org:/tmp/cvs-serv30006
Modified Files:
pdb.rb
Log Message:
changed logics
It might work correctly, but would stil have many bugs.
Index: pdb.rb
===================================================================
RCS file: /home/repository/bioruby/bioruby/lib/bio/db/pdb/pdb.rb,v
retrieving revision 1.5
retrieving revision 1.6
diff -C2 -d -r1.5 -r1.6
*** pdb.rb 18 Dec 2005 15:09:46 -0000 1.5
--- pdb.rb 18 Dec 2005 17:37:14 -0000 1.6
***************
*** 1196,1205 ****
}
- #Aha! Our entry into the world of PDB parsing, we initialise a PDB
- #object with the whole PDB file as a string
- #each PDB has an array of the lines of the original file
- #a bit memory-tastic! A hash of records and an array of models
- #also has an id
def initialize(str)
@data = str.split(/[\r\n]+/)
--- 1196,1205 ----
}
def initialize(str)
+ #Aha! Our entry into the world of PDB parsing, we initialise a PDB
+ #object with the whole PDB file as a string
+ #each PDB has an array of the lines of the original file
+ #a bit memory-tastic! A hash of records and an array of models
+ #also has an id
@data = str.split(/[\r\n]+/)
***************
*** 1236,1252 ****
end
! #The meat of the atom parsing - could be speeded up I think
case key
! when 'ATOM', 'HETATM'
#Each model has a special solvent chain
#any chain id with the solvent is lost
#I can fix this if really needed
! if key == 'HETATM' and f.resName == 'HOH'
solvent = Residue.new(f.resName, f.resSeq, f.iCode,
cModel.solvent, true)
! solvent_atom = f
f.residue = solvent
! solvent.addAtom(solvent_atom)
cModel.addSolvent(solvent)
--- 1236,1278 ----
end
! # Do something for ATOM and HETATM
case key
! when 'ATOM'
! residueID = "#{f.resSeq}#{f.iCode.strip}".strip
! #p f
!
! if f.chainID == cChain.id
! chain = cChain
! elsif !(chain = cModel[f.chainID])
! #If we don't have chain, add a new chain
! newChain = Chain.new(f.chainID, cModel)
! cModel.addChain(newChain)
! cChain = newChain
! chain = newChain
! end
!
! if !newChain and residueID == cResidue.id
! residue = cResidue
! elsif newChain or !(residue = chain[residueID])
! newResidue = Residue.new(f.resName, f.resSeq, f.iCode, chain)
! chain.addResidue(newResidue)
! cResidue = newResidue
! residue = newResidue
! end
!
! f.residue = residue
! residue.addAtom(f)
!
! when 'HETATM'
#Each model has a special solvent chain
#any chain id with the solvent is lost
#I can fix this if really needed
! if f.resName == 'HOH'
solvent = Residue.new(f.resName, f.resSeq, f.iCode,
cModel.solvent, true)
! #p solvent
f.residue = solvent
! solvent.addAtom(f)
cModel.addSolvent(solvent)
***************
*** 1257,1317 ****
#numbers for HETATMS
residueID = "#{f.resSeq}#{f.iCode.strip}".strip
! if key == 'HETATM'
! residueID = "LIGAND" + residueID
! end
!
! #If this atom is part of the current residue then add it to
! #the current residue straight away
! if f.chainID == cChain.id and residueID == cResidue.id
!
! #If we have this chain and residue just add the atom
! atom = f
! f.residue = cResidue
! cResidue.addAtom(atom)
! elsif !cModel[f.chainID]
!
! #If we don't have anyhting, add a new chain, residue and atom
! newChain = Chain.new(f.chainID, cModel)
cModel.addChain(newChain)
!
! if key == 'ATOM'
! newResidue = Residue.new(f.resName, f.resSeq, f.iCode,
! newChain)
! newChain.addResidue(newResidue)
! else
! newResidue = Residue.new(f.resName, f.resSeq, f.iCode,
! newChain, true)
! newChain.addLigand(newResidue)
! end
! atom = f
! f.residue = newResidue
! newResidue.addAtom(atom)
!
! cChain = newChain
! cResidue = newResidue
!
! elsif !cModel[f.chainID][residueID]
! #If we have the chain (but not the residue)
! #make a new residue, add it and add the atom
! chain = cModel[f.chainID]
!
! if key == 'ATOM'
! newResidue = Residue.new(f.resName, f.resSeq, f.iCode,
! chain)
! chain.addResidue(newResidue)
! else
! newResidue = Residue.new(f.resName, f.resSeq, f.iCode,
! chain, true)
! chain.addLigand(newResidue)
! end
!
! atom = f
! f.residue = newResidue
! newResidue.addAtom(atom)
cResidue = newResidue
!
end
end
--- 1283,1313 ----
#numbers for HETATMS
residueID = "#{f.resSeq}#{f.iCode.strip}".strip
! residueID = "LIGAND" + residueID
! #p f
! #p residueID
! if f.chainID == cChain.id
! chain = cChain
! elsif !(chain = cModel[f.chainID])
! #If we don't have chain, add a new chain
! newChain = Chain.new(f.chainID, cModel)
cModel.addChain(newChain)
! cChain = newChain
! chain = newChain
! end
! if !newChain and residueID == cResidue.id
! residue = cResidue
! elsif newChain or !(residue = chain[residueID])
! newResidue = Residue.new(f.resName, f.resSeq, f.iCode,
! chain, true)
! chain.addLigand(newResidue)
cResidue = newResidue
! residue = newResidue
end
+
+ f.residue = residue
+ residue.addAtom(f)
+
end
More information about the bioruby-cvs
mailing list