diff --git a/src/config.py b/src/config.py index 7839387a8aefedb76cc24c427ecc5552ed12d25b..d38985a9537f260001b9afb94a4bfb5248d0fa27 100644 --- a/src/config.py +++ b/src/config.py @@ -1,50 +1,49 @@ # config.py -# Path to the tomograms +import os + """ -To do the template matching,the first stp is taking the input from the user: +The input and configureation: 1.The tomogram, should be black on white background 2.The templates, needs to be white on black background, to be consistent with normal convention 3.The coordinates of picked particles 4.The missing wedge information, default to [30,42], corresponding to [-60,+48] tilt range 5.The shrinkage factor, default to 0.3, this controls the contours of the template -6. There are more high lever parameters, like the search depth, etc. +6. There are more high level parameters, like the search depth, etc. """ -import os +############################ input && output control ################################## current_dir = os.getcwd() split_path = current_dir.split("/") tomoID = split_path[-2] -############################ input && output control ################################## - -prefix = "s" + tomoID + ".match" -tomogram = "s" + tomoID + ".lps25.mrc" - -# Paths to templates and corresponding masks -# the templates need to have the same shape -templates = [ - "templates/mono-8Apx-lps30-box24-rot12-core.mrc", - "templates/pre-40s.mrc", - "templates/pre-60s.mrc", +prefix = tomoID + ".test1" +input_folder = "inputs/" +tomogram = input_folder + tomoID + ".test1.lps25.mrc" +black_on_white = 1 # The constrast of tomogram, 0 if the particle has white contrast (positive values) + +templates = [input_folder + "mono-8Apx-lps30-box30-rot12-core.mrc"] +contour_level = [0.2] +# Masks are required to be the same shape as the templates +# One can create the mask in Relion with soft edges, extend 2 and soft 3 is recommended +masks = [ + input_folder + "mask-mono-8Apx-lps30-box30-rot12-ex2-s2.mrc", ] -contour_level = [0.2, 0.23, 0.23] -# this is an important parameter, find script_s1 to help if you need - -# Masks are required to be the same shape as the templates, spherical masks or shape masks -# One can create the mask in Relion with soft edges, extend 3 and soft 3 is recommended -# Leave it blank if you don't are not sure what to use, the mask will be generated internally -masks = [] - # Coordinates of picked particles,you might also include the angles for local search -# coords = pd.read_csv("/path/to/coords.csv") -# Assuming the columns are x, y, z,change it if not -df = "../cluster/s" + tomoID + ".unetn_4.5.csv" - +df = None # input_folder+'s68.pick1.csv'#'../cluster/s'+str(tomoID)+'.unetn_4.5.csv' # We need the missing wedge information or a CTF model # You might create a CTF model via Relion or Warp, which should be generic for data collected with the microscope # If a CTF model present, it will be use by default -ctf_model_file = "s" + tomoID + "_0000000_ctf_8.00A.mrc" # path to the CTF model +ctf_model_file = ( + input_folder + tomoID + "_0000000_ctf_8.00A.mrc" +) # path to the CTF model +# output path +output_path = "results/" +write_models = True # Generate a volume with assigned models + +mpi_nn = -1 # -1 will use all the availbe cpu + +############################ Template Matching Control ################################## # Missing wedge information, if CTF model is not found missing_wedge = [30, 42] # [30,42] Corresponding to [-60, +48] tilt range @@ -52,42 +51,40 @@ missing_wedge = [30, 42] # [30,42] Corresponding to [-60, +48] tilt range # Shrinkage factor, which the counter level of the volume, can be determined in Chimera # It's designed to control how close two objects are allowed to be # only template 1 will be used for the cleaning of clashes -shrinkage_factor = 0.9 - -# output path -output_path = "results/" -write_models = True # Generate a volume with assigned models +shrinkage_factor = 1 -# Keep the following parameters as default for now # Number of angles for global template matching number_of_angles = 2000 -# The minimum CCCs allowed for the template matching -min_CCC = 0.2 +# The minimum CCCs kept after template matching +min_CCC = 0.1 -# Range of local search angles, only for local search, default to None for global search +# Range of local search angles, only for local search, default to False for global search # For local searchthe rough angles need to be provied in the coords.csv, # with columns phi, theta, psi in intrinsic ZXZ convention local_search_angles = False # False or True -local_search_range = 5 # in degrees, how far from the original position to search -local_search_step_interval = 5 -# set to zore if you don't want to have any refiment # searching space matching_space = 3 # in pixels, how far from the original position to search +############################ Clash Resolver Control ################################## + # Search depth, control how many rotataions search_depth = 200 # for development -bypass_TM = False +bypass_TM = True bypass_CR = False sort_score = True # this is useful if you don't want to mix up the index -mpi_nn = -1 # -1 will use all the availbe cpu -pre_assigned_volume = None # path to the pre-assigned volume + + +############################ For Development ################################## +pre_assigned_volume = ( + None #'s'+tomoID+'-pre-assigned-vol.mrc' # path to the pre-assigned volume +) bypass_optimizer = False # this will bypass the optimizer clash resolver -distance_tolerance = 3 -adjust_ccc = 0.11111111 -# max distance between two partles to be considered as the same particle +distance_tolerance = 2 +adjust_ccc = None +# max distance between two particles to be considered as the same particle # option's for running only the general template matching -testTM = False -adjust_ccc_relion = 0 +testTM = True +chunk_size = None # [304,776,776]#[152,194,194] diff --git a/src/file_handler.py b/src/file_handler.py index a4b5306a8beab21b3ba72309937bd41638d49345..16b7da62e87666fbb47315bfc49248637118f44b 100644 --- a/src/file_handler.py +++ b/src/file_handler.py @@ -164,6 +164,8 @@ def parse_input(): # print(json.dumps(user_inputs, indent=4)) # Processing and reading data tomogram = read_mrc(user_inputs["tomogram"]) + if not user_inputs['black_on_white']: + tomogram = -tomogram dims = tomogram.shape templates = [read_mrc_permissive(template) for template in user_inputs["templates"]] if user_inputs["masks"]: