Skip to content
Snippets Groups Projects
Commit b0965642 authored by David Sehnal's avatar David Sehnal
Browse files

mol-model: added findAtomOnResidue

parent 60f55585
No related branches found
No related tags found
No related merge requests found
......@@ -169,7 +169,14 @@ export interface AtomicIndex {
* @param key
* @returns index or -1 if the atom is not present.
*/
findAtomAuth(key: AtomicIndex.AtomAuthKey): ElementIndex
findAtomAuth(key: AtomicIndex.AtomAuthKey): ElementIndex,
/**
* Find element index of an atom on a given residue.
* @param key
* @returns index or -1 if the atom is not present.
*/
findAtomOnResidue(residueIndex: ResidueIndex, label_atom_id: string, label_alt_id?: string): ElementIndex
// TODO: add indices that support comp_id?
}
......
......@@ -152,6 +152,14 @@ class Index implements AtomicIndex {
return findAtomByNameAndAltLoc(offsets[rI], offsets[rI + 1], this.map.auth_atom_id, this.map.label_alt_id, key.auth_atom_id, key.label_alt_id);
}
findAtomOnResidue(rI: ResidueIndex, label_atom_id: string, label_alt_id?: string) {
const offsets = this.map.segments.residueAtomSegments.offsets;
if (typeof label_alt_id === 'undefined') {
return findAtomByName(offsets[rI], offsets[rI + 1], this.map.label_atom_id, label_atom_id);
}
return findAtomByNameAndAltLoc(offsets[rI], offsets[rI + 1], this.map.label_atom_id, this.map.label_alt_id, label_atom_id, label_alt_id);
}
constructor(private map: Mapping) {
this.entityIndex = map.entities.getEntityIndex;
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment