Skip to content

Commit

Permalink
Updating tutorial
Browse files Browse the repository at this point in the history
  • Loading branch information
alatham13 committed Nov 22, 2024
1 parent b0f215d commit 9fa8658
Show file tree
Hide file tree
Showing 52 changed files with 7,067 additions and 198 deletions.
33 changes: 19 additions & 14 deletions Jupyter/.ipynb_checkpoints/template.spatiotemporal-checkpoint.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,9 @@
"source": [
"# General imports for the tutorial\n",
"import sys, os, glob, shutil\n",
"import IMP\n",
"import RMF\n",
"import IMP.rmf\n",
"from IMP.spatiotemporal import prepare_protein_library\n",
"import IMP.spatiotemporal as spatiotemporal\n",
"from IMP.spatiotemporal import analysis\n",
Expand All @@ -97,11 +100,11 @@
"source": [
"# parameters for prepare_protein_library:\n",
"times = [\"0min\", \"1min\", \"2min\"]\n",
"exp_comp = {'A': '../../../modeling/Input_Information/gen_FCS/exp_compA.csv',\n",
" 'B': '../../../modeling/Input_Information/gen_FCS/exp_compB.csv',\n",
" 'C': '../../../modeling/Input_Information/gen_FCS/exp_compC.csv'}\n",
"exp_comp = {'A': '../modeling/Input_Information/gen_FCS/exp_compA.csv',\n",
" 'B': '../modeling/Input_Information/gen_FCS/exp_compB.csv',\n",
" 'C': '../modeling/Input_Information/gen_FCS/exp_compC.csv'}\n",
"expected_subcomplexes = ['A', 'B', 'C']\n",
"template_topology = 'spatiotemporal_topology.txt'\n",
"template_topology = '../modeling/Heterogeneity/Heterogeneity_Modeling/spatiotemporal_topology.txt'\n",
"template_dict = {'A': ['Ubi-E2-D3'], 'B': ['BMI-1'], 'C': ['E3-ubi-RING2']}\n",
"nmodels = 3\n",
"\n",
Expand Down Expand Up @@ -633,7 +636,7 @@
"main_dir = os.getcwd()\n",
"os.chdir(main_dir)\n",
"state_dict = {'0min': 3, '1min': 3, '2min': 1}\n",
"create_data_and_copy_files(state_dict, custom_source_dir1=main_dir, custom_source_dir2='../../../modeling/Input_Information/gen_FCS/', custom_source_dir3='../../../modeling/Snapshots/Snapshots_Modeling/')\n",
"create_data_and_copy_files(state_dict, custom_source_dir1=main_dir, custom_source_dir2='../modeling/Input_Information/gen_FCS/', custom_source_dir3='../modeling/Snapshots/Snapshots_Modeling/')\n",
"\n",
"# then trajectory model is created based on the all copied data\n",
"expected_subcomplexes = ['A', 'B', 'C']\n",
Expand Down Expand Up @@ -805,10 +808,11 @@
" except Exception as e:\n",
" print(f\"scoresA.txt and scoresB.txt cannot be copied. Try do do it manually. Reason for Error: {e}\")\n",
"\n",
"os.chdir(main_dir)\n",
"# copy all the relevant files\n",
"copy_files_for_data(state_dict, custom_source_dir1='../../../modeling/Heterogeneity/Heterogeneity_Modeling/',\n",
" custom_source_dir2='../../../modeling/Input_Information/gen_FCS/',\n",
" custom_source_dir3='../../../modeling/Snapshots/Snapshots_Modeling/')\n",
"copy_files_for_data(state_dict, custom_source_dir1='../modeling/Heterogeneity/Heterogeneity_Modeling/',\n",
" custom_source_dir2='../modeling/Input_Information/gen_FCS/',\n",
" custom_source_dir3='../modeling/Snapshots/Snapshots_Modeling/')\n",
"\n",
"# create two independent DAGs\n",
"expected_subcomplexes = ['A', 'B', 'C']\n",
Expand All @@ -824,7 +828,7 @@
"nodesA, graphA, graph_probA, graph_scoresA = spatiotemporal.create_DAG(state_dict, out_pdf=True, npaths=3,\n",
" input_dir=input, scorestr='_scoresA.log',\n",
" output_dir=outputA,\n",
" spatio_temporal_rule=False,\n",
" spatio_temporal_rule=True,\n",
" expected_subcomplexes=expected_subcomplexes,\n",
" score_comp=True, exp_comp_map=exp_comp,\n",
" draw_dag=False)\n",
Expand All @@ -833,7 +837,7 @@
"nodesB, graphB, graph_probB, graph_scoresB = spatiotemporal.create_DAG(state_dict, out_pdf=True, npaths=3,\n",
" input_dir=input, scorestr='_scoresB.log',\n",
" output_dir=outputB,\n",
" spatio_temporal_rule=False,\n",
" spatio_temporal_rule=True,\n",
" expected_subcomplexes=expected_subcomplexes,\n",
" score_comp=True, exp_comp_map=exp_comp,\n",
" draw_dag=False)\n",
Expand Down Expand Up @@ -996,7 +1000,7 @@
" \"\"\"\n",
" # find folder with config files\n",
" if custom_labeled_pdf:\n",
" _labeled_pdf = custom_data_folder\n",
" _labeled_pdf = custom_labeled_pdf\n",
" else:\n",
" _labeled_pdf = '../Trajectories_Modeling/output/labeled_pdf.txt'\n",
"\n",
Expand Down Expand Up @@ -1037,7 +1041,7 @@
"\n",
"# 3b - comparison of the model to data used in modeling (copy number)\n",
"os.chdir(main_dir) # it is crucial that after each step, directory is changed back to main\n",
"forward_model_copy_number(expected_subcomplexes)\n",
"forward_model_copy_number(expected_subcomplexes,custom_labeled_pdf='output/labeled_pdf.txt')\n",
"print(\"Step 3b: copy number validation IS COMPLETED\")\n",
"print(\"\")\n",
"print(\"\")"
Expand Down Expand Up @@ -1099,7 +1103,7 @@
" if custom_path:\n",
" sim_rmf = custom_path # option for custom path\n",
" else:\n",
" sim_rmf = f\"../../../../modeling/Snapshots/Snapshots_Assessment/exhaust_{state}_{time}/cluster.0/cluster_center_model.rmf3\"\n",
" sim_rmf = f\"../../modeling/Snapshots/Snapshots_Assessment/exhaust_{state}_{time}/cluster.0/cluster_center_model.rmf3\"\n",
"\n",
" pdb_output = f\"snapshot{state}_{time}.pdb\" # define the output of converted .pdb file\n",
"\n",
Expand Down Expand Up @@ -1215,8 +1219,9 @@
"SAXS_output = \"./SAXS_comparison/\"\n",
"os.makedirs(SAXS_output, exist_ok=True)\n",
"os.chdir(SAXS_output)\n",
"model = IMP.Model()\n",
"convert_rmfs(state_dict, model)\n",
"copy_SAXS_dat_files(custom_src_dir='../../../../modeling/Input_Information/gen_SAXS')\n",
"copy_SAXS_dat_files(custom_src_dir='../../modeling/Input_Information/gen_SAXS')\n",
"process_foxs(state_dict)\n",
"print(\"Step 4a: SAXS validation IS COMPLETED\")\n",
"print(\"\")\n",
Expand Down
33 changes: 19 additions & 14 deletions Jupyter/.template.spatiotemporal.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,9 @@
"source": [
"# General imports for the tutorial\n",
"import sys, os, glob, shutil\n",
"import IMP\n",
"import RMF\n",
"import IMP.rmf\n",
"from IMP.spatiotemporal import prepare_protein_library\n",
"import IMP.spatiotemporal as spatiotemporal\n",
"from IMP.spatiotemporal import analysis\n",
Expand All @@ -97,11 +100,11 @@
"source": [
"# parameters for prepare_protein_library:\n",
"times = [\"0min\", \"1min\", \"2min\"]\n",
"exp_comp = {'A': '../../../modeling/Input_Information/gen_FCS/exp_compA.csv',\n",
" 'B': '../../../modeling/Input_Information/gen_FCS/exp_compB.csv',\n",
" 'C': '../../../modeling/Input_Information/gen_FCS/exp_compC.csv'}\n",
"exp_comp = {'A': '../modeling/Input_Information/gen_FCS/exp_compA.csv',\n",
" 'B': '../modeling/Input_Information/gen_FCS/exp_compB.csv',\n",
" 'C': '../modeling/Input_Information/gen_FCS/exp_compC.csv'}\n",
"expected_subcomplexes = ['A', 'B', 'C']\n",
"template_topology = 'spatiotemporal_topology.txt'\n",
"template_topology = '../modeling/Heterogeneity/Heterogeneity_Modeling/spatiotemporal_topology.txt'\n",
"template_dict = {'A': ['Ubi-E2-D3'], 'B': ['BMI-1'], 'C': ['E3-ubi-RING2']}\n",
"nmodels = 3\n",
"\n",
Expand Down Expand Up @@ -633,7 +636,7 @@
"main_dir = os.getcwd()\n",
"os.chdir(main_dir)\n",
"state_dict = {'0min': 3, '1min': 3, '2min': 1}\n",
"create_data_and_copy_files(state_dict, custom_source_dir1=main_dir, custom_source_dir2='../../../modeling/Input_Information/gen_FCS/', custom_source_dir3='../../../modeling/Snapshots/Snapshots_Modeling/')\n",
"create_data_and_copy_files(state_dict, custom_source_dir1=main_dir, custom_source_dir2='../modeling/Input_Information/gen_FCS/', custom_source_dir3='../modeling/Snapshots/Snapshots_Modeling/')\n",
"\n",
"# then trajectory model is created based on the all copied data\n",
"expected_subcomplexes = ['A', 'B', 'C']\n",
Expand Down Expand Up @@ -805,10 +808,11 @@
" except Exception as e:\n",
" print(f\"scoresA.txt and scoresB.txt cannot be copied. Try do do it manually. Reason for Error: {e}\")\n",
"\n",
"os.chdir(main_dir)\n",
"# copy all the relevant files\n",
"copy_files_for_data(state_dict, custom_source_dir1='../../../modeling/Heterogeneity/Heterogeneity_Modeling/',\n",
" custom_source_dir2='../../../modeling/Input_Information/gen_FCS/',\n",
" custom_source_dir3='../../../modeling/Snapshots/Snapshots_Modeling/')\n",
"copy_files_for_data(state_dict, custom_source_dir1='../modeling/Heterogeneity/Heterogeneity_Modeling/',\n",
" custom_source_dir2='../modeling/Input_Information/gen_FCS/',\n",
" custom_source_dir3='../modeling/Snapshots/Snapshots_Modeling/')\n",
"\n",
"# create two independent DAGs\n",
"expected_subcomplexes = ['A', 'B', 'C']\n",
Expand All @@ -824,7 +828,7 @@
"nodesA, graphA, graph_probA, graph_scoresA = spatiotemporal.create_DAG(state_dict, out_pdf=True, npaths=3,\n",
" input_dir=input, scorestr='_scoresA.log',\n",
" output_dir=outputA,\n",
" spatio_temporal_rule=False,\n",
" spatio_temporal_rule=True,\n",
" expected_subcomplexes=expected_subcomplexes,\n",
" score_comp=True, exp_comp_map=exp_comp,\n",
" draw_dag=False)\n",
Expand All @@ -833,7 +837,7 @@
"nodesB, graphB, graph_probB, graph_scoresB = spatiotemporal.create_DAG(state_dict, out_pdf=True, npaths=3,\n",
" input_dir=input, scorestr='_scoresB.log',\n",
" output_dir=outputB,\n",
" spatio_temporal_rule=False,\n",
" spatio_temporal_rule=True,\n",
" expected_subcomplexes=expected_subcomplexes,\n",
" score_comp=True, exp_comp_map=exp_comp,\n",
" draw_dag=False)\n",
Expand Down Expand Up @@ -996,7 +1000,7 @@
" \"\"\"\n",
" # find folder with config files\n",
" if custom_labeled_pdf:\n",
" _labeled_pdf = custom_data_folder\n",
" _labeled_pdf = custom_labeled_pdf\n",
" else:\n",
" _labeled_pdf = '../Trajectories_Modeling/output/labeled_pdf.txt'\n",
"\n",
Expand Down Expand Up @@ -1037,7 +1041,7 @@
"\n",
"# 3b - comparison of the model to data used in modeling (copy number)\n",
"os.chdir(main_dir) # it is crucial that after each step, directory is changed back to main\n",
"forward_model_copy_number(expected_subcomplexes)\n",
"forward_model_copy_number(expected_subcomplexes,custom_labeled_pdf='output/labeled_pdf.txt')\n",
"print(\"Step 3b: copy number validation IS COMPLETED\")\n",
"print(\"\")\n",
"print(\"\")"
Expand Down Expand Up @@ -1099,7 +1103,7 @@
" if custom_path:\n",
" sim_rmf = custom_path # option for custom path\n",
" else:\n",
" sim_rmf = f\"../../../../modeling/Snapshots/Snapshots_Assessment/exhaust_{state}_{time}/cluster.0/cluster_center_model.rmf3\"\n",
" sim_rmf = f\"../../modeling/Snapshots/Snapshots_Assessment/exhaust_{state}_{time}/cluster.0/cluster_center_model.rmf3\"\n",
"\n",
" pdb_output = f\"snapshot{state}_{time}.pdb\" # define the output of converted .pdb file\n",
"\n",
Expand Down Expand Up @@ -1215,8 +1219,9 @@
"SAXS_output = \"./SAXS_comparison/\"\n",
"os.makedirs(SAXS_output, exist_ok=True)\n",
"os.chdir(SAXS_output)\n",
"model = IMP.Model()\n",
"convert_rmfs(state_dict, model)\n",
"copy_SAXS_dat_files(custom_src_dir='../../../../modeling/Input_Information/gen_SAXS')\n",
"copy_SAXS_dat_files(custom_src_dir='../../modeling/Input_Information/gen_SAXS')\n",
"process_foxs(state_dict)\n",
"print(\"Step 4a: SAXS validation IS COMPLETED\")\n",
"print(\"\")\n",
Expand Down
Loading

0 comments on commit 9fa8658

Please sign in to comment.