Ejemplo n.º 1
0
def get_residues_from_radius(radius, ref):
    asl = 'fillres ((within %i ligand ) and not (res.ptype "T3P"))' % (int(float(radius)))
    st=StructureReader(ref).next()
    atoms=evaluate_asl(st, asl)
    if len(atoms)==0:
        print "NO LIGAND IN REFERENCE FILE"
        print "no ligand in reference file"
        sys.exit()
    pocket=st.extract(atoms)
    resnames=[i.pdbres for i in pocket.residue]
    resnums=[i.resnum for i in pocket.residue]
    chains=[i.chain for i in pocket.residue]
    data=dict()
    for chain in set(chains):
        for (n,c) in zip(resnums, chains):
            if c not in data.keys():
                data[c]=[]
            if str(n) not in data[c]:
                data[c].append(str(n))
    selection=[]
    for chain in data.keys():
        selection.append(','.join(data[chain]) + '.%s' % chain)
    if len(selection)==1:
        selection=[selection,]
    return selection
Ejemplo n.º 2
0
def get_residues_from_radius(radius, ref):
    asl = 'fillres ((within %i ligand ) and not (res.ptype "T3P"))' % (int(
        float(radius)))
    st = StructureReader(ref).next()
    atoms = evaluate_asl(st, asl)
    if len(atoms) == 0:
        print "NO LIGAND IN REFERENCE FILE"
        print "no ligand in reference file"
        sys.exit()
    pocket = st.extract(atoms)
    resnames = [i.pdbres for i in pocket.residue]
    resnums = [i.resnum for i in pocket.residue]
    chains = [i.chain for i in pocket.residue]
    data = dict()
    for chain in set(chains):
        for (n, c) in zip(resnums, chains):
            if c not in data.keys():
                data[c] = []
            if str(n) not in data[c]:
                data[c].append(str(n))
    selection = []
    for chain in data.keys():
        selection.append(','.join(data[chain]) + '.%s' % chain)
    if len(selection) == 1:
        selection = [
            selection,
        ]
    return selection
Ejemplo n.º 3
0
def check_selection_boolean(ref, target):
    st=StructureReader(ref).next()
    atoms=evaluate_asl(st, 'all')
    sub=st.extract(atoms)
    resnames=[i.pdbres.rstrip() for i in sub.residue]
    if target in resnames:
        verdict=True
    else:
        verdict=False
    return verdict
Ejemplo n.º 4
0
def check_selection_boolean(ref, target):
    st = StructureReader(ref).next()
    atoms = evaluate_asl(st, 'all')
    sub = st.extract(atoms)
    resnames = [i.pdbres.rstrip() for i in sub.residue]
    if target in resnames:
        verdict = True
    else:
        verdict = False
    return verdict