#if verbose: print "now selStr", selStr
            # 'hsg1:A:ARG8,ILE82'
            #res, msg = CompoundStringSelector().select(ProteinSet([r]), n)
            res, msg = CompoundStringSelector().select(ProteinSet([r]), selStr)
            #if verbose: print selStr, " selection =", res, " msg=", msg, '\n'
            if len(res):
                all_res += res
            else:
                print "no residue found using string ", selStr
    #if verbose: print "built all_res=", all_res.full_name()
    #check for duplicates
    d = {}
    for res in all_res: d[res] = 1
    all_res = d.keys()
    all_res = ResidueSet(all_res).uniq()
    all_res.sort()
    if verbose: 
        print "located ", len(all_res),  " residues to format:"
        for z in all_res: print "   %s" %z.full_name()

    #inactivate specified bonds
    #disallowed_Pairs "CA_CB:CB_CG:C_CA"
    all_bnds = BondSet()
    #inactivate specified bonds
    #disallowed_pairs "CA_CB:CB_CG:C_CA"
    if len(disallowed_pairs):
        bnd_pairs = disallowed_pairs.split(':')
        for pair in bnd_pairs:
            names = pair.split('_')
            bnds = all_res.atoms.bonds[0].get(lambda x: x.atom1.name in names and x.atom2.name in names)
            if len(bnds):
Ejemplo n.º 2
0
            if result.__class__ == AtomSet:
                resS = result.parent.uniq()
            else:
                resS = result
            if len(resS):
                all_res += resS
            else:
                print("no residue found using string ", selStr)
    #if verbose: print "built all_res=", all_res.full_name()
    #check for duplicates
    d = {}
    for res in all_res:
        d[res] = 1
    all_res = list(d.keys())
    all_res = ResidueSet(all_res).uniq()
    all_res.sort()
    if verbose:
        print("located ", len(all_res), " residues to format:")
        for z in all_res:
            print("   %s" % z.full_name())

    all_bnds = BondSet()
    #inactivate bonds between specified atoms:
    #all_disallowed_pairs eg "1g9v_rec:A:ARG532:CA_CB,CB_CG,C_CA;1g9v_rec:B:ARG532:CA_CB,CB_CG"
    if len(all_disallowed_pairs):
        if verbose:
            print("line 183: all_disallowed_pairs = ", all_disallowed_pairs)
        disallowed_pairs = all_disallowed_pairs.split(
            ';')  #';' between different residues
        for dp in disallowed_pairs:  #1g9v_rec:A:ARG532:CA_CB,CB_CG,C_CA
            #find the residue