|
38 | 38 | " \"\"\" Human readable report on atoms used for the mapping.\"\"\"\n", |
39 | 39 | " atoms_in_A = list(mapping.keys())\n", |
40 | 40 | " stream = open('somd.mapping','w')\n", |
| 41 | + " atAdone = []\n", |
| 42 | + " atBdone= []\n", |
41 | 43 | " for atAidx in atoms_in_A:\n", |
42 | 44 | " atA = ligA._sire_molecule.select(atAidx)\n", |
43 | 45 | " atB = ligB._sire_molecule.select(mapping[atAidx])\n", |
44 | | - " stream.write(\"%s --> %s\\n\" % (atA.name(),atB.name()))\n", |
| 46 | + " stream.write(\"%s %s --> %s %s\\n\" % (atA.index(), atA.name(),atB.index(), atB.name()))\n", |
| 47 | + " atAdone.append(atA)\n", |
| 48 | + " atBdone.append(atB)\n", |
| 49 | + " for atom in ligA._sire_molecule.atoms():\n", |
| 50 | + " if atom in atAdone:\n", |
| 51 | + " continue\n", |
| 52 | + " stream.write(\"%s %s --> dummy\\n\" % (atom.index(), atom.name()))\n", |
| 53 | + " for atom in ligB._sire_molecule.atoms():\n", |
| 54 | + " if atom in atBdone:\n", |
| 55 | + " continue\n", |
| 56 | + " stream.write(\"dummy --> %s %s\\n\" % (atom.index(), atom.name()))\n", |
45 | 57 | " stream.close()" |
46 | 58 | ] |
47 | 59 | }, |
|
72 | 84 | "source": [ |
73 | 85 | "node.addInput(\"input1\", BSS.Gateway.FileSet(help=\"A topology and coordinates file\"))\n", |
74 | 86 | "node.addInput(\"input2\", BSS.Gateway.FileSet(help=\"A topology and coordinates file\"))\n", |
75 | | - "node.addInput(\"prematch\", BSS.Gateway.String(help=\"list of atom indices that are matched between input1 and input2. Syntax is of the format 1-3,4-8,9-11...\", default=\"\"))\n", |
| 87 | + "node.addInput(\"prematch\", BSS.Gateway.String(help=\"list of atom indices that are matched between input2 and input1. Syntax is of the format 1-3,4-8,9-11...\", default=\"\"))\n", |
76 | 88 | "node.addInput(\"output\", BSS.Gateway.String(help=\"The root name for the files describing the perturbation input1->input2.\"))" |
77 | 89 | ] |
78 | 90 | }, |
|
103 | 115 | "# Optional input, dictionary of Atom indices that should be matched in the search. \n", |
104 | 116 | "prematch = {}\n", |
105 | 117 | "prematchstring = node.getInput(\"prematch\")\n", |
106 | | - "entries = prematchstring.split(\",\")\n", |
107 | | - "for entry in entries:\n", |
108 | | - " idxA, idxB = entry.split(\"-\")\n", |
109 | | - " prematch[ AtomIdx( int(idxA)) ] = AtomIdx( int(idxB) )\n", |
110 | | - "print (prematch)" |
| 118 | + "if len(prematchstring) > 0: \n", |
| 119 | + " entries = prematchstring.split(\",\")\n", |
| 120 | + " for entry in entries:\n", |
| 121 | + " idxA, idxB = entry.split(\"-\")\n", |
| 122 | + " prematch[ AtomIdx( int(idxA)) ] = AtomIdx( int(idxB) )\n", |
| 123 | + "#print (prematch)" |
111 | 124 | ] |
112 | 125 | }, |
113 | 126 | { |
|
148 | 161 | "outputs": [], |
149 | 162 | "source": [ |
150 | 163 | "# Return a maximum of 10 matches, scored by RMSD and sorted from best to worst.\n", |
151 | | - "mappings = BSS.Align.matchAtoms(lig1, lig2, matches=10, prematch=prematch)\n", |
| 164 | + "mappings = BSS.Align.matchAtoms(lig1, lig2, matches=10, prematch=prematch, scoring_function=\"RMSD\", timeout=1*BSS.Units.Time.minute)\n", |
152 | 165 | "# We retain the top mapping\n", |
153 | 166 | "mapping = mappings[0]\n", |
154 | | - "print (len(mappings))\n", |
155 | | - "print (mappings)" |
156 | | - ] |
157 | | - }, |
158 | | - { |
159 | | - "cell_type": "code", |
160 | | - "execution_count": null, |
161 | | - "metadata": {}, |
162 | | - "outputs": [], |
163 | | - "source": [ |
164 | | - "for x in range(0,len(mappings)):\n", |
165 | | - " print (mappings[x])\n", |
166 | | - " print (\"-----------\")" |
| 167 | + "#print (len(mappings))\n", |
| 168 | + "#print (mappings)" |
167 | 169 | ] |
168 | 170 | }, |
169 | 171 | { |
|
267 | 269 | "name": "python", |
268 | 270 | "nbconvert_exporter": "python", |
269 | 271 | "pygments_lexer": "ipython3", |
270 | | - "version": "3.5.5" |
| 272 | + "version": "3.7.1" |
271 | 273 | } |
272 | 274 | }, |
273 | 275 | "nbformat": 4, |
|
0 commit comments