Skip to content

Commit

Permalink
#3372 - Update customQuery for bonds using topology (#3374)
Browse files Browse the repository at this point in the history
  • Loading branch information
AKZhuk authored Sep 28, 2023
1 parent 8660fdc commit e11818d
Showing 1 changed file with 23 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -149,23 +149,31 @@ function customQueryValid(customQuery: string, isCustomQuery: boolean) {
function getBondCustomQuery(bond: BondSettings) {
let queryAttrsText = '';
const { type, topology } = bond;
const bondType = {
single: '-',
double: '=',
triple: '#',
aromatic: ':',
any: '~',
up: '/',
down: '\\',
const patterns = {
bondType: {
single: '-',
double: '=',
triple: '#',
aromatic: ':',
any: '~',
up: '/',
down: '\\',
},
topology: {
[CoreBond.PATTERN.TOPOLOGY.RING]: '@',
[CoreBond.PATTERN.TOPOLOGY.CHAIN]: '!@',
},
};
if (type in bondType) {
queryAttrsText += bondType[type];
}
if (queryAttrsText) {
queryAttrsText += ';';

if (type in patterns.bondType) {
queryAttrsText += patterns.bondType[type];
}
if (topology === CoreBond.PATTERN.TOPOLOGY.RING) {
queryAttrsText += '@';

if (topology && topology in patterns.topology) {
if (queryAttrsText) {
queryAttrsText += ';';
}
queryAttrsText += patterns.topology[topology];
}
return queryAttrsText;
}
Expand Down

0 comments on commit e11818d

Please sign in to comment.