From 3bbd8a8bab1c15837eaad9c2319af909714546a0 Mon Sep 17 00:00:00 2001 From: Huabin Zhou <huabin.zhou@utsouthwestern.edu> Date: Fri, 4 Oct 2024 14:42:10 -0500 Subject: [PATCH] roll back to skip the rotamer and maskmer generation prior the template matching, which accelaratate the program since MPI wasn't involved in these two separated processes . --- .idea/ruff.xml | 2 +- README.md | 6 +++--- src/catm.py | 4 ++-- src/global_template_matching.py | 2 -- src/template_matching.py | 2 +- 5 files changed, 7 insertions(+), 9 deletions(-) diff --git a/.idea/ruff.xml b/.idea/ruff.xml index d2889cf..d3a43c2 100644 --- a/.idea/ruff.xml +++ b/.idea/ruff.xml @@ -1,6 +1,6 @@ <?xml version="1.0" encoding="UTF-8"?> <project version="4"> <component name="RuffConfigService"> - <option name="projectRuffExecutablePath" value="$USER_HOME$/anaconda3/bin/ruff" /> + <option name="projectRuffExecutablePath" value="$USER_HOME$/anaconda3/envs/catm/bin/ruff" /> </component> </project> \ No newline at end of file diff --git a/README.md b/README.md index 4ea2e64..4913d0c 100644 --- a/README.md +++ b/README.md @@ -15,7 +15,7 @@ python version at least 3.5 is required, create a separated environment if you w 1. Creat a new vitual enviroment (optional) ``` -conda create -n CATM python +conda create -n catm python ``` 2. Download the package from gitlab and change directory to the CATM folder ``` @@ -23,7 +23,7 @@ git clone https://git.biohpc.swmed.edu/s194231/cryo-catm.git cd cryo-catm ``` -2. Install the package +2. Install the package, if you want to build your own code activiely, add -dev option ``` pip install . @@ -33,7 +33,7 @@ pip install . ``` cd test -CATM #run the main program +catm #run the main program ``` diff --git a/src/catm.py b/src/catm.py index 0386331..642ec8c 100644 --- a/src/catm.py +++ b/src/catm.py @@ -45,7 +45,7 @@ def main(): user_inputs = parse_input() if hasattr(config, "testTM"): # this will run only the global TM if config.testTM: - print("Running general template matching!") + print("Running regular template matching!") matcher = TemplateMatcherGeneral(user_inputs) matcher.run_multiprocessing() end_time = time.time() @@ -61,7 +61,7 @@ def main(): obj_xml = matcher.run_multiprocessing() print("Template matching finished, saving results") else: - print("Bypassing template matching") + print("Bypassed template matching") # for debugging, read the xml file from lxml.etree import XMLParser, parse diff --git a/src/global_template_matching.py b/src/global_template_matching.py index 40d3eb0..9546403 100644 --- a/src/global_template_matching.py +++ b/src/global_template_matching.py @@ -65,7 +65,6 @@ class TemplateMatcherGeneral: indices = list(range(len(self.global_angles))) results = pool.map(self.match_worker, indices) # Process results in order - print(len(results)) print("Template matching is done, sorting the results!") # scores, rot_new, coord_new, model = [], [], [], [] # Initialize the arrays @@ -86,7 +85,6 @@ class TemplateMatcherGeneral: # Assign the temporary array to rot_save where the mask is True rot_save[mask] = temp_array[mask] # Verify the result for one element - print(rot_save[0, 0, 0]) # Example verification """ rot_save = np.empty(self.dims, dtype=object) ccc_save = np.zeros(self.dims) for cur_ccc, cur_rot in results: diff --git a/src/template_matching.py b/src/template_matching.py index 108c6af..4913e51 100644 --- a/src/template_matching.py +++ b/src/template_matching.py @@ -54,6 +54,7 @@ class TemplateMatcher: ctf_volumes = prepare_ctf_volumes(self.ctf, self.templates) else: ctf_volumes = [] + #print("Working on subtomogram " + str(index)) score, rots, coords, models = self.template_match( subtomo, angles, self.coords[index], ctf_volumes ) @@ -212,7 +213,6 @@ class TemplateMatcher: mask = apply_wedge(mask, self.missing_wedge) mask[mask < 0.5] = 0 # the mask should be binary mask[mask >= 0.5] = 1 - cur_ccc.append(calculate_correlation(subtomo[temp], template_rot, mask)) ccc_save, rot_save, coor_save = self.get_best_match( cur_ccc, -- GitLab