diff --git a/README.md b/README.md index 886eef19442b05cb86bd19c117bb8109b1b4b406..4ea2e64a8ded5f0f735811dfc03f273ce0599276 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 c787a1f453ed5f9122a5904af7fb64fc4e94cc74..bd782512f229ba80790f321b9df5a7dfcc8cc038 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 2dbf604c8a599a4152239a9bf555bc777d83fd6b..39a843609b3148497c4ec4e9fb676eb20db5f155 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 24387d49d0063710727b7cfb33f18bfcbaa08606..b8b0d22f00a479076227c106ec3d4d0e7805eded 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 df634d4baa070203033beee2616f82b1ed6851c5..bf4f953e0debc86f69f8e9b4375837efc632688c 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 d1eac5a64573ac7cf395e62d3c5ed130f7339b15..00c513c8a0779480668d5c78c003e680bc82f789 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 b48784a7b7f2ba2306630d7f9bfc381b5faef979..0e0e8d26f4b5c989b47d406df98f76e5deaa9a43 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 b0fc2b26794baf46732ba86e59e5b90ad54bca10..872a54810f943fd0b7ffd9070acb63ede31caac3 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