You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@@ -15,118 +15,27 @@ However, your life would be easier if you run this black box objective function
15
15
16
16
## How to run
17
17
18
-
You can either run this objective function in your current environment (assuming that you have the correct dependencies installed), or you can run it in an isolated environment.
19
-
20
-
::::{tab-set}
21
-
22
-
:::{tab-item} In the `poli__rasp` environment
23
-
24
-
To run this black box function directly (which is useful for debugging, or when you are interested in setting breakpoints and inspecting the objects directly), we recommend you run it from inside the `poli__rasp` environment, or make sure you satisfy all its requirements.
x = np.array([list(mutation) for mutation in three_mutations])
73
-
74
-
# y is approx [[0.03, -0.07, -0.28]]
75
-
y = f(x)
76
-
```
77
-
78
-
:::
28
+
# Creating the black box
29
+
f = RaspBlackBox(wildtype_pdb_path=[wildtype_pdb_path])
79
30
80
-
:::{tab-item} In isolation
81
-
82
-
Assuming you have [`3ned.pdb`](https://www.rcsb.org/structure/3ned) in the same directory as this script:
83
-
84
-
```python
85
-
from pathlib import Path
86
-
87
-
import numpy as np
88
-
89
-
from poli import objective_factory
90
-
91
-
THIS_DIR= Path(__file__).parent.resolve()
92
-
93
-
if__name__=="__main__":
94
-
wildtype_pdb_paths_for_rasp = [
95
-
THIS_DIR/"3ned.pdb",
96
-
# You could have more if you want.
97
-
]
98
-
99
-
f_rasp, x0, y0 = objective_factory.create(
100
-
name="rasp",
101
-
wildtype_pdb_path=wildtype_pdb_paths_for_rasp,
102
-
)
103
-
104
-
# Getting the wildtype string
105
-
wildtype_string ="".join(x0[0])
106
-
107
-
# Mutating the first position three times:
108
-
three_mutations = [
109
-
"A"+ wildtype_sequence[1:],
110
-
"R"+ wildtype_sequence[1:],
111
-
"N"+ wildtype_sequence[1:],
112
-
]
113
-
114
-
# Computing the ddG for these three mutations:
115
-
x = np.array([list(mutation) for mutation in three_mutations])
116
-
117
-
# y is approx [[0.03, -0.07, -0.28]]
118
-
y = f(x)
119
-
```
120
-
121
-
```{warning}
122
-
Registering the objective function in this way will create a `conda` environment called `poli__rasp` with the relevant dependencies. You can find the exact environment description in the following file: `src/poli/objective_repository/rasp/environment.yml`
31
+
# Creating a problem
32
+
problem = RaspProblemFactory().create(wildtype_pdb_path=[wildtype_pdb_path])
Copy file name to clipboardExpand all lines: docs/poli-docs/_build/html/using_poli/objective_repository/RaSP.html
+10-90Lines changed: 10 additions & 90 deletions
Original file line number
Diff line number
Diff line change
@@ -600,105 +600,25 @@ <h2>Prerequisites<a class="headerlink" href="#prerequisites" title="Permalink to
600
600
</section>
601
601
<sectionid="how-to-run">
602
602
<h2>How to run<aclass="headerlink" href="#how-to-run" title="Permalink to this heading">#</a></h2>
603
-
<p>You can either run this objective function in your current environment (assuming that you have the correct dependencies installed), or you can run it in an isolated environment.</p>
In the <codeclass="docutils literal notranslate"><spanclass="pre">poli__rasp</span></code> environment</label><divclass="sd-tab-content docutils">
608
-
<p>To run this black box function directly (which is useful for debugging, or when you are interested in setting breakpoints and inspecting the objects directly), we recommend you run it from inside the <codeclass="docutils literal notranslate"><spanclass="pre">poli__rasp</span></code> environment, or make sure you satisfy all its requirements.</p>
609
-
<p>To create this environment, run</p>
610
-
<divclass="highlight-bash notranslate"><divclass="highlight"><pre><span></span><spanclass="c1"># From the root of the `poli` repository</span>
<p>Assuming you have <aclass="reference external" href="https://www.rcsb.org/structure/3ned"><codeclass="docutils literal notranslate"><spanclass="pre">3ned.pdb</span></code></a> in the same directory as this script:</p>
In isolation</label><divclass="sd-tab-content docutils">
659
-
<p>Assuming you have <aclass="reference external" href="https://www.rcsb.org/structure/3ned"><codeclass="docutils literal notranslate"><spanclass="pre">3ned.pdb</span></code></a> in the same directory as this script:</p>
<p>Registering the objective function in this way will create a <codeclass="docutils literal notranslate"><spanclass="pre">conda</span></code> environment called <codeclass="docutils literal notranslate"><spanclass="pre">poli__rasp</span></code> with the relevant dependencies. You can find the exact environment description in the following file: <codeclass="docutils literal notranslate"><spanclass="pre">src/poli/objective_repository/rasp/environment.yml</span></code></p>
699
-
</div>
700
-
</div>
701
-
</div>
702
622
</section>
703
623
<sectionid="warnings">
704
624
<h2>Warnings<aclass="headerlink" href="#warnings" title="Permalink to this heading">#</a></h2>
Copy file name to clipboardExpand all lines: docs/poli-docs/using_poli/objective_repository/RaSP.md
+9-102Lines changed: 9 additions & 102 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -15,118 +15,25 @@ However, your life would be easier if you run this black box objective function
15
15
16
16
## How to run
17
17
18
-
You can either run this objective function in your current environment (assuming that you have the correct dependencies installed), or you can run it in an isolated environment.
19
-
20
-
::::{tab-set}
21
-
22
-
:::{tab-item} In the `poli__rasp` environment
23
-
24
-
To run this black box function directly (which is useful for debugging, or when you are interested in setting breakpoints and inspecting the objects directly), we recommend you run it from inside the `poli__rasp` environment, or make sure you satisfy all its requirements.
f = RaspBlackBox(wildtype_pdb_path=[wildtype_pdb_path])
92
28
93
-
if__name__=="__main__":
94
-
wildtype_pdb_paths_for_rasp = [
95
-
THIS_DIR/"3ned.pdb",
96
-
# You could have more if you want.
97
-
]
29
+
# Creating a problem
30
+
problem = RaspProblemFactory().create(wildtype_pdb_path=[wildtype_pdb_path])
31
+
f, x0 = problem.black_box, problem.x0
98
32
99
-
f_rasp, x0, y0 = objective_factory.create(
100
-
name="rasp",
101
-
wildtype_pdb_path=wildtype_pdb_paths_for_rasp,
102
-
)
103
-
104
-
# Getting the wildtype string
105
-
wildtype_string ="".join(x0[0])
106
-
107
-
# Mutating the first position three times:
108
-
three_mutations = [
109
-
"A"+ wildtype_sequence[1:],
110
-
"R"+ wildtype_sequence[1:],
111
-
"N"+ wildtype_sequence[1:],
112
-
]
113
-
114
-
# Computing the ddG for these three mutations:
115
-
x = np.array([list(mutation) for mutation in three_mutations])
116
-
117
-
# y is approx [[0.03, -0.07, -0.28]]
118
-
y = f(x)
33
+
# Querying:
34
+
print(f(x0))
119
35
```
120
36
121
-
```{warning}
122
-
Registering the objective function in this way will create a `conda` environment called `poli__rasp` with the relevant dependencies. You can find the exact environment description in the following file: `src/poli/objective_repository/rasp/environment.yml`
0 commit comments