From 1df68b41ac19e00996041ad18620e20549ec9f8f Mon Sep 17 00:00:00 2001 From: James Krieger Date: Mon, 29 Sep 2025 17:25:54 +0100 Subject: [PATCH] add resolution argument and print not provided --- scripts/cryo-EM_preprocess.py | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/scripts/cryo-EM_preprocess.py b/scripts/cryo-EM_preprocess.py index f4719b9..60a9746 100644 --- a/scripts/cryo-EM_preprocess.py +++ b/scripts/cryo-EM_preprocess.py @@ -101,13 +101,15 @@ def write_data_to_mrc(filename, data, mrc): parser.add_argument('--zone_PDB', type=str, help='reference PDB for map zoning') parser.add_argument('--zone_sel', type=str, help='selection for map zoning') parser.add_argument('--double', default=False, action='store_true') +parser.add_argument('--resolution', type=float, help='Resolution of the input map/PDB in Ã…ngstroms (otherwise take from PDB header).' +) args = parser.parse_args() #### INPUT # input MRC file MRC_=vars(args)["map"] -# thresold +# threshold THRES_=vars(args)["threshold"] # half side of cubic box to calculate correlation in Angstrom # typically 2 Ang @@ -177,15 +179,22 @@ def write_data_to_mrc(filename, data, mrc): # indices for slicing full matrix imin = torch.max(torch.floor((xmin-x0)/dx).int(), torch.tensor([0,0,0]).to(torch.int).to(device_)) imax = torch.min(torch.ceil( (xmax-x0)/dx).int()+1, nbin) + # get resolution - parser = PDBParser() - structure = parser.get_structure("SYS", ZONE_PDB_) - res = structure.header["resolution"] + if hasattr(args, "resolution") and args.resolution is not None: + res = args.resolution + else: + parser = PDBParser() + structure = parser.get_structure("SYS", ZONE_PDB_) + res = structure.header["resolution"] # printout print("%37s %s" % ("Zoning based on PDB :", ZONE_PDB_)) print("%37s %s" % ("Zoning atoms selection :", ZONE_SEL_)) print("%37s %3.1lf" % ("Zoning cutoff [Ang] :", ZONE_CUT_)) - print("%37s %3.2lf" % ("Resolution [Ang] :", res)) + if res is not None: + print("%37s %3.2lf" % ("Resolution [Ang] :", res)) + else: + print("Resolution [Ang]: not provided") print("%37s %d" % ("Number of atoms :", len(pos_g))) print("%37s %4.1lf" % ("Mass [kDa] :", mass)) # indexes of entries above threshold in minibox (tuple of 3 tensors)