On Friday 22 October 2004 02:07, Milton H. Werner, Ph.D. wrote:
> I assume there is a way in pymol to read a DALI rotation/transformation
> matrix so that two dissimilar molecules can be intelligently aligned.
> Can someone tell me how it is done?

I have a simple Python script that extracts the transformation matrices from 
the Dali report file. If someone has a way to use this matrix in PyMol, we'd 
be set:

#!/usr/bin/env python

# Script to extract 3x4 transformation matrices from Dali report files
# Lieven Buts, 22-Oct-2004

import re,sys

dali = open(sys.argv[1],"r")

pattern = re.compile(r'^## MATRICES')  # Find section with matrices
line = dali.readline()
while not pattern.match(line):
    line = dali.readline()

dummy = dali.readline()

pattern = re.compile(r'^ *$')
line = dali.readline()
while not pattern.match(line):     # Read matrices until first empty line
  one = line.split()
  two = dali.readline().split()
  three = dali.readline().split()

  code = one[2]
  matrix = [ one[4],one[5],one[6],one[7],
             two[4],two[5],two[6],two[7],
             three[4],three[5],three[6],three[7] ]
  matrix = tuple(map(float,matrix))

  print code
  print ("%8.3f %8.3f %8.3f %8.3f\n" * 3) % matrix
  print

  line = dali.readline()


Cheers,

-- 
Lieven Buts
Department of Ultrastructure
Vrije Universiteit Brussel

Reply via email to