AFES Analyzer (Relative) ======================== The AFES Analyzer runs analysis on a completed **Free Energy Simulator** project. Connecting and authenticating, and finding analyzer projects, are described in :doc:`md_analyzer` (see :ref:`analyzer-connect`). .. contents:: Sections :local: :depth: 2 ---- Free Energy Analyzer -------------------- Overview -------- The Free Energy Analyzer runs analysis on a completed **Free Energy Simulator** project. The **Relative Binding** application is supported. It calculates the free energy difference between pairs of ligands (morphs). You select which morph pairs to analyze using their **1-based index number**, which you look up by calling ``list_free_energy_choices()``. .. note:: The analyzer MD engine follows the simulator project's program (AMBER or GROMACS). ``set_basic_info(md_engine=...)`` is optional, and a value that differs from the simulator project's program raises a ``ValueError``. Full Example ------------ :: import molcube as mc from molcube.analyzer import AnalyzerWorkspace molcube = mc.API('localhost', 8000) molcube.authenticate(api_token="your_api_key") simulator_project_id = "2041bed6-9cce-4de8-81a2-e3f8834e34f0" analyzer = molcube.create_analyzer_project(project_pk=simulator_project_id) # Step 1: Set project name and workspace analyzer.set_basic_info( analyzer_name="FE_ANALYZER_PROJECT", workspace=AnalyzerWorkspace.PERSONAL, ) # Step 2: Discover available morph pairs candidates = analyzer.list_free_energy_choices(simulator_project_id) # Step 3: Select by 1-based index analyzer.select_option(["1"]) # Step 4: Preview analyzer.preview_payload() # Step 5: Submit analyzer.submit_project() # Step 6: Inspect results analyzer.get_result() # Step 7: Download (index-based) analyzer.download_project(index=1) # Cancel a running job (optional) analyzer.stop_project() list_free_energy_choices ------------------------ Returns the available morph pairs for the specified simulator project:: candidates = analyzer.list_free_energy_choices(simulator_project_id) Example output for a Relative Binding project:: { "project_id": "2041bed6-9cce-4de8-81a2-e3f8834e34f0", "application": "Relative Binding", "item_type": "morphs", "ligand_force_fields": ["openff_fast"], "default_ligand_force_field": "openff_fast", "selection_options_by_force_field": { "openff_fast": [ {"id": "1-2", "label": "1-2"}, {"id": "2-1", "label": "2-1"} ] }, "default_items": ["1-2", "2-1"] } Use the 1-based position of an entry under ``selection_options_by_force_field`` to select what to analyze. select_option ------------- Selects which morph pairs to submit, by 1-based index:: # Submit morph pair 1 only analyzer.select_option(["1"]) # Submit morph pairs 1 and 2 together analyzer.select_option(["1", "2"]) After calling this, the selection is echoed to the console:: { "simulation_project_id": "2041bed6-9cce-4de8-81a2-e3f8834e34f0", "application": "Relative Binding", "item_type": "morphs", "ligand_force_field": "openff_fast", "selected_option_indexes": [1], "selected_items": ["1-2"], "selected_labels": ["1-2"] } preview_payload --------------- Displays the exact request payload that will be sent to the server:: >>> analyzer.preview_payload() { "projectPk": "2041bed6-9cce-4de8-81a2-e3f8834e34f0", "morphs": ["1-2"], "ligandForceField": "openff_fast", "title": "FE_ANALYZER_PROJECT" } Submit and Results ------------------ :: >>> analyzer.submit_project() '35780654-11da-4948-8e1b-348bca5f0971' Inspect results after the job finishes:: >>> analyzer.get_result() [ { "Set": 1, "Morph Pair": "1-2", "Start": "1a.sdf", "End": "1b.sdf", "ΔΔG": "Pending", "Download": "analyzer.download_project(index=1)" } ] Download results for a specific morph pair using the same 1-based index:: # Free Energy download requires the index of the submitted item analyzer.download_project(index=1) Cancel a running job:: analyzer.stop_project()