Skip to content

Commit

Permalink
added integration test for write_starfile utility
Browse files Browse the repository at this point in the history
  • Loading branch information
MJoosten committed Apr 17, 2024
1 parent 1717654 commit de64cab
Show file tree
Hide file tree
Showing 4 changed files with 740 additions and 387 deletions.
807 changes: 588 additions & 219 deletions paper/figure_2.ipynb

Large diffs are not rendered by default.

195 changes: 27 additions & 168 deletions paper/supplementary_figure_1.ipynb

Large diffs are not rendered by default.

77 changes: 77 additions & 0 deletions paper/supplementary_figure_7.ipynb
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
{
"cells": [
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# plotting functions for supplementary figure 7\n",
"Showing the results of 3DFlex training for the c3-c3b steered MD simulation"
]
},
{
"cell_type": "code",
"execution_count": 3,
"metadata": {},
"outputs": [],
"source": [
"# imports\n",
"import os\n",
"import mdtraj\n"
]
},
{
"cell_type": "code",
"execution_count": 5,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"number of frames in trajectory: 8000\n"
]
}
],
"source": [
"# first test: load the trajectory and compare with the number of sampled states in the pdb-directory\n",
"trj_dir = \"/tudelft/mjoosten1/staff-umbrella/ajlab/MJ/projects/Roodmus/data/c3c3b/trj\"\n",
"\n",
"trj = mdtraj.load(\n",
" os.path.join(trj_dir, \"c3_to_c3b_morph_attempt_2.nc\"),\n",
" top=os.path.join(trj_dir, \"c3_to_c3b_morph_frame_1_MD.pdb\")\n",
")\n",
"\n",
"print(f\"number of frames in trajectory: {trj.n_frames}\")\n",
"\n"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
}
],
"metadata": {
"kernelspec": {
"display_name": "roodmus",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.10.13"
}
},
"nbformat": 4,
"nbformat_minor": 2
}
48 changes: 48 additions & 0 deletions tests/integration/simulation_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -348,3 +348,51 @@ def test_run_parakeet(self) -> None:
)

# maybe should add filecmp for run_parakeet_output/ files????

def test_write_starfile(self) -> None:
"""
Test that a correct .star file is generated
based on the input .csv dataframe file
"""

# set up the args to pass to roodmus write_starfile
csv_file = os.path.join(
self.test_data,
"analysis_test_outputs",
"picking_star",
"label_truth",
"df_truth.csv",
)
output_dir = os.path.join(self.test_dir, "star_files")
os.makedirs(output_dir)

# run the write_starfile utility
system_cmd = (
"roodmus write_starfile"
+ " --input_csv {}".format(csv_file)
+ " --type coordinate_star"
+ " --output_dir {}".format(output_dir)
+ " --ugraph_dir {}".format(output_dir)
+ " --pixel_size 1.0"
)
os.system(system_cmd)

# check that the groundtruth.star file has been generated
assert os.path.exists(
os.path.join(output_dir, "groundtruth.star")
), "groundtruth.star not found in {}".format(output_dir)

# check that there are individual particle starfiles
# in the micrographs directory
assert os.path.exists(
os.path.join(output_dir, "micrographs")
), "micrographs directory not found in {}".format(output_dir)
assert (
len(os.listdir(os.path.join(output_dir, "micrographs"))) > 0
), "No files found in micrographs directory in {}".format(output_dir)

# a comparison with the contents of the groundtruth.star file
# is currently not possible, since the output directory is
# also used as the name for where to find the micrographs,
# and since this directory is created by the utility, the
# paths in the .star file will not match the reference file

0 comments on commit de64cab

Please sign in to comment.