Open leguilv opened 5 years ago
I do something similar with this function, this returns an AtomSet
given an array of ligand structures (queryStructures
) and a protein structure targetStructure
.
If you want to select particular ligand atoms it would need some adaptation but hopefully this gets you started:
function atomsNear (queryStructures, targetStructure, r) {
var atomSet = targetStructure.getAtomSet(false)
atomSet.clearAll(0)
for (var i = 0; i < queryStructures.length; i++) {
queryStructures[i].eachAtom(function (ap) {
var atomArray = targetStructure.spatialHash.within(ap.x, ap.y, ap.z, r)
for (var j = 0; j < atomArray.length; j++) {
atomSet.set(atomArray[j])
}
})
}
return atomSet
}
Then atomSet.toSeleString()
to get the selection string
Hi fredludlow
That works like a charm, and I assume that there is not much way of doing such a component to component operation (I'm also thinking about contacts...) except for doing it by hand like you suggested :)
Thanks !!
You can concatenate two molecules (see the test/concat example code) http://nglviewer.org/ngl/?script=test/concat
Source here: https://github.com/arose/ngl/blob/master/examples/scripts/test/concat.js
Hi there,
I've a simple case where I've loaded a PDB and a ligand, both separately, meaning they have their own components. Now want to be able to select atoms from the ligand, and get the atoms of the protein that are at a specific distance of the ligand.
Can't find a way to do that... I tried to create a selection from the ligand component and then use it to get protein atoms using getAtomSetWithinSelection but it does not work.
Any idea ?