Exemplo n.º 1
0
    print '{0} sampling REMAIN'.format(args.nt0-it0)
    # Define the cpptraj script
    t0 = 1+it0*dt0   # first frame
    tf = t0+args.t-1   # last frame
    script = template.replace('_t0_', str(t0))
    script = script.replace('_t0+t_', str(tf))
    handle,outfn = mkstemp(prefix='junk', dir='/tmp')
    script = script.replace('_outfn_', outfn)

    # Run the cpptraj job
    handle,scriptfile = mkstemp(prefix='junk', dir='/tmp')
    open(scriptfile,'w').write(script)
    os.system('cpptraj {0} -i {1}'.format(args.topfile, scriptfile))
    
    # Store results to memory
    rmsd = numpy.array( read_column(outfn, 2, isFloat=1) )
    if args.msd:
        msd = numpy.average(rmsd*rmsd)
        series += '{0:3d} {1:5.2f}\n'.format(it0, msd)
        av += msd
    else:
        rmsd = numpy.average(rmsd)
        series += '{0:3d} {1:5.2f}\n'.format(it0, rmsd)
        av += rmsd
       
    os.system('/bin/rm -f {0} {1}'.format(outfn,scriptfile))

# Write output files
open(args.outfile,'w').write('{0}\n'.format(av/args.nt0))
if args.seriesfile:
    open(args.seriesfile,'w').write(series)
Exemplo n.º 2
0
import argparse
from pdb import set_trace as tr
from utilities.readingWritingFiles import read_column

parser = argparse.ArgumentParser(description='Extract, for each residue, the maximum residence time among the simulations with isopropanol ranging from 15% to 30%')
parser.add_argument('maxTfile',help='output file containing the maximum times')
args = parser.parse_args()

isos='0.15 0.20 0.25 0.30'.split() # isopropanol concentraitons
tdat='/projects2/research/dhfr_solv/out/isopropanol/_ISO_/solv/Prod/mdprod/isoResidenceTimes.dat' # template file
nres=161 # number of residues (includes the cofactor and ligand)
maxtimes=[0]*nres
for iso in isos:
    dat=tdat.replace('_ISO_',iso)
    times=read_column(dat, 2, isFloat=1)
    for i in range(nres):
        if maxtimes[i] < times[i]: maxtimes[i] = times[i]

buf='# residue maximum-residence-time\n'
for ires in range(nres):
    buf += '{0:3d} {1:6.0f}\n'.format(1+ires, maxtimes[ires])
open(args.maxTfile, 'w').write(buf)

Exemplo n.º 3
0
import argparse
from mypdb.smallThings import insertBfact
from utilities.readingWritingFiles import read_column

parser = argparse.ArgumentParser(description='insert Bfactor into a PDB file')
parser.add_argument('inpdb',help='input PDB file')
parser.add_argument('bfile',help='file containing the B-factors')
parser.add_argument('outpdb', help='output PDB file')
parser.add_argument('--icol', type=int, default=1, help='column in bfile for the B-factors. Default=1')
parser.add_argument('--byres', default='no', help='are the  b-factors in bfile per residue basis? Default=no')
parser.add_argument('--rescale', default='no', help='rescale to range [0,100]. Useful if bfile contains negative B-factors')
args = parser.parse_args()

# Are the B-factors only provided for the whole residue
if args.byres.lower()[0] == 'y':
    args.byres = True
else:
    args.byres = False

# Do we rescale?
if args.rescale.lower()[0] == 'y':
    args.rescale = True
else:
    args.rescale = False

blist = read_column(args.bfile, args.icol, isFloat=1)
buf = insertBfact(args.inpdb, blist, byres=args.byres, rescale=args.rescale)
open(args.outpdb,'w').write(buf)