Пример #1
0
def get_topologies(toplist):
    topfiles = [
        currdir + "/oplsx-top.json",
        currdir + "/dna-rna-top.json",
    ]

    for f in toplist:
        print(f, file=sys.stderr)
        assert os.path.exists(f), f
        topfiles.append(f)

    topologies = []
    for f in topfiles:
        try:
            topologies.append(topology.load(json.load(open(f))))
        except:
            print(f, file=sys.stderr)
            raise
    top_residues, top_patches = topology.merge(topologies)
    return top_residues, top_patches
Пример #2
0
    raise ValueError("--readpatch and explicit patch specification via --patch are mutually incompatible")

for f in args.topfile:
    assert os.path.exists(f), f
    topfiles.append(f)
for f in args.transfile:
    transfiles.append(f)

topologies = []
for f in topfiles:
    try:
        topologies.append(topology.load(json.load(open(f))))
    except:
        print(f, file=sys.stderr)
        raise
top_residues, top_patches = topology.merge(topologies)

for f in transfiles:
    name = os.path.splitext(os.path.split(f)[1])[0]
    parse_transfile(f, name)

mutations={}
for f in args.mutatefiles:
    assert os.path.exists(f), f
    for l in open(f):
        h = l.find("#")
        if h != -1: l = l[:h]
        ll = l.split()
        if len(ll) == 0: continue
        assert len(ll) == 2, l
        mutations[ll[0]] = ll[1]
Пример #3
0
currdir = os.path.abspath(os.path.split(__file__)[0])
allatomdir = currdir + "/../allatom"
sys.path.append(allatomdir)
import topology as topology_lib
topfiles = [
    allatomdir + "/oplsx-top.json",
    allatomdir + "/dna-rna-top.json",
]
topologies = []
for f in topfiles:
    try:
        topologies.append(topology_lib.load(json.load(open(f))))
    except:
        print >> sys.stderr, f
        raise
topology = topology_lib.merge(topologies)


def make_interfacelist(ilist, pdb):
    # Read interface residues from files
    data = open(ilist).readlines()
    data = [l for l in data if not l[0] == '#']
    if len(data) == 0:
        return [], []

    rlist = np.loadtxt(ilist, dtype=int)
    # Make list of corresponding atoms
    ratoms = []
    receptorid = []
    data = open(pdb).readlines()
    data = [x for x in data if 'ATOM' in x]