Skip to content

Commit

Permalink
Updated Eq
Browse files Browse the repository at this point in the history
  • Loading branch information
alatham13 committed Dec 2, 2024
1 parent c98a2b6 commit 430ca69
Show file tree
Hide file tree
Showing 5 changed files with 28 additions and 212 deletions.
Binary file modified Jupyter/images/Input_trajectories.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
8 changes: 4 additions & 4 deletions Jupyter/spatiotemporal-colab.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -484,11 +484,11 @@
"\n",
"# Trajectory modeling step 1: gathering of information<a id=\"notebook_trajectories1\"></a>\n",
"\n",
"We begin trajectory modeling with the first step of integrative modeling, gathering information. Trajectory modeling utilizes dynamic information about the bimolecular process. In this case, we utilize heterogeneity models, snapshot models, physical theories, and synthetically generated small-angle X-ray scattering (SAXS) profiles.\n",
"We begin trajectory modeling with the first step of integrative modeling, gathering information. Trajectory modeling utilizes dynamic information about the bimolecular process. In this case, we utilize snapshot models, physical theories, and synthetically generated small-angle X-ray scattering (SAXS) profiles.\n",
"\n",
"<img src=\"images/Input_trajectories.png\" width=\"600px\" />\n",
"\n",
"Heterogeneity models inform the possible compositional states at each time point and measure how well a compositional state agrees with input information. Snapshot models provide structural models for each heterogeneity model and measure how well those structural models agree with input information about their structure. Physical theories of macromolecular dynamics inform transitions between states. SAXS data informs the size and shape of the assembling complex and is left for validation.\n",
"Snapshot models inform transitions between sampled time points, and their scores inform trajectory scores. Physical theories of macromolecular dynamics inform transitions between sampled time points. SAXS data informs the size and shape of the assembling complex and is left for validation.\n",
"\n",
"# Trajectory modeling step 2: representation, scoring function, and search process<a id=\"notebook_trajectories2\"></a>\n",
"\n",
Expand All @@ -504,10 +504,10 @@
"To score trajectory models, we incorporate both the scores of individual snapshot models, as well as the scores of transitions between them. Under the assumption that the process is Markovian (*i.e.* memoryless), the weight of a trajectory model takes the form:\n",
"\n",
"$$\n",
"W(\\chi) \\propto \\displaystyle\\prod^{T}_{t=0} P( X_{N,t}, N_{t} | D_{t}) \\cdot \\displaystyle\\prod^{T-1}_{t=0} W(X_{N,t+1},N_{t+1} | X_{N,t},N_{t}, D_{t,t+1}),\n",
"W(\\chi) \\propto \\displaystyle\\prod^{T}_{t=0} P( X_{t} | D_{t}) \\cdot \\displaystyle\\prod^{T-1}_{t=0} W(X_{t+1} | X_{t},D_{t,t+1}),\n",
"$$\n",
"\n",
"where $t$ indexes times from 0 until the final modeled snapshot ($T$); $P(X_{N,t}, N_{t} | D_{t})$ is the snapshot model score; and $W(X_{N,t+1},N_{t+1} | X_{N,t},N_{t}, D_{t,t+1})$ is the transition score. Trajectory model weights ($W(\\chi)$) are normalized so that the sum of all trajectory models' weights is 1.0. Transition scores are currently based on a simple metric that either allows or disallows a transition. Transitions are only allowed if all proteins in the first snapshot model are included in the second snapshot model. In the future, we hope to include more detailed transition scoring terms, which may take into account experimental information or physical models of macromolecular dynamics.\n",
"where $t$ indexes times from 0 until the final modeled snapshot ($T$); $P(X_{t} | D_{t})$ is the snapshot model score; and $W(X_{t+1} | X_{t},D_{t,t+1})$ is the transition score. Trajectory model weights ($W(\\chi)$) are normalized so that the sum of all trajectory models' weights is 1.0. Transition scores are currently based on a simple metric that either allows or disallows a transition. Transitions are only allowed if all proteins in the first snapshot model are included in the second snapshot model. In the future, we hope to include more detailed transition scoring terms, which may take into account experimental information or physical models of macromolecular dynamics.\n",
"\n",
"### Searching for good scoring models<a id=\"notebook_trajectory_searching\"></a>\n",
"\n",
Expand Down
224 changes: 20 additions & 204 deletions Jupyter/spatiotemporal.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@
},
{
"cell_type": "code",
"execution_count": 49,
"execution_count": null,
"id": "1ff4d3e5-04de-4092-8cfc-2ad3018675da",
"metadata": {},
"outputs": [],
Expand All @@ -81,18 +81,10 @@
},
{
"cell_type": "code",
"execution_count": 50,
"execution_count": null,
"id": "6b78a015-32e5-4701-8c6f-df14863ba9ce",
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Successfully calculated the most likely configurations, and saved them to configuration and topology files.\n"
]
}
],
"outputs": [],
"source": [
"main_dir = os.getcwd()\n",
"os.chdir(main_dir)\n",
Expand Down Expand Up @@ -468,11 +460,11 @@
"\n",
"# Trajectory modeling step 1: gathering of information<a id=\"notebook_trajectories1\"></a>\n",
"\n",
"We begin trajectory modeling with the first step of integrative modeling, gathering information. Trajectory modeling utilizes dynamic information about the bimolecular process. In this case, we utilize heterogeneity models, snapshot models, physical theories, and synthetically generated small-angle X-ray scattering (SAXS) profiles.\n",
"We begin trajectory modeling with the first step of integrative modeling, gathering information. Trajectory modeling utilizes dynamic information about the bimolecular process. In this case, we utilize snapshot models, physical theories, and synthetically generated small-angle X-ray scattering (SAXS) profiles.\n",
"\n",
"<img src=\"images/Input_trajectories.png\" width=\"600px\" />\n",
"\n",
"Heterogeneity models inform the possible compositional states at each time point and measure how well a compositional state agrees with input information. Snapshot models provide structural models for each heterogeneity model and measure how well those structural models agree with input information about their structure. Physical theories of macromolecular dynamics inform transitions between states. SAXS data informs the size and shape of the assembling complex and is left for validation.\n",
"Snapshot models inform transitions between sampled time points, and their scores inform trajectory scores. Physical theories of macromolecular dynamics inform transitions between sampled time points. SAXS data informs the size and shape of the assembling complex and is left for validation.\n",
"\n",
"# Trajectory modeling step 2: representation, scoring function, and search process<a id=\"notebook_trajectories2\"></a>\n",
"\n",
Expand All @@ -488,10 +480,10 @@
"To score trajectory models, we incorporate both the scores of individual snapshot models, as well as the scores of transitions between them. Under the assumption that the process is Markovian (*i.e.* memoryless), the weight of a trajectory model takes the form:\n",
"\n",
"$$\n",
"W(\\chi) \\propto \\displaystyle\\prod^{T}_{t=0} P( X_{N,t}, N_{t} | D_{t}) \\cdot \\displaystyle\\prod^{T-1}_{t=0} W(X_{N,t+1},N_{t+1} | X_{N,t},N_{t}, D_{t,t+1}),\n",
"W(\\chi) \\propto \\displaystyle\\prod^{T}_{t=0} P( X_{t} | D_{t}) \\cdot \\displaystyle\\prod^{T-1}_{t=0} W(X_{t+1} | X_{t},D_{t,t+1}),\n",
"$$\n",
"\n",
"where $t$ indexes times from 0 until the final modeled snapshot ($T$); $P(X_{N,t}, N_{t} | D_{t})$ is the snapshot model score; and $W(X_{N,t+1},N_{t+1} | X_{N,t},N_{t}, D_{t,t+1})$ is the transition score. Trajectory model weights ($W(\\chi)$) are normalized so that the sum of all trajectory models' weights is 1.0. Transition scores are currently based on a simple metric that either allows or disallows a transition. Transitions are only allowed if all proteins in the first snapshot model are included in the second snapshot model. In the future, we hope to include more detailed transition scoring terms, which may take into account experimental information or physical models of macromolecular dynamics.\n",
"where $t$ indexes times from 0 until the final modeled snapshot ($T$); $P(X_{t} | D_{t})$ is the snapshot model score; and $W(X_{t+1} | X_{t},D_{t,t+1})$ is the transition score. Trajectory model weights ($W(\\chi)$) are normalized so that the sum of all trajectory models' weights is 1.0. Transition scores are currently based on a simple metric that either allows or disallows a transition. Transitions are only allowed if all proteins in the first snapshot model are included in the second snapshot model. In the future, we hope to include more detailed transition scoring terms, which may take into account experimental information or physical models of macromolecular dynamics.\n",
"\n",
"### Searching for good scoring models<a id=\"notebook_trajectory_searching\"></a>\n",
"\n",
Expand All @@ -503,26 +495,10 @@
},
{
"cell_type": "code",
"execution_count": 51,
"execution_count": null,
"id": "bb887efe-0630-47b6-9bf1-85fa216a6816",
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
".config files are copied\n",
".csv stoichiometry files are copied\n",
"Scores for snapshot1_0min have been merged and saved\n",
"Scores for snapshot2_0min have been merged and saved\n",
"Scores for snapshot3_0min have been merged and saved\n",
"Scores for snapshot1_1min have been merged and saved\n",
"Scores for snapshot2_1min have been merged and saved\n",
"Scores for snapshot3_1min have been merged and saved\n",
"Scores for snapshot1_2min have been merged and saved\n"
]
}
],
"outputs": [],
"source": [
"def merge_scores(fileA, fileB, outputFile):\n",
" \"\"\"\n",
Expand Down Expand Up @@ -673,25 +649,10 @@
},
{
"cell_type": "code",
"execution_count": 52,
"execution_count": null,
"id": "819bb205-fa52-42f9-a4ab-d2f7c3cff0ad",
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Initialing graph...\n",
"Done.\n",
"Calculation composition likelihood...\n",
"Done.\n",
"Scoring directed acycling graph...\n",
"Done.\n",
"Writing output...\n",
"Done.\n"
]
}
],
"outputs": [],
"source": [
"nodes, graph, graph_prob, graph_scores = spatiotemporal.create_DAG(state_dict, out_pdf=True, npaths=3,\n",
" input_dir=input, scorestr='_scores.log',\n",
Expand Down Expand Up @@ -737,54 +698,10 @@
},
{
"cell_type": "code",
"execution_count": 53,
"execution_count": null,
"id": "f1436e33-81b6-400c-bf9c-7b667455265a",
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
".config files are copied\n",
".csv stoichiometry files are copied\n",
"Copied ../modeling/Snapshots/Snapshots_Modeling/snapshot1_0min/good_scoring_models/scoresA.txt to ./data/1_0min_scoresA.log\n",
"Copied ../modeling/Snapshots/Snapshots_Modeling/snapshot1_0min/good_scoring_models/scoresB.txt to ./data/1_0min_scoresB.log\n",
"Copied ../modeling/Snapshots/Snapshots_Modeling/snapshot2_0min/good_scoring_models/scoresA.txt to ./data/2_0min_scoresA.log\n",
"Copied ../modeling/Snapshots/Snapshots_Modeling/snapshot2_0min/good_scoring_models/scoresB.txt to ./data/2_0min_scoresB.log\n",
"Copied ../modeling/Snapshots/Snapshots_Modeling/snapshot3_0min/good_scoring_models/scoresA.txt to ./data/3_0min_scoresA.log\n",
"Copied ../modeling/Snapshots/Snapshots_Modeling/snapshot3_0min/good_scoring_models/scoresB.txt to ./data/3_0min_scoresB.log\n",
"Copied ../modeling/Snapshots/Snapshots_Modeling/snapshot1_1min/good_scoring_models/scoresA.txt to ./data/1_1min_scoresA.log\n",
"Copied ../modeling/Snapshots/Snapshots_Modeling/snapshot1_1min/good_scoring_models/scoresB.txt to ./data/1_1min_scoresB.log\n",
"Copied ../modeling/Snapshots/Snapshots_Modeling/snapshot2_1min/good_scoring_models/scoresA.txt to ./data/2_1min_scoresA.log\n",
"Copied ../modeling/Snapshots/Snapshots_Modeling/snapshot2_1min/good_scoring_models/scoresB.txt to ./data/2_1min_scoresB.log\n",
"Copied ../modeling/Snapshots/Snapshots_Modeling/snapshot3_1min/good_scoring_models/scoresA.txt to ./data/3_1min_scoresA.log\n",
"Copied ../modeling/Snapshots/Snapshots_Modeling/snapshot3_1min/good_scoring_models/scoresB.txt to ./data/3_1min_scoresB.log\n",
"Copied ../modeling/Snapshots/Snapshots_Modeling/snapshot1_2min/good_scoring_models/scoresA.txt to ./data/1_2min_scoresA.log\n",
"Copied ../modeling/Snapshots/Snapshots_Modeling/snapshot1_2min/good_scoring_models/scoresB.txt to ./data/1_2min_scoresB.log\n",
"Initialing graph...\n",
"Done.\n",
"Calculation composition likelihood...\n",
"Done.\n",
"Scoring directed acycling graph...\n",
"Done.\n",
"Writing output...\n",
"Done.\n",
"Initialing graph...\n",
"Done.\n",
"Calculation composition likelihood...\n",
"Done.\n",
"Scoring directed acycling graph...\n",
"Done.\n",
"Writing output...\n",
"Done.\n",
"Temporal precision between ../output_modelA/labeled_pdf.txt and ../output_modelB/labeled_pdf.txt:\n",
"1.0\n",
"Step 1: calculation of temporal precision IS COMPLETED\n",
"\n",
"\n"
]
}
],
"outputs": [],
"source": [
"## 1 - calculation of temporal precision\n",
"\n",
Expand Down Expand Up @@ -930,22 +847,10 @@
},
{
"cell_type": "code",
"execution_count": 54,
"execution_count": null,
"id": "d3669407-4ddc-4e1f-b8ba-c8638024cd56",
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Precision of ./output/labeled_pdf.txt\n",
"1.0\n",
"Step 2: calculation of precision of the model IS COMPLETED\n",
"\n",
"\n"
]
}
],
"outputs": [],
"source": [
"## 2 - calculation of precision of the model\n",
"\n",
Expand Down Expand Up @@ -991,20 +896,10 @@
},
{
"cell_type": "code",
"execution_count": 55,
"execution_count": null,
"id": "f3f7c451-2b04-4e8b-b39c-16c493e8a1a6",
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Step 3b: copy number validation IS COMPLETED\n",
"\n",
"\n"
]
}
],
"outputs": [],
"source": [
"def read_labeled_pdf(pdf_file):\n",
" \"\"\"\n",
Expand Down Expand Up @@ -1156,89 +1051,10 @@
},
{
"cell_type": "code",
"execution_count": 56,
"execution_count": null,
"id": "d5cc728a-6159-4317-94eb-525dccc780aa",
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Finishing: snapshot1_0min.pdb\n",
"Finishing: snapshot2_0min.pdb\n",
"Finishing: snapshot3_0min.pdb\n",
"Finishing: snapshot1_1min.pdb\n",
"Finishing: snapshot2_1min.pdb\n",
"Finishing: snapshot3_1min.pdb\n",
"Finishing: snapshot1_2min.pdb\n",
"All .dat files have been copied successfully...\n",
"...lets proceed to FoXS\n",
"begin read_pdb:\n",
" WARNING No atoms were read from snapshot1_0min.pdb; perhaps it is not a PDB file.\n",
"end read_pdb\n",
"WARNING can't parse input file snapshot1_0min.pdb\n",
"FoXS for 0min is calculated and ready to create a plot. Nr of states is: 3\n",
"Plot 0min_FoXS.png is created\n"
]
},
{
"name": "stderr",
"output_type": "stream",
"text": [
"line 0: Cannot load input from 'fit.plt'\n",
"\n",
"/usr/local/bin/mv: cannot stat 'fit.plt': No such file or directory\n",
"/usr/local/bin/mv: cannot stat 'fit.png': No such file or directory\n"
]
},
{
"name": "stdout",
"output_type": "stream",
"text": [
"begin read_pdb:\n",
" WARNING No atoms were read from snapshot1_1min.pdb; perhaps it is not a PDB file.\n",
"end read_pdb\n",
"WARNING can't parse input file snapshot1_1min.pdb\n",
"FoXS for 1min is calculated and ready to create a plot. Nr of states is: 3\n",
"Plot 1min_FoXS.png is created\n",
"There is only one state in 2min\n"
]
},
{
"name": "stderr",
"output_type": "stream",
"text": [
"line 0: Cannot load input from 'fit.plt'\n",
"\n",
"/usr/local/bin/mv: cannot stat 'fit.plt': No such file or directory\n",
"/usr/local/bin/mv: cannot stat 'fit.png': No such file or directory\n"
]
},
{
"name": "stdout",
"output_type": "stream",
"text": [
"begin read_pdb:\n",
" WARNING No atoms were read from snapshot1_2min.pdb; perhaps it is not a PDB file.\n",
"end read_pdb\n",
"WARNING can't parse input file snapshot1_2min.pdb\n",
"FoXS for 2min is calculated and ready to create a plot. Nr of states is: 1\n",
"Step 4a: SAXS validation IS COMPLETED\n",
"\n",
"\n"
]
},
{
"name": "stderr",
"output_type": "stream",
"text": [
"line 0: Cannot load input from 'snapshot1_2min_2min_exp.plt'\n",
"\n",
"/usr/local/bin/mv: cannot stat 'snapshot1_2min_2min_exp.plt': No such file or directory\n",
"/usr/local/bin/mv: cannot stat 'snapshot1_2min_2min_exp.png': No such file or directory\n"
]
}
],
"outputs": [],
"source": [
"# 4a - SAXS\n",
"\"\"\"\n",
Expand Down Expand Up @@ -1468,7 +1284,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.10.15"
"version": "3.11.7"
}
},
"nbformat": 4,
Expand Down
Binary file modified doc/images/Input_trajectories.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading

0 comments on commit 430ca69

Please sign in to comment.