def pandda_input(request, dataset, method): project = current_project(request) processed_dir = project.pandda_processed_dataset_dir(method, dataset) pdb_path = next(processed_dir.glob("*pandda-input.pdb")) return download_http_response(pdb_path)
def refined_map(request, result_id, type): project = current_project(request) result = get_refine_result_by_id(project, result_id) mtz_path = Path(project.get_refine_result_dir(result), _density_filename("final", type)) return download_http_response(mtz_path, f"{result.name}{mtz_path.suffix}")
def pandda_average(request, dataset, method): project = current_project(request) zmap_path = Path( project.pandda_processed_dataset_dir(method, dataset), f"{dataset}-ground-state-average-map.native.ccp4", ) return download_http_response(zmap_path)
def pandda_consensus_zmap(request, dataset, method): project = current_project(request) zmap_path = Path( project.pandda_processed_dataset_dir(method, dataset), f"{dataset}-z_map.native.ccp4", ) return download_http_response(zmap_path)
def pandda_bdc(request, dataset, method): project = current_project(request) dataset_dir = project.pandda_processed_dataset_dir(method, dataset) # pick one of the matching .ccp4 files, # TODO: this gives us random ccp4 file of any # TODO: potentional BDC files, is this a good way to roll? ccp4_path = next(dataset_dir.glob("*BDC*.ccp4")) return download_http_response(ccp4_path)
def pandda_fitted(request, dataset: str, method: str): project = current_project(request) modelled_structures_dir = Path( project.pandda_processed_dataset_dir(method, dataset), "modelled_structures", ) # # pick 'fitted-vNNNN.pdb' file, with highest NNNN number # pdb_path = max(modelled_structures_dir.glob("*fitted*.pdb")) return download_http_response(pdb_path)
def ligand(request, result_id): """ view for fetching ligand PDBs generated by the ligand fitting tools 'fitting' is either 'ligfit' or 'rhofit', for the respective tool """ project = current_project(request) result = get_ligfit_result_by_id(project, result_id) tool = result.result.tool refine_dir = project.get_refine_result_dir( result.result.input.refine_result) if tool == "ligandfit": pdb_path = Path(refine_dir, "ligfit", "LigandFit_run_1_", "ligand_fit_1_1.pdb") elif tool == "rhofit": pdb_path = Path(refine_dir, "rhofit", "best.pdb") else: assert False, f"unexpected ligand fitting tool {tool}" return download_http_response(pdb_path)
def refined(request, result_id): project = current_project(request) result = get_refine_result_by_id(project, result_id) pdb_path = Path(project.get_refine_result_dir(result), "final.pdb") return download_http_response(pdb_path, f"{result.name}.pdb")
def get(request, id): project = current_project(request) pdb = get_pdb_by_id(project, id) return download_http_response(str(project.get_pdb_file(pdb)))