def GetSuperImposition( alignment ):
    """get superimposition based on aligned residue positions.
    """
    (infile, outfile) = os.popen2( CMD_SUPERIMPOSE )

    ## write input data
    infile.write( "%i\n" % len(alignment))
    for data in alignment:
        infile.write( "%f\t%f\t%f\t%f\t%f\t%f\t%i\n" % data)
    infile.close()

    ## get output data
    lines = outfile.readlines()

    rms = string.atof(re.split("\s+", lines[0] )[1])
    u = map(string.atof, re.split("\s+", lines[1])[1:-1] )
    t = map(string.atof, re.split("\s+", lines[2])[1:-1] )

    return (math.sqrt(rms / float(len(alignment))),
            numpy.array(t, numpy.float),
            numpy.reshape(numpy.array( u, numpy.float, 2), (3,3)))
dataset/ETHPy150Open CGATOxford/cgat/legacy/PdbTools.py/GetSuperImposition/original