Loading a structure and traversing the structure/chain/residue hierarchy, outputting some information.
|
" Copyright 2003-2006 Alexander V. Diemand
This file is part of MolTalk. MolTalk is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. MolTalk is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with MolTalk; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA "
[ |
" traverses the structure/chain/residue
hierarchy
at the end it prints out the count of residues with CA distances in the range from 3.5 to 4.1 grouped by tenth of Angstroms "
main
| arg strxcode |
strxcode := nil.
1 to: (ARGS count) - 1 do: [ :argc | arg := (ARGS objectAtIndex:(argc intValue)). (arg = '-strx' ) ifTrue: [ targc := argc + 1. strxcode := (ARGS objectAtIndex:(targc)). ]. ]. (strxcode isNil) ifTrue: [ self usage. ] ifFalse: [ self continue:strxcode. ]. ^self
!
usage
Transcript showLine:
'Usage: MolTalk scripts/traverseHierarchy.st -strx [strxcode]'
.
Transcript showLine: '' . ^self
!
continue:strxcode
| strx CAatm1 CAatm2 dist idx distr val |
strx := MTStructureFactory
newStructureFromPDBDirectory:
strxcode.
" MTStructure
3.2
"
(strx notNil) ifTrue: [ distr := NSMutableArray arrayWithArray: #(0 0 0 0 0 0). " NSArray 9.3 " Transcript showLine:( 'have structure:' ,strx pdbcode). Transcript showLine:( 'header: ' ,strx header). Transcript showLine:( 'title: ' ,strx title). Transcript showLine:( 'date: ' ,strx date description). (strx allChains allObjects) do: [ :chain | " MTChain 3.4 " Transcript showLine:( ' have chain:',chain description,'´#' ,chain code stringValue). Transcript showLine:( ' E.C. code: ' ,chain eccode). Transcript showLine:( ' compound: ' ,chain compound). Transcript showLine:( ' source: ' ,chain source). Transcript showLine:( ' #aa: ' ,chain allResidues allObjects count stringValue). Transcript showLine:( ' #het:' ,chain allHeterogens allObjects count stringValue). Transcript showLine:( ' #sol:' ,chain allSolvent allObjects count stringValue). CAatm2 := nil. (chain allResidues allObjects) do: [ :residue | " MTResidue 3.6 " CAatm1 := residue getCA. " MTAtom 3.8 " (CAatm2 notNil) ifTrue: [ dist := CAatm1 distanceTo: CAatm2. idx := ((dist - 3.5) * 10) intValue. ((idx >= 0) and: (idx < 6)) ifTrue: [ val := distr objectAtIndex:idx. distr replaceObjectAtIndex:idx withObject:(val + 1). ]. (dist > 4.0) ifTrue: [ Transcript showLine:( 'CA-CA distance > 4.0 A between residues: ' ,presidue description, ' and ' ,residue description, ' distance=' ,dist stringValue). ]. ]. " if we know the previous CA atom " presidue := residue. " remember this residue in next iteration as previous residue " CAatm2 := CAatm1. " remember this CA atom " ]. " for all residues " Transcript showLine: '' . ]. " for all chains " ] " if strx " ifFalse: [ Transcript showLine: 'I do not know this structure.' . ].
0 to: 5 do: [ :index |
Transcript showLine:( 'count of residues with CA distance between ' , ((35 + index) / 10.0) stringValue, ' and ' , ((36 + index) / 10.0) stringValue, ' are: ' , (distr objectAtIndex:index) stringValue). ]. ^self ]
|
moltalk@moltalk.org version of this document: V3.0