From 7d83474a35c492ba23446a768bf0cf37c8cf4c79 Mon Sep 17 00:00:00 2001 From: "Stephanie (Mullane) Wankowicz" Date: Wed, 24 Apr 2024 17:32:59 -0700 Subject: [PATCH 1/2] re-write em refinement 1) Ask user to put in resolution 2) only do occupancy refinement 3) updated Phenix version to deal with map-model match issue 4) remove adding hydrogens automatically --- scripts/post/qfit_final_refine_cryoem.sh | 86 ++++++------------------ 1 file changed, 20 insertions(+), 66 deletions(-) diff --git a/scripts/post/qfit_final_refine_cryoem.sh b/scripts/post/qfit_final_refine_cryoem.sh index 034f568a..92638e78 100755 --- a/scripts/post/qfit_final_refine_cryoem.sh +++ b/scripts/post/qfit_final_refine_cryoem.sh @@ -1,14 +1,14 @@ #!/bin/bash ''' -This script works with Phenix version 1.18. +This script works with Phenix version 1.21dev. ''' qfit_usage() { echo >&2 "Usage:"; - echo >&2 " $0 mapfile.ccp4 originalmodel.pdb [multiconformer_model2.pdb]"; + echo >&2 " $0 mapfile.ccp4 [multiconformer_model2.pdb]"; echo >&2 ""; - echo >&2 "mapfile.ccp4, originalmodel.pdb, multiconformer_model2.pdb MUST exist in this directory."; + echo >&2 "mapfile.ccp4, multiconformer_model2.pdb MUST exist in this directory."; echo >&2 "Outputs will be written to mapfile_qFit.{pdb|mtz|log}."; exit 1; } @@ -33,23 +33,22 @@ command -v remove_duplicates >/dev/null 2>&1 || { # Assert required files exist mapfile=$1 -org_model=$2 +res=$2 multiconf=${3:-multiconformer_model2.pdb} -echo "mapfile : ${mapfile} $([[ -f ${mapfile} ]] || echo '[NOT FOUND]')"; -echo "original model : ${org_model} $([[ -f ${org_model} ]] || echo '[NOT FOUND]')"; +echo "mapfile: ${mapfile} $([[ -f ${mapfile} ]] || echo '[NOT FOUND]')"; +if [ -z "${res}" ]; then + echo >&2 "Resolution not specified."; + exit 1; +fi +echo "resolution : ${res}"; echo "qfit unrefined model : ${multiconf} $([[ -f ${multiconf} ]] || echo '[NOT FOUND]')"; echo ""; -if [[ ! -f "${mapfile}" ]] || [[ ! -f "${multiconf}" ]] || [[ -f ${org_model} ]]; then +if [[ ! -f "${mapfile}" ]] || [[ ! -f "${multiconf}" ]]; then qfit_usage; fi pdb_name="${mapfile%.ccp4}" echo $pdb_name -#__________________________________DETERMINE RESOLUTION AND (AN)ISOTROPIC REFINEMENT__________________________________ -resolution=$(grep 'REMARK 3 RESOLUTION RANGE HIGH (ANGSTROMS) :' $org_model) -echo $resolution -res=`echo "${resolution}" | cut -d " " -f 14 | cut -c 1-5` -echo "Resolution: ${res}" #__________________________________REMOVE DUPLICATE HET ATOMS__________________________________ remove_duplicates "${multiconf}" @@ -62,34 +61,7 @@ phenix.ready_set hydrogens=false \ trust_residue_code_is_chemical_components_code=true \ pdb_file_name="${multiconf}.f_modified.pdb" -#__________________________________REFINEMENT WITHOUT HYDROGENS__________________________________ -if [ -f "${multiconf}.f_modified.ligands.cif" ]; then - echo "with ligand" - phenix.real_space_refine "${multiconf}.f_modified.updated.pdb" \ - "${pdb_name}.ccp4" \ - "${multiconf}.f_modified.ligands.cif" \ - output.file_name_prefix="${pdb_name}2" \ - macro_cycles=5 \ - resolution=${res} \ - --overwrite -else - phenix.real_space_refine "${multiconf}.f_modified.pdb" \ - "${pdb_name}.ccp4" \ - output.file_name_prefix="${pdb_name}2" \ - macro_cycles=5 \ - resolution=${res} \ - --overwrite -fi - -#__________________________________ADD HYDROGENS__________________________________ -# The first round of refinement regularizes geometry from qFit. -# Here we add H with phenix.reduce. Addition of H to the backbone is important -# since it introduces planarity restraints to the peptide bond. -# This helps to prevent backbone conformers from being merged during -# subsequent rounds of refinement. -cp "${pdb_name}2_real_space_refined.001.pdb" "${pdb_name}2.000.pdb" -phenix.reduce "${pdb_name}2.000.pdb" > "${pdb_name}2_real_space_refined.001.pdb" - +cp ${multiconf}.f_modified.pdb ${pdb_name}2_real_space_refined.001.pdb #__________________________________REFINE UNTIL OCCUPANCIES CONVERGE__________________________________ zeroes=50 i=1 @@ -100,51 +72,33 @@ while [ $zeroes -gt 1 ]; do phenix.real_space_refine "${pdb_name}2_real_space_refined.001.pdb" \ "${pdb_name}.ccp4" \ "${multiconf}.f_modified.ligands.cif" \ - output.file_name_prefix="${pdb_name}3" \ + output.prefix="${pdb_name}3" \ macro_cycles=5 \ resolution=${res} \ --overwrite else phenix.real_space_refine "${pdb_name}2_real_space_refined.001.pdb" \ "${pdb_name}.ccp4" \ - output.file_name_prefix="${pdb_name}3" \ + output.prefix="${pdb_name}3" \ macro_cycles=5 \ resolution=${res} \ --overwrite fi - zeroes=`redistribute_cull_low_occupancies -occ 0.09 "${pdb_name}3_real_space_refined.pdb" | tail -n 1` + zeroes=`redistribute_cull_low_occupancies -occ 0.09 "${pdb_name}3_real_space_refined_000.pdb" | tail -n 1` echo "Post refinement zeroes: ${zeroes}" - if [ ! -f "${pdb_name}3_real_space_refined_norm.pdb" ]; then + if [ ! -f "${pdb_name}3_real_space_refined_000_norm.pdb" ]; then echo >&2 "Normalize occupancies did not work!"; exit 1; else - mv "${pdb_name}3_real_space_refined_norm.pdb" "${pdb_name}2_real_space_refined.001.pdb" + mv "${pdb_name}3_real_space_refined_000_norm.pdb" "${pdb_name}2_real_space_refined.001.pdb" fi - done -#__________________________________FINAL REFINEMENT__________________________________ -mv "${pdb_name}2_real_space_refined.001.pdb" "${pdb_name}4_real_space_refined.001.pdb" -if [ -f "${multiconf}.f_modified.ligands.cif" ]; then - phenix.real_space_refine "${pdb_name}4_real_space_refined.001.pdb" \ - "${pdb_name}.ccp4" \ - "${multiconf}.f_modified.ligands.cif" \ - output.file_name_prefix="${pdb_name}5" \ - macro_cycles=5 \ - resolution=${res} \ - --overwrite -else - phenix.real_space_refine "${pdb_name}4_real_space_refined.001.pdb" \ - "${pdb_name}.ccp4" \ - output.file_name_prefix="${pdb_name}5" \ - macro_cycles=5 \ - resolution=${res} \ - --overwrite -fi + #__________________________________NAME FINAL FILES__________________________________ -cp "${pdb_name}5_real_space_refined.pdb" "${pdb_name}_qFit.pdb" +cp "${pdb_name}2_real_space_refined.001.pdb" "${pdb_name}_qFit.pdb" cp "${pdb_name}.ccp4" "${pdb_name}_qFit.ccp4" -cp "${pdb_name}5_real_space_refined.log" "${pdb_name}_qFit.log" +cp "${pdb_name}${pdb_name}2_real_space_refined.001.log" "${pdb_name}_qFit.log" From 0142aa076a5923d2b51533d6cc7a69044097c9b7 Mon Sep 17 00:00:00 2001 From: "Stephanie (Mullane) Wankowicz" Date: Wed, 24 Apr 2024 18:07:53 -0700 Subject: [PATCH 2/2] remove typo --- scripts/post/qfit_final_refine_cryoem.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/post/qfit_final_refine_cryoem.sh b/scripts/post/qfit_final_refine_cryoem.sh index 92638e78..7b8ab713 100755 --- a/scripts/post/qfit_final_refine_cryoem.sh +++ b/scripts/post/qfit_final_refine_cryoem.sh @@ -101,4 +101,4 @@ done #__________________________________NAME FINAL FILES__________________________________ cp "${pdb_name}2_real_space_refined.001.pdb" "${pdb_name}_qFit.pdb" cp "${pdb_name}.ccp4" "${pdb_name}_qFit.ccp4" -cp "${pdb_name}${pdb_name}2_real_space_refined.001.log" "${pdb_name}_qFit.log" +cp "${pdb_name}2_real_space_refined.001.log" "${pdb_name}_qFit.log"