14 from time
import clock
15 from shutil
import rmtree
27 Basic vacinity and interface class...
32 Get vaccinity around each loop/residue/chain specified in LisLoop.
33 Returns a VacDic: ([res:chain]=atomic contact #)
34 Needs to be rewritten using Evan's way of finding neighbors.
40 resList = loops.loopArea(p, LisLoop, 0)
45 resNum = res[0]; resChain = res[1]
46 if pdb_map[i][
"resNum"]==resNum
and pdb_map[i][
"chain"]==resChain:
48 pdbResCoord[resNum+
":"+resChain] = (
float(pdb_map[i][
"x"]),
float(pdb_map[i][
"y"]),
float(pdb_map[i][
"z"]))
52 for res
in pdbResCoord:
54 xyz2 = (
float(pdb_map[i][
"x"]),
float(pdb_map[i][
"y"]),
float(pdb_map[i][
"z"]))
55 res_chain = pdb_map[i][
"resNum"]+
":"+pdb_map[i][
"chain"]
56 d = tools.general_tools.getDistGen(pdbResCoord[res], xyz2)
61 if vacDic.has_key(res_chain):
65 for res
in pdbResCoord:
68 print "Residues in Vacinity:"
69 print "Residue: " +key
71 print "Total Residues in Vicinity: " +repr(
len(vacDic))
76 Gets residues common to your interface of chainA and chainB
77 Returns a VacDic: ([res:chain]=atomic contact #)
86 chainList = []; chainList.append(chain)
88 resList = loops.loopArea(p, chainList, 0)
93 resNum = res[0]; resChain = res[1]
94 if pdb_map[i][
"resNum"]==resNum
and pdb_map[i][
"chain"]==resChain:
96 pdbResCoord[resNum+
":"+resChain] = (
float(pdb_map[i][
"x"]),
float(pdb_map[i][
"y"]),
float(pdb_map[i][
"z"]))
99 print "Calculating Distances...."
100 for res
in pdbResCoord:
102 xyz2 = (
float(pdb_map[i][
"x"]),
float(pdb_map[i][
"y"]),
float(pdb_map[i][
"z"]))
103 res_chain = pdb_map[i][
"resNum"]+
":"+pdb_map[i][
"chain"]
105 d = tools.general_tools.getDistGen(pdbResCoord[res], xyz2)
106 if (d <= cutoff)
and pdb_map[i][
"chain"]==chainB:
110 if interDic.has_key(res_chain):
111 interDic[res_chain]+=1
113 interDic[res_chain]=1
115 if interDic.has_key(res):
122 print "Residues in interface between chain"+chainA+
"and chain "+chainB+
":"
123 print "Residue: " +key
125 print "Total Residues in half interface: " +repr(
len(interDic))
129 interfaceDic = dict();
133 interfaceSP = interface.split(
":")
134 if len(interfaceSP)==1:
135 print "Please specify an actual interface..."
139 tempdir = pwd +
"/temp2/" +
"_"+repr(t)
141 temp = tempdir +
"/temp.pdb"; p.dump_pdb(temp)
147 tempinterface = interfaceSP
148 interfaceDic = dict();
150 while len(tempinterface) >1:
151 for chains
in interfaceSP:
152 tempinterface.remove(chains)
153 for chainA
in chains:
154 for x
in tempinterface:
156 print chainA+
":"+chainB
160 for chains
in interfaceSP:
161 allchains = chains+allchains
163 for chain
in allchains:
164 LisLoop.append(
"::"+chain)
166 interfaceDic[item] = []
168 tempLoop.append(item);
169 itemSP = item.split(
":")
172 keySP = key.split(
":")
173 if keySP[1] != chain:
174 interfaceDic[item].append(key)
183 self.
cdrDic[
"L1"]=(24, 42)
184 self.
cdrDic[
"L2"]=(57, 72)
185 self.
cdrDic[
"L3"]=(107, 138)
187 self.
cdrDic[
"H1"]=(24, 42)
188 self.
cdrDic[
"H2"]=(57, 69)
189 self.
cdrDic[
"H3"]=(107, 138)
193 This function gets the residues making contact - any contact - with other residues not in H or L.
194 It returns the residues within the CDR's for use in other things.
195 Must be renumbered antibodies.
196 Should be expanded to get more data and help in analysis of individual CDR residue contacts with other CDRs and the framework/dimer interface.
200 contactResidues = dict()
203 start = p.pdb_info().pdb2pose(key[0], self.
cdrDic[key][0])
204 end = p.pdb_info().pdb2pose(key[0], self.
cdrDic[key][1])
205 for i
in range(start, end+1):
207 x = (p.pdb_info().pose2pdb(i)).
split()
208 LisLoop.append(x[0]+
":"+x[0]+
":"+x[1])
209 residue = x[0]+
":"+x[0]+
":"+x[1]
210 vacDic = tools.input.load_vicinity(p, LisLoop, cutoff)
212 keySP = key.split(
":")
213 if (keySP[1]!=
"H")
and (keySP[1]!=
"L"):
214 if contactResidues.has_key(residue):
215 contactResidues[residue]+=1
217 contactResidues[residue]=1
218 print "CDR Residues in Contact with Antigen: "+repr(contactResidues)
219 return contactResidues
Fstring::size_type len(Fstring const &s)
Length.
utility::vector1< std::string > split(const std::string &s)
split given std::string using ' ' symbol.