From 6382e900e81287c3f0047b1f59a37d583d0ad0b1 Mon Sep 17 00:00:00 2001
From: Huabin Zhou <huabin.zhou@utsouthwestern.edu>
Date: Tue, 13 Aug 2024 22:50:45 -0500
Subject: [PATCH] update README.md and src files

---
 README.md                       |  9 +++++++--
 src/catm.py                     |  2 +-
 src/file_handler.py             |  2 --
 src/global_template_matching.py |  2 +-
 src/template_matching.py        | 13 +++++++------
 src/test_ccc.py                 |  1 -
 src/test_config.py              |  3 +--
 src/utils.py                    |  2 +-
 8 files changed, 18 insertions(+), 16 deletions(-)

diff --git a/README.md b/README.md
index 886eef1..4ea2e64 100644
--- a/README.md
+++ b/README.md
@@ -51,9 +51,14 @@ CATM #run the main program
 python counter_level_check.py path_to_template.mrc [ctf_model or missing wedge info]
 '''
 - check the counter level in Chimera/ChimeraX and choose the level with least artifact
-### 3. copy the config.py file to your work dir, and adjust the parameters for your run
+### 3. copy the config.py file to your work dir, and adjust the parameters for your run,the key paremeters
 - There are three different modes the program currently supported, "Context",  
-### 4. 
+- 
+### 4. run the program in the work dir and analysis the result
+```
+CATM
+```
+The program will write the final results with csv, coord and star format, a back-mapped tomogram will also be generated.
 
 
 
diff --git a/src/catm.py b/src/catm.py
index c787a1f..bd78251 100644
--- a/src/catm.py
+++ b/src/catm.py
@@ -34,7 +34,7 @@ __author__ = "Huabin Zhou"
 def main():
     star_time = time.time()
     user_inputs = parse_input()
-    if hasattr(config, "testTM"): # this will run only the global TM
+    if hasattr(config, "testTM"):  # this will run only the global TM
         if config.testTM:
             print("Running general template matching!")
             matcher = TemplateMatcherGeneral(user_inputs)
diff --git a/src/file_handler.py b/src/file_handler.py
index 2dbf604..39a8436 100644
--- a/src/file_handler.py
+++ b/src/file_handler.py
@@ -7,8 +7,6 @@ import os
 import importlib.util
 import starfile
 
-import config
-
 
 def read_mrc(filename):
     with mrcfile.open(filename) as mrc:
diff --git a/src/global_template_matching.py b/src/global_template_matching.py
index 24387d4..b8b0d22 100644
--- a/src/global_template_matching.py
+++ b/src/global_template_matching.py
@@ -1,7 +1,7 @@
 import numpy as np
 from scipy.spatial.transform import Rotation as R
 from multiprocessing import Pool, cpu_count
-from utils import rotate, rotate_high_res
+from utils import rotate_high_res
 from utils import prepare_ctf_volumes, apply_ctf, apply_wedge
 from scipy.ndimage import binary_dilation
 import pandas as pd
diff --git a/src/template_matching.py b/src/template_matching.py
index df634d4..bf4f953 100644
--- a/src/template_matching.py
+++ b/src/template_matching.py
@@ -1,6 +1,4 @@
-import pandas as pd
 import numpy as np
-import starfile
 from scipy.spatial.transform import Rotation as R
 from multiprocessing import Pool, cpu_count
 import itertools
@@ -127,6 +125,7 @@ class TemplateMatcher:
         obj_xml = save_xml(scores, rot_new, coord_new, model)
         tree = etree.ElementTree(obj_xml)
         tree.write(self.output_path + "match_raw_results.xml", pretty_print=True)
+        """
         max_pos = []
         for i in range(len(scores)):
             max_pos.append(
@@ -144,9 +143,10 @@ class TemplateMatcher:
             np.array(max_pos),
             delimiter=" ",
         )
+        
         df_star = pd.DataFrame(
             max_pos,
-            columns=[
+             columns=[
                 "rlnCoordinateX",
                 "rlnCoordinateY",
                 "rlnCoordinateZ",
@@ -155,9 +155,10 @@ class TemplateMatcher:
                 "rlnAnglePsi",
             ],
         )
-        # starfile.write(
-        #    df_star, self.output_path + config.prefix + "rawMax.star", overwrite=1
-        # )
+         starfile.write(
+            df_star, self.output_path + config.prefix + "rawMax.star", overwrite=1
+        )
+        """
         return obj_xml
 
     def sort_results(results, original_coordinates):
diff --git a/src/test_ccc.py b/src/test_ccc.py
index d1eac5a..00c513c 100644
--- a/src/test_ccc.py
+++ b/src/test_ccc.py
@@ -1,6 +1,5 @@
 import numpy as np
 from scipy.signal import fftconvolve
-from scipy.ndimage import zoom
 
 
 def calculate_correlation(data_volume, template_volume, mask):
diff --git a/src/test_config.py b/src/test_config.py
index b48784a..0e0e8d2 100644
--- a/src/test_config.py
+++ b/src/test_config.py
@@ -52,7 +52,6 @@ min_CCC = 0.2
 search_depth = 100
 
 
-
 """'
 tomograms = "/path/to/tomogram"
 
@@ -82,4 +81,4 @@ shrinkage_factor = 0.3
 
 # output path
 output_path = "/path/to/output"
-"""
\ No newline at end of file
+"""
diff --git a/src/utils.py b/src/utils.py
index b0fc2b2..872a548 100644
--- a/src/utils.py
+++ b/src/utils.py
@@ -7,7 +7,7 @@ Created on Mon Sep 13 13:18:34 2021
 """
 import scipy.ndimage
 import numpy as np
-from numpy.fft import fftn, ifftn, ifftshift
+from numpy.fft import fftn, ifftn, ifftshift, fftshift
 from scipy.ndimage import zoom
 
 
-- 
GitLab