Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix KeyError 'iptm+ptm' not found in analysis pipeline #386

Merged
merged 8 commits into from
Jul 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion alphapulldown/analysis_pipeline/alpha_analysis_jax0.3.def
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,4 @@ From: kosinskilab/alpha_analysis_basis_jax0.3:latest
chmod +x /app/run_get_good_pae.sh
chmod +x /app/run_execute_notebook.sh
chmod +x /app/run_pi_score.sh
chmod +x /app/alpha-analysis/get_good_inter_pae.py
chmod +x /app/alpha-analysis/get_good_inter_pae.py
2 changes: 1 addition & 1 deletion alphapulldown/analysis_pipeline/alpha_analysis_jax0.4.def
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,4 @@ From: kosinskilab/alpha_analysis_basis_jax0.4:latest
chmod +x /app/run_get_good_pae.sh
chmod +x /app/run_execute_notebook.sh
chmod +x /app/run_pi_score.sh
chmod +x /app/alpha-analysis/get_good_inter_pae.py
chmod +x /app/alpha-analysis/get_good_inter_pae.py
2 changes: 1 addition & 1 deletion alphapulldown/analysis_pipeline/create_notebook.py
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ def main(argv):
open(os.path.join(result_subdir, "ranking_debug.json"), "rb")
)

if "iptm" in data.keys() or "iptm+ptm" in data.keys():
if "iptm+ptm" in data.keys():
iptm_ptm_score = data["iptm+ptm"][best_model]
pae_mtx,iptm_score = obtain_pae_and_iptm(result_subdir=os.path.join(FLAGS.output_dir, job),
best_model=best_model)
Expand Down
4 changes: 3 additions & 1 deletion alphapulldown/analysis_pipeline/get_good_inter_pae.py
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ def main(argv):
best_model = ranking_data['order'][0]
data = ranking_data

if "iptm" in data or "iptm+ptm" in data:
if "iptm+ptm" in data:
iptm_ptm_score = data['iptm+ptm'][best_model]

try:
Expand All @@ -154,6 +154,8 @@ def main(argv):
output_df = pd.concat([score_df, output_df])
except Exception as e:
logging.error(f"Error processing PAE and iPTM for job {job}: {e}")
else:
logging.warning(f"{job} does not seem to be a multimeric model. iptm+ptm scores are not in the ranking_debug.json Skipped")
except Exception as e:
logging.error(f"Error getting the best model name from ranking_debug.json for job :{job} : {e}")
except Exception as e:
Expand Down
10 changes: 9 additions & 1 deletion alphapulldown/folding_backend/alphafold_backend.py
Original file line number Diff line number Diff line change
Expand Up @@ -621,7 +621,15 @@ def postprocess(
if f'relax_{model_name}' in timings:
continue
t_0 = time.time()
unrelaxed_protein = prediction_results[model_name]['unrelaxed_protein']
if 'unrelaxed_protein' in prediction_results[model_name].keys():
unrelaxed_protein = prediction_results[model_name]['unrelaxed_protein']
else:
unrelaxed_pdb_path = os.path.join(output_dir, f"unrelaxed_{model_name}.pdb")
if not os.path.exists(unrelaxed_pdb_path):
logging.error(f"Cannot find {unrelaxed_pdb_path} for relaxation! Skipping...")
continue
unrelaxed_pdb_string = open(unrelaxed_pdb_path, 'r').read()
unrelaxed_protein = protein.from_pdb_string(unrelaxed_pdb_string)
relaxed_pdb_str, _, violations = amber_relaxer.process(
prot=unrelaxed_protein)
relax_metrics[model_name] = {
Expand Down
Loading