-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: split groupedDiastereotopicAtomIDs (#42)
new function groupDiastereotopicAtomIDs exposed * fix: split groupedDiasterotopicAtomIDs * chore: update dependencies
- Loading branch information
Showing
4 changed files
with
25 additions
and
20 deletions.
There are no files selected for viewing
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
export function groupDiastereotopicAtomIDs(diaIDs, molecule, options) { | ||
const { atomLabel } = options; | ||
const diaIDsObject = {}; | ||
for (let i = 0; i < diaIDs.length; i++) { | ||
if (!atomLabel || molecule.getAtomLabel(i) === atomLabel) { | ||
let diaID = diaIDs[i]; | ||
if (!diaIDsObject[diaID]) { | ||
diaIDsObject[diaID] = { | ||
counter: 0, | ||
atoms: [], | ||
oclID: diaID, | ||
atomLabel: molecule.getAtomLabel(i), | ||
}; | ||
} | ||
diaIDsObject[diaID].counter++; | ||
diaIDsObject[diaID].atoms.push(i); | ||
} | ||
} | ||
|
||
return Object.keys(diaIDsObject).map((key) => diaIDsObject[key]); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters