Skip to content

Commit

Permalink
Removed allow violations option as it is not needed anymore
Browse files Browse the repository at this point in the history
  • Loading branch information
okkevaneck committed Aug 13, 2023
1 parent f5c5af4 commit d81953f
Show file tree
Hide file tree
Showing 5 changed files with 5 additions and 9 deletions.
Binary file modified archives/prospr_core.tar.gz
Binary file not shown.
Binary file modified archives/prospr_core.zip
Binary file not shown.
4 changes: 2 additions & 2 deletions prospr/core/core_module.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,10 @@ PYBIND11_MODULE(prospr_core, m) {
/* Protein class definition. */
py::class_<Protein>(m, "Protein")
.def(py::init<const std::string, int, const std::string,
std::map<std::string, int>, bool, bool &>(),
std::map<std::string, int>, bool &>(),
"Protein constructor", py::arg("sequence"), py::arg("dim") = 2,
py::arg("model") = "HP", py::arg("bond_values") = bond_values,
py::arg("bond_symmetry") = true, py::arg("allow_violations") = false)
py::arg("bond_symmetry") = true)
.def_property_readonly("solutions_checked",
&Protein::get_solutions_checked)
.def_property_readonly("aminos_placed", &Protein::get_aminos_placed)
Expand Down
7 changes: 2 additions & 5 deletions prospr/core/src/protein.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ Protein::Protein(const Protein &other) {
this->bond_values = other.bond_values;
this->weighted_amino_acids = other.weighted_amino_acids;
this->max_weights = other.max_weights;
this->allow_violations = other.allow_violations;

/* Create new AminoAcid objects for all amino acids. */
AminoAcid *new_aa;
Expand Down Expand Up @@ -61,8 +60,7 @@ Protein::Protein(const Protein &other) {

/* Construct a new Protein. */
Protein::Protein(std::string sequence, int dim, std::string model,
std::map<std::string, int> bond_values, bool bond_symmetry,
bool allow_violations) {
std::map<std::string, int> bond_values, bool bond_symmetry) {
this->sequence = sequence;
space = {};
cur_len = 0;
Expand All @@ -72,7 +70,6 @@ Protein::Protein(std::string sequence, int dim, std::string model,
score = 0;
solutions_checked = 0;
aminos_placed = 0;
this->allow_violations = allow_violations;

/* Deduct what model to use, or apply custom one. */
if (model == "HP") {
Expand Down Expand Up @@ -301,7 +298,7 @@ void Protein::place_amino(int move, bool track) {
last_pos[abs(move) - 1] += move / abs(move);

/* Check for illegal folds. */
if (!allow_violations && space.count(last_pos) > 0)
if (space.count(last_pos) > 0)
throw std::runtime_error("Protein folded onto itself..");

/* Place amino acid on new (valid) position. */
Expand Down
3 changes: 1 addition & 2 deletions prospr/core/src/protein.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ class Protein {
/* Construct a new Protein. */
Protein(std::string sequence, int dim = 2, std::string model = "HP",
std::map<std::string, int> bond_values = {},
bool bond_symmetry = true, bool allow_violations = false);
bool bond_symmetry = true);

/* Overload assignment operator for assignments. */
Protein &operator=(const Protein &other);
Expand Down Expand Up @@ -113,7 +113,6 @@ class Protein {
std::uint64_t aminos_placed;
std::uint64_t solutions_checked;
std::vector<AminoAcid *> amino_acids;
bool allow_violations;

/* Change score according to the already performed addition or removal
* of the given move.
Expand Down

0 comments on commit d81953f

Please sign in to comment.