Skip to content

Commit

Permalink
rf_*.sh scripts
Browse files Browse the repository at this point in the history
  • Loading branch information
IanAWatson committed Nov 17, 2024
1 parent 40f3dbd commit 521cd3a
Show file tree
Hide file tree
Showing 4 changed files with 149 additions and 116 deletions.
9 changes: 9 additions & 0 deletions contrib/bin/rf_evaluate.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#!/bin/bash

if [[ ! LILLYMOL_HOME ]] ; then
export LILLYMOL_HOME=$(dirname $0)/../..
fi

export PATH=${LILLYMOL_HOME}/contrib/bin:$PATH

exec ruby ${LILLYMOL_HOME}/contrib/bin/xgbd/rf_evaluate.rb "$@"
6 changes: 6 additions & 0 deletions contrib/bin/rf_make.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#!/bin/bash
if [[ ! LILLYMOL_HOME ]] ; then
export LILLYMOL_HOME=$(dirname $0)/../..
fi

exec python ${LILLYMOL_HOME}/contrib/bin/xgbd/rf_make.py "$@"
65 changes: 30 additions & 35 deletions src/Molecule_Lib/atom_typing.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1207,7 +1207,7 @@ determine_ring_status(Molecule& m, int* ring_status) {
const int ring_size = ri->number_elements();

for (int j = 0; j < ring_size; ++j) {
const auto k = ri->item(j);
const atom_number_t k = ri->item(j);

if (3 == ring_status[k]) { // has been identified as aromatic, so it is in both
// aliphatic and aromatic rings
Expand Down Expand Up @@ -1456,7 +1456,7 @@ int
assign_atom_types_nox(const Molecule& m, T* atype) {
const int matoms = m.natoms();

for (auto i = 0; i < matoms; ++i) {
for (int i = 0; i < matoms; ++i) {
const atomic_number_t z = m.atomic_number(i);

if (6 == z) {
Expand Down Expand Up @@ -1487,7 +1487,7 @@ assign_atom_types_nox(const Molecule& m, T* atype) {
template <typename T>
int
Atom_Typing_Specification::_assign_atom_types_pharmacophore(Molecule& m, T* atype) {
const auto matoms = m.natoms();
const int matoms = m.natoms();

// cerr << "Atom_Typing_Specification::_assign_atom_types_pharmacophore, ust " <<
// _user_specified_type << '\n';
Expand All @@ -1510,7 +1510,7 @@ Atom_Typing_Specification::_assign_atom_types_pharmacophore(Molecule& m, T* atyp

Molecule_to_Match target(&m);

for (auto i = 0; i < _hydrophobe.number_elements(); ++i) {
for (int i = 0; i < _hydrophobe.number_elements(); ++i) {
Substructure_Results sresults;

uint32_t nhits = _hydrophobe[i]->substructure_search(target, sresults);
Expand All @@ -1528,12 +1528,12 @@ Atom_Typing_Specification::_assign_atom_types_pharmacophore(Molecule& m, T* atyp
}
}

for (auto i = 0; i < matoms; ++i) {
for (int i = 0; i < matoms; ++i) {
const Atom* a = m.atomi(i);

const auto dai = da[i];
const int dai = da[i];

const auto fc = a->formal_charge();
const formal_charge_t fc = a->formal_charge();

if (0 == dai && 0 == fc) {
if (_assign_other_type) {
Expand Down Expand Up @@ -1569,7 +1569,7 @@ Atom_Typing_Specification::_assign_atom_types_pharmacophore(Molecule& m, T* atyp

if (_write_isotopically_labelled.active()) {
Molecule mcopy(m);
for (auto i = 0; i < matoms; ++i) {
for (int i = 0; i < matoms; ++i) {
mcopy.set_isotope(i, atype[i]);
}
_write_isotopically_labelled.write(mcopy);
Expand Down Expand Up @@ -1989,17 +1989,17 @@ Atom_Typing_Specification::_perform_shell_expansion_v2(Molecule& m, T* atype) co
}

m.compute_aromaticity_if_needed();
const auto matoms = m.natoms();
const int matoms = m.natoms();

assert(sizeof(T) == sizeof(int));

// hopefully one larger allocation faster than two smaller
int* complete = new int[matoms + matoms];
std::unique_ptr<int[]> free_complete(
complete); // hopefully one larger allocation faster than two smaller
std::unique_ptr<int[]> free_complete(complete);
T* newtype = reinterpret_cast<T*>(complete + matoms);

for (auto i = 0; i < _perform_shell_iteration; ++i) {
for (auto j = 0; j < matoms; j++) {
for (int i = 0; i < _perform_shell_iteration; ++i) {
for (int j = 0; j < matoms; j++) {
std::fill_n(complete, matoms, 0);

newtype[j] = _perform_shell_iteration_v2(m, j, atype, complete,
Expand Down Expand Up @@ -2031,17 +2031,12 @@ Atom_Typing_Specification::_perform_shell_iteration_v2(Molecule& m,
int radius) const {
complete[zatom] = 1;

int rc = 792 * atype[zatom] + radius -
_perform_shell_iteration; // we want the first iteration of expansion to
// reflect the proper atom type

const Atom* a = m.atomi(zatom);

auto acon = a->ncon();
// we want the first iteration of expansion to
// reflect the proper atom type
int rc = 792 * atype[zatom] + radius - _perform_shell_iteration;

for (auto i = 0; i < acon; ++i) {
const Bond* b = a->item(i);
auto j = b->other(zatom);
for (const Bond* b : m[zatom]) {
atom_number_t j = b->other(zatom);

if (complete[j]) {
continue;
Expand Down Expand Up @@ -2248,9 +2243,9 @@ Atom_Typing_Specification::_ust_assign_atom_types_aromatic_all_the_same(Molecule
return 1;
}

const auto matoms = m.natoms();
const int matoms = m.natoms();

for (auto i = 0; i < matoms; ++i) {
for (int i = 0; i < matoms; ++i) {
if (m.is_aromatic(i)) {
atype[i] = TYPE_M_COMMON_AROMATIC_TYPE;
}
Expand Down Expand Up @@ -2302,12 +2297,12 @@ ust_assign_atom_types_t_ring(Molecule& m, const Ring& r, T* atype) {

Set_of_Atoms two_connected_nitrogen_count, exocyclic_oxygen;

for (auto i = 0; i < ring_size; ++i) {
const auto j = r[i];
for (int i = 0; i < ring_size; ++i) {
const atom_number_t j = r[i];

const auto a = m.atomi(j);
const Atom* a = m.atomi(j);

const auto z = a->atomic_number();
const atomic_number_t z = a->atomic_number();

if (7 == z && 2 == a->ncon()) {
two_connected_nitrogen_count.add(j);
Expand All @@ -2322,14 +2317,14 @@ ust_assign_atom_types_t_ring(Molecule& m, const Ring& r, T* atype) {
continue;
}

for (auto k = 0; k < 3; ++k) {
for (int k = 0; k < 3; ++k) {
const Bond* b = a->item(k);

if (b->nrings()) {
continue;
}

const auto o = b->other(j);
const atom_number_t o = b->other(j);

if (1 == m.ncon(o) && 8 == m.atomic_number(o)) { // =O or -O is fine
exocyclic_oxygen.add(o);
Expand Down Expand Up @@ -3076,17 +3071,17 @@ Atom_Typing_Specification::_build_pharmacophore_specification(

static int
string_interpolation(const const_IWSubstring& starting_string, IWString& expanded) {
auto dollar = starting_string.index("${");
int dollar = starting_string.index("${");
if (dollar < 0) {
expanded = starting_string;
return 1;
}

const auto n = starting_string.length();
const int n = starting_string.length();

int closing_brace = -1;

for (auto i = dollar + 2; i < n; ++i) {
for (int i = dollar + 2; i < n; ++i) {
if ('}' == starting_string[i]) {
closing_brace = i;
break;
Expand Down Expand Up @@ -3164,7 +3159,7 @@ Atom_Typing_Specification::_build_pharmacophore_specification(
input.set_strip_trailing_blanks(1);
input.set_skip_blank_lines(1);

auto echo_inputs = false;
int echo_inputs = false;

const_IWSubstring buffer;

Expand Down
Loading

0 comments on commit 521cd3a

Please sign in to comment.