-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hello Lei--

>    Is there a way (xplor script) to back calculate the rdcs from the pdb
> (including tensor values and principle axis) generated by xplor-nih? I
> generate a set of structures using N-HN rdcs and I would like to use the
> structure and tensor values to predict the C-HN rdcs. 

sure. The attached (slightly modified) version of
eginput/protG/calcTensor.py will do this for you when run like this:

./calcTensor -printRDCs <rdc table file> <structure1> [structure2] ...

best regards--
Charles

#!/usr/bin/env pyXplor

# calculate Da and Rh from an ensemble of structures, given observed
# RDCs
#
usage = """

Calculate RDC alignment tensor using SVD given molecular structures

usage: calcTensor.py [options] <rdc.tbl> <pdb file1> [<pdb file2> ...]

 where rdc.tbl is a file containing XPLOR-SANI-style assignment statements,
 and pdb file1, ... are one or more structure file which have previously
 been determined.

 options:
   --showRDCs                - print out back-calculated RDC values
   --fitSel <atom selection> - atom selection used to fit structures before
                               alignment tensor calculation.
 
"""

(optList, args) = xplor.parseArguments(["printRDCs:0",
                                        "fitSel:1",
                                        "help-script:0",])


#
# selection used to fit structures before tensor calculation
#
fitSel="name CA or name N or name C or name O"
printRDCs=False

for opt in optList:
    if opt[0]=="showRDCs":
        printRDCs=True
        pass
    if opt[0]=="fitSel":
        fitSel=opt[1]
        pass
    if opt[0]=="help-script":
        print usage
        import sys
        sys.exit(0)
        pass
    pass

if len(args)<2:
    print usage
    sys.exit(1)
    pass

tables = args[0].split()
coordFiles = args[1:]


#
# specify a PSF file name, if you have one handy
#
psf=None

import protocol

if not psf:
    from psfGen import pdbToPSF
    pdbToPSF(coordFiles[0])
    pass

from varTensorTools import create_VarTensor, calcTensor
from rdcPotTools import create_RDCPot, scale_toNH
from simulationTools import analyze

medium = create_VarTensor('medium')

coordArray=[]
from atomSelAction import Fit
fitCoords=None
for file in coordFiles:
    protocol.initCoords(file)

    if not fitCoords:
        fitCoords = xplor.simulation.atomPosArr()
    else:
        if fitSel:
            AtomSel("all").apply(Fit(fitCoords,fitSel))
            pass
        pass

    coordArray.append( xplor.simulation.atomPosArr() )

    pass

rdcs=[]
for table in tables:
    rdcs.append( create_RDCPot(table,oTensor=medium,file=table) )
    scale_toNH( rdcs[-1] )
    rdcs[-1].setShowAllRestraints( True )
    pass


tensor = calcTensor(medium,coords=coordArray)


#copy tensor atom positions
from atomSel import AtomSel
aniAtoms = AtomSel("resname ANI and resid %d" % medium.oAtom().residueNum())
aniPosAtoms = map(lambda a:(a.pos(),a), aniAtoms)

#print analyze(medium)

print "Da: %7.2f    Rh: %7.3f" % (medium.Da() , medium.Rh())
print "Fit:"

for cnt in range(len(coordFiles)):
    xplor.simulation.setAtomPosArr(coordArray[cnt])
    #reset tensor atom positions
    for (pos,atom) in aniPosAtoms:
        atom.setPos(pos)
        pass
    print "  %-20s " % coordFiles[cnt],
    rdcs[0].calcEnergy()
    print "%20s: %7.3f" % (tables[0], rdcs[0].rms()),
    print
    pass

#print tensor
    
# uncomment the next line to get a printout of back-calculated rdcs
if printRDCs:
    print analyze(rdcs)
    pass
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (GNU/Linux)
Comment: Processed by Mailcrypt 3.5.8+ <http://mailcrypt.sourceforge.net/>

iD8DBQFGm4ZtPK2zrJwS/lYRAuvQAJ9MjWI43AS/S2O20HVuI39Vy8zzqwCdEPsb
EiS1ty7IBxwoJr3TLI2mLZY=
=vntQ
-----END PGP SIGNATURE-----
_______________________________________________
Xplor-nih mailing list
[email protected]
http://dcb.cit.nih.gov/mailman/listinfo/xplor-nih

Reply via email to