### Compile and Run MODELLER C Example Source: https://salilab.org/modeller/10.8/manual/node485 Example C code demonstrating how to use the MODELLER API. It reads a PDB file, prints data, and writes a new file in MMCIF format. Compilation requires specific flags obtained via `modXXX --cflags --libs` and `pkg-config`. Runtime requires setting environment variables for library paths and installation directories. ```c #include #include #include #include /* Example of using Modeller from a C program. This simply reads in a PDB * file, prints out some data from that file, and then writes out a new * file in MMCIF format. * * To compile, use (where XXX is your Modeller version): * gcc -Wall -o c-example c-example.c `modXXX --cflags --libs` \ * `pkg-config --cflags --libs glib-2.0` * (If you use a compiler other than gcc, or a non-Unix system, you may need * to run 'modXXX --cflags --libs' manually and construct suitable compiler * options by hand.) * * To run, you must ensure that the Modeller dynamic libraries are in your * search path. This can be done on most systems by adding the directory * reported by 'modXXX --libs' to the LD_LIBRARY_PATH environment variable. * (On Mac, set DYLD_LIBRARY_PATH instead. On Windows, PATH. On AIX, LIBPATH.) * * You must also ensure that Modeller knows where it was installed, * and what the license key is. You can either do this by setting the * MODINSTALLXXX and KEY_MODELLERXXX environment variables accordingly, or * by calling the mod_install_dir_set() and mod_license_key_set() functions * before you call mod_start(). For example, if Modeller is installed in * /lib/modeller on a 32-bit Linux system, the following would work from the * command line (all on one line), where KEY is your license key: * KEY_MODELLERXXX=KEY MODINSTALLXXX=/lib/modeller/ * LD_LIBRARY_PATH=/lib/modeller/lib/i386-intel8 ./c-example */ /* Exit, reporting the Modeller error, iff one occurred. */ void handle_error(int ierr) { if (ierr != 0) { GError *err = mod_error_get(); fprintf(stderr, "Modeller error: %s\n", err->message); g_error_free(err); exit(1); } } int main(void) { struct mod_libraries *libs; struct mod_model *mdl; struct mod_io_data *io; struct mod_file *fh; int ierr, *sel1, nsel1; /* Uncomment these lines to hard code install location and license key, rather than setting MODINSTALLXXX and KEY_MODELLERXXX environment variables (see above) */ /* mod_install_dir_set("/lib/modeller"); */ /* mod_license_key_set("KEY"); */ mod_start(&ierr); handle_error(ierr); mod_header_write(); mod_log_set(2, 1); libs = mod_libraries_new(NULL); fh = mod_file_open("${LIB}/restyp.lib", "r"); if (fh) { mod_libraries_read_libs(libs, fh, &ierr); mod_file_close(fh, &ierr); } else { ierr = 1; } handle_error(ierr); mod_libraries_rand_seed_set(libs, -8123); mdl = mod_model_new(NULL); io = mod_io_data_new(); fh = mod_file_open("../atom_files/2nbt.pdb", "r"); if (fh) { mod_model_read(mdl, io, libs, fh, "PDB", "FIRST:@LAST: ", 7, 0, &ierr); mod_file_close(fh, &ierr); } else { ierr = 1; } handle_error(ierr); printf("Model of %s solved at resolution %f, rfactor %f\n", mdl->seq.name, mdl->seq.resol, mdl->seq.rfactr); fh = mod_file_open("new.cif", "w"); if (fh) { mod_selection_all(mdl, &sel1, &nsel1); mod_model_write(mdl, libs, sel1, nsel1, fh, "MMCIF", 0, 1, "", &ierr); g_free(sel1); mod_file_close(fh, &ierr); } else { ierr = 1; } handle_error(ierr); mod_libraries_free(libs); ``` -------------------------------- ### C API Usage Example Source: https://salilab.org/modeller/10.8/manual/node485 An example demonstrating how to use the MODELLER API from a C program. This specific example reads a PDB file, extracts data, and writes it out in MMCIF format. ```APIDOC ## C API Usage Example ### Description This endpoint showcases a basic C program that utilizes the MODELLER API. It demonstrates file I/O operations, data extraction, and model writing in different formats. ### Method N/A (This is a code example, not a direct API call) ### Endpoint N/A (This is a code example, not a direct API call) ### Parameters N/A ### Request Example ```c #include #include #include #include /* Exit, reporting the Modeller error, iff one occurred. */ void handle_error(int ierr) { if (ierr != 0) { GError *err = mod_error_get(); fprintf(stderr, "Modeller error: %s\n", err->message); g_error_free(err); exit(1); } } int main(void) { struct mod_libraries *libs; struct mod_model *mdl; struct mod_io_data *io; struct mod_file *fh; int ierr, *sel1, nsel1; /* Uncomment these lines to hard code install location and license key, rather than setting MODINSTALLXXX and KEY_MODELLERXXX environment variables (see above) */ /* mod_install_dir_set("/lib/modeller"); */ /* mod_license_key_set("KEY"); */ mod_start(&ierr); handle_error(ierr); mod_header_write(); mod_log_set(2, 1); libs = mod_libraries_new(NULL); fh = mod_file_open("${LIB}/restyp.lib", "r"); if (fh) { mod_libraries_read_libs(libs, fh, &ierr); mod_file_close(fh, &ierr); } else { ierr = 1; } handle_error(ierr); mod_libraries_rand_seed_set(libs, -8123); mdl = mod_model_new(NULL); io = mod_io_data_new(); fh = mod_file_open("../atom_files/2nbt.pdb", "r"); if (fh) { mod_model_read(mdl, io, libs, fh, "PDB", "FIRST:@LAST: ", 7, 0, &ierr); mod_file_close(fh, &ierr); } else { ierr = 1; } handle_error(ierr); printf("Model of %s solved at resolution %f, rfactor %f\n", mdl->seq.name, mdl->seq.resol, mdl->seq.rfactr); fh = mod_file_open("new.cif", "w"); if (fh) { mod_selection_all(mdl, &sel1, &nsel1); mod_model_write(mdl, libs, sel1, nsel1, fh, "MMCIF", 0, 1, "", &ierr); g_free(sel1); mod_file_close(fh, &ierr); } else { ierr = 1; } handle_error(ierr); mod_libraries_free(libs); return 0; } ``` ### Response N/A (This is a code example, not a direct API call) ### Response Example ```json { "output": "Model of 2nbt solved at resolution [value], rfactor [value]\n" } ``` ``` -------------------------------- ### Basic Model Building in Modeller Source: https://salilab.org/modeller/10.8/manual/node38 Demonstrates the fundamental steps to initialize Modeller, set environment variables, and build a basic model from an alignment file. It uses the `MyModel` class for standard model construction. ```python from modeller import * log.verbose() env = Environ() a = MyModel(env, alnfile='align1.ali', knowns='templ1', sequence='targ1') a.make() ``` -------------------------------- ### Profile.scan() Usage Example Source: https://salilab.org/modeller/10.8/manual/node411 This snippet demonstrates how to initialize the Modeller environment and prepare for profile scanning. It sets up the necessary objects for subsequent profile operations. The 'scan' command itself is not shown here but would follow this initialization. ```python # Example for: Profile.scan() from modeller import * env = Environ() ``` -------------------------------- ### PIR Format Alignment File Example Source: https://salilab.org/modeller/10.8/manual/node13 An example of an alignment file in the PIR database format, which is preferred for comparative modeling in MODELLER. This format specifies the template structures and the target sequence alignment. ```plaintext C; A sample alignment in the PIR format; used in tutorial >P1;5fd1 structureX:5fd1:1 :A:106 :A:ferredoxin:Azotobacter vinelandii: 1.90: 0.19 AFVVTDNCIKCKYTDCVEVCPVDCFYEGPNFLVIHPDECIDCALCEPECPAQAIFSEDEVPEDMQEFIQLNAELA EVWPNITEKKDPLPDAEDWDGVKGKLQHLER* >P1;1fdx sequence:1fdx:1 :A:54 :A:ferredoxin:Peptococcus aerogenes: 2.00:-1.00 AYVINDSC--IACGACKPECPVNIIQGS--IYAIDADSCIDCGSCASVCPVGAPNPED----------------- -------------------------------* ``` -------------------------------- ### Building All-Hydrogen Model with Water and HETATM Source: https://salilab.org/modeller/10.8/manual/node38 Shows how to configure Modeller to include all hydrogen atoms, water molecules, and HETATM records when building a model. This is achieved by setting specific environment I/O flags. ```python from modeller import * from modeller.automodel import * log.verbose() env = Environ() env.io.hydrogen = env.io.hetatm = env.io.water = True a = AllHModel(env, alnfile='align1.ali', knowns='templ1', sequence='targ1') a.make() ``` -------------------------------- ### Getting MODELLER Compiler and Linker Flags Source: https://salilab.org/modeller/10.8/manual/node485 Instructions on how to obtain the necessary C compiler and linker flags for using the MODELLER library. This can be done using `pkg-config` if the MODELLER RPM package is installed, or by directly running the `modXXX` command. ```bash # Using pkg-config (if MODELLER RPM is installed): pkg-config --cflags modeller pkg-config --libs modeller # Alternatively, using the modXXX command: mod10.8 --cflags mod10.8 --libs ``` -------------------------------- ### Start Workers for Message-Passing in Python Source: https://salilab.org/modeller/10.8/manual/node472 This Python example demonstrates how to start workers for message-passing using Modeller's parallel job interface. It involves creating a job, adding a local worker, starting the workers, and then distributing tasks to them. Ensure 'modxxx' is in your PATH or specify 'modeller_path'. ```python from modeller import * from modeller.parallel import Job, LocalWorker # Create an empty parallel job, and then add a single worker process running # on the local machine j = Job() j.append(LocalWorker()) # Start all worker processes (note: this will only work if 'modxxx' - where # xxx is the Modeller version - is in the PATH; if not, use modeller_path # to specify an alternate location) j.start() # Have each worker read in a PDB file (provided by us, the master) and # return the PDB resolution back to us for worker in j: worker.run_cmd(''' env = Environ() env.io.atom_files_directory = ["../atom_files"] log.verbose() code = master.get_data() mdl = Model(env, file=code) master.send_data(mdl.resolution) ''') worker.send_data('1fdn') data = worker.get_data() print("%s returned model resolution: %f" % (str(worker), data)) ``` -------------------------------- ### Create PSSM Database and Scan Profiles in Python Source: https://salilab.org/modeller/10.8/manual/node125 This example demonstrates how to create a PSSM database using `env.make_pssmdb()` and then use it to scan a target profile against the database with `prf.scan()`. It requires the Modeller library and assumes profile files and a PSSM database file are available. ```python from modeller import * env = Environ() # First create a database of PSSMs env.make_pssmdb(profile_list_file = 'profiles.list', matrix_offset = -450, rr_file = '${LIB}/blosum62.sim.mat', pssmdb_name = 'profiles.pssm', profile_format = 'TEXT', pssm_weights_type = 'HH1') # Read in the target profile prf = Profile(env, file='T3lzt-uniprot90.prf', profile_format='TEXT') # Read the PSSM database psm = PSSMDB(env, pssmdb_name = 'profiles.pssm', pssmdb_format = 'text') # Scan against all profiles in the 'profiles.list' file # The score_statistics flag is set to false since there are not # enough database profiles to calculate statistics. prf.scan(profile_list_file = 'profiles.list', psm = psm, matrix_offset = -450, ccmatrix_offset = -100, rr_file = '${LIB}/blosum62.sim.mat', gap_penalties_1d = (-700, -70), score_statistics = False, output_alignments = True, output_score_file = None, profile_format = 'TEXT', max_aln_evalue = 1, aln_base_filename = 'T3lzt-ppscan', pssm_weights_type = 'HH1', summary_file = 'T3lzt-ppscan.sum') ``` -------------------------------- ### Conjugate Gradients Optimization Setup Source: https://salilab.org/modeller/10.8/manual/node269 This Python code sets up the Modeller environment, reads topology and parameter files, completes a PDB structure, and generates restraints for optimization. It then initializes ConjugateGradients and MolecularDynamics optimizer objects with reporting enabled. ```python from modeller import * from modeller.scripts import complete_pdb from modeller.optimizers import ConjugateGradients, MolecularDynamics, actions env = Environ() env.io.atom_files_directory = ['../atom_files'] env.edat.dynamic_sphere = True env.libs.topology.read(file='$(LIB)/top_heav.lib') env.libs.parameters.read(file='$(LIB)/par.lib') code = '1fas' mdl = complete_pdb(env, code) mdl.write(file=code+'.ini') # Select all atoms: atmsel = Selection(mdl) # Generate the restraints: mdl.restraints.make(atmsel, restraint_type='stereo', spline_on_site=False) mdl.restraints.write(file=code+'.rsr') mpdf = atmsel.energy() # Create optimizer objects and set defaults for all further optimizations cg = ConjugateGradients(output='REPORT') md = MolecularDynamics(output='REPORT') ``` -------------------------------- ### Get Atom Range using Model.atom_range() Source: https://salilab.org/modeller/10.8/manual/node176 This method returns a list of a subset of atoms from the model, specified by a start and end range. Both start and end must be valid atom indices. For example, selecting atoms from 'CA' in residue '1' to 'CB' in residue '10'. ```python atoms_subset = m.atom_range('CA:1', 'CB:10') ``` -------------------------------- ### Create and Configure IOData Object (Python) Source: https://salilab.org/modeller/10.8/manual/node146 Demonstrates how to create a new IOData object with default parameters and how to set specific parameters like 'hetatm' either during initialization or on an existing object. It also shows how to modify the default IOData object associated with the Environ class. ```python from modeller import * # Create a new IOData object with default parameters io = IOData() # Create a new IOData object and set the 'hetatm' parameter io = IOData(hetatm=True) # Set the 'hetatm' parameter on an existing object io.hetatm = True # Using IOData with the Environ class env = Environ() env.io.hetatm = True ``` -------------------------------- ### Get Residue Range from Model (Python) Source: https://salilab.org/modeller/10.8/manual/node177 Returns a list of residues within a specified range from a Model object. Both start and end parameters must be valid residue indices. The returned sublist can be accessed similarly to Sequence.residues. ```python m.residue_range('1', '10') ``` -------------------------------- ### Rename Model Segments with Python Source: https://salilab.org/modeller/10.8/manual/node194 This Python example demonstrates how to use the Model.rename_segments() method from the Modeller library. It assigns new single-character PDB chain IDs to all chains in a given model and renumbers the residues. The function requires a list of segment IDs and can optionally take a list of starting residue numbers for renumbering. The modified model is then written to a new PDB file. ```python # Example for: Model.rename_segments() # This will assign new PDB single-character chain id's to all the chains # in the input PDB file (in this example there are two chains). from modeller import * env = Environ() env.io.atom_files_directory = ['../atom_files'] mdl = Model(env, file='2abx') # Assign new segment names and write out the new model: mdl.rename_segments(segment_ids=('X', 'Y')) mdl.write(file='2abx-renamed.pdb') ``` -------------------------------- ### Displaying HETATM Residues and Basic Model/Alignment Operations in Modeller Source: https://salilab.org/modeller/10.8/manual/node38 This snippet demonstrates how to configure Modeller to display HETATM residues and perform basic operations like creating a model from a PDB code and initializing an alignment. It requires the Modeller environment and a PDB file or code. ```python # If you also want to see HETATM residues, uncomment this line: #env.io.hetatm = True code = '1BY8' mdl = Model(env, file=code) aln = Alignment(env) aln.append_model(mdl, align_codes=code) aln.write(file=code+'.seq') ``` -------------------------------- ### Schedule.make_for_model() Source: https://salilab.org/modeller/10.8/manual/node278 This method takes the input schedule and returns a new schedule, trimmed to the right length for the provided model. Schedule steps are taken from the input schedule in order, finishing when the first step with a residue range greater than or equal to the number of residues in the model is reached, unless the range is 9999. The value of `last_scales` for the input schedule is also considered; the last `last_scales` entries in the new schedule will always have the same scaling factors as the last `last_scales` entries in the input schedule, even if trimming occurred. ```APIDOC ## Schedule.make_for_model() ### Description Trims a schedule for a given model. ### Method `Schedule.make_for_model(mdl)` ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body - **mdl** (Model) - Required - The model for which to trim the schedule. ### Request Example ```json { "mdl": { /* Model object */ } } ``` ### Response #### Success Response (200) - **Schedule** (Schedule) - A new schedule object trimmed to the appropriate length for the model. #### Response Example ```json { "schedule": { /* New Schedule object */ } } ``` ``` -------------------------------- ### Model.atom_range() Source: https://salilab.org/modeller/10.8/manual/node176 Retrieves a list of atoms within a specified range (start to end, inclusive) from the model. The start and end parameters must be valid atom indices. ```APIDOC ## Model.atom_range() ### Description Returns a list containing a subset of atoms from the model, defined by a start and end range (inclusive). Both start and end must be valid atom indices. ### Method `atom_range(start, end)` ### Parameters #### Path Parameters * **start** (string) - Required - The starting atom index (e.g., 'CA:1'). * **end** (string) - Required - The ending atom index (e.g., 'CB:10'). ### Request Example ```python model_object.atom_range('CA:1', 'CB:10') ``` ### Response #### Success Response (200) - **atoms** (list) - A list of atom objects within the specified range. #### Response Example ```json { "atoms": [ { "name": "CA", "residue_name": "1", "chain_id": "A", "atom_id": "1", "x": 10.1, "y": 20.2, "z": 30.3 }, { "name": "CB", "residue_name": "1", "chain_id": "A", "atom_id": "2", "x": 11.1, "y": 21.2, "z": 31.3 } // ... more atoms ] } ``` ``` -------------------------------- ### Chain Object Example - Python Source: https://salilab.org/modeller/10.8/manual/node341 Demonstrates the usage of Chain objects in MODSELLER. This example initializes MODSELLER, reads a PDB file, prints existing chain IDs and lengths, renames chains, and writes out chain sequences. ```python # Example for 'chain' objects from modeller import * from modeller.scripts import complete_pdb env = Environ() env.io.atom_files_directory = ['../atom_files'] env.libs.topology.read(file='$(LIB)/top_heav.lib') env.libs.parameters.read(file='$(LIB)/par.lib') mdl = complete_pdb(env, "1b3q") # Print existing chain IDs and lengths: print("Chain IDs and lengths: " \ + str([(c.name, len(c.residues)) for c in mdl.chains])) # Set new chain IDs: mdl.chains['A'].name = 'X' mdl.chains['B'].name = 'Y' # Write out chain sequences: for c in mdl.chains: c.write(file='1b3q%s.chn' % c.name, atom_file='1b3q', align_code='1b3q%s' % c.name) ``` -------------------------------- ### Build and Write Profile - Python Source: https://salilab.org/modeller/10.8/manual/node412 Demonstrates building a profile from a sequence database using specific parameters and then writing the profile to a text file. It also shows converting the profile back to an alignment and writing it to a PIR file. ```Python prf = aln.to_profile() prf.build(sdb, matrix_offset=-450, rr_file='${LIB}/blosum62.sim.mat', gap_penalties_1d=(-500, -50), n_prof_iterations=5, check_profile=False, max_aln_evalue=0.01, gaps_in_target=False) prf.write(file='buildprofile.prf', profile_format='TEXT') aln = prf.to_alignment() aln.write(file='buildprofile.ali', alignment_format='PIR') ``` -------------------------------- ### Execute MODELLER Script without Python Installation Source: https://salilab.org/modeller/10.8/manual/node14 This command runs the MODELLER script 'model-default.py' using the 'mod10.8' executable, which is an alternative for systems where Python is not installed or configured. This method bypasses the direct Python interpreter call. ```bash mod10.8 model-default.py ``` -------------------------------- ### LoopModel.build_ini_loop() - Initial Loop Conformation Source: https://salilab.org/modeller/10.8/manual/node96 This method creates the initial conformation of the loop. By default, all atoms are placed on a line between the loop termini. You can redefine this routine to use a different conformation. ```APIDOC ## LoopModel.build_ini_loop() ### Description This creates the initial conformation of the loop. By default all atoms are placed on a line between the loop termini, but you may want to use a different conformation, in which case you should redefine this routine. For example, if you want to leave the initial PDB/mmCIF file untouched, use a one-line 'pass' routine. ### Method `build_ini_loop(atmsel)` ### Parameters #### Path Parameters - **atmsel** (AtomSelection) - Required - Selection of atoms to build the loop. ### Request Example ```python # Example usage (conceptual): # loop_model.build_ini_loop(atom_selection) ``` ### Response #### Success Response (None) This method does not return a value, but modifies the loop model in place. #### Response Example ```json // No explicit response body, loop model is modified. ``` ``` -------------------------------- ### Defining a Custom Residue in CHARMM RTF Format Source: https://salilab.org/modeller/10.8/manual/node38 Provides an example of defining a custom residue ('ALA' without hydrogens) using the CHARMM residue topology file (RTF) format. It includes RESI, ATOM, BOND, IMPR, and IC records. ```text RESI ALA 0.00000 ATOM N NH1 -0.29792 ATOM CA CT1 0.09563 ATOM CB CT3 -0.17115 ATOM C C 0.69672 ATOM O O -0.32328 BOND CB CA N CA O C C CA C +N IMPR C CA +N O CA N C CB IC -C N CA C 1.3551 126.4900 180.0000 114.4400 1.5390 IC N CA C +N 1.4592 114.4400 180.0000 116.8400 1.3558 IC +N CA *C O 1.3558 116.8400 180.0000 122.5200 1.2297 IC CA C +N +CA 1.5390 116.8400 180.0000 126.7700 1.4613 IC N C *CA CB 1.4592 114.4400 123.2300 111.0900 1.5461 IC N CA C O 1.4300 107.0000 0.0000 122.5200 1.2297 PATC FIRS NTER LAST CTER ``` -------------------------------- ### Using File Handles and Alignment Objects with AutoModel Source: https://salilab.org/modeller/10.8/manual/node44 Shows how to provide alignment data to AutoModel using file handles or existing Alignment objects instead of just file paths. Note that this has limitations, particularly with parallel jobs and certain alignment functions. ```python import modeller env = modeller.Environ() # Using a file handle try: with open("alignment.pir", 'r') as aln_handle: automodel_file_handle = modeller.automodel.AutoModel(env, alnfile=aln_handle, knowns="template_chain", sequence="target_chain") except IOError as e: print(f"Error opening alignment file: {e}") # Using an existing Alignment object (assuming 'alignment_obj' is a modeller.alignment.Alignment instance) # alignment_obj = modeller.alignment.Alignment(env) # alignment_obj.read(file=alnfile, align_codes={'template_chain', 'target_chain'}) # automodel_align_obj = modeller.automodel.AutoModel(env, alnfile=alignment_obj, knowns="template_chain", sequence="target_chain") ``` -------------------------------- ### Get Model Filename - Python Source: https://salilab.org/modeller/10.8/manual/node76 The get_model_filename() function in Python returns the PDB or mmCIF file name for a generated model. It constructs names like 'foo.B000X000Y.pdb' based on provided parameters and can be redefined for custom naming schemes. Typical usage involves a constant id1 and a sequential id2 for model numbering. ```python def get_model_filename(root_name, id1, id2, file_ext): # Example implementation (can be redefined) return f"{root_name}.B{id1:04d}{id2:04d}.{file_ext}" ``` -------------------------------- ### Create PSSM Database and Scan Profile (Modeller) Source: https://salilab.org/modeller/10.8/manual/node411 This snippet demonstrates how to create a PSSM database from a list of profiles and then scan a target profile against this database. It requires the 'profiles.list' file, a reference scoring matrix (e.g., BLOSUM62), and specifies various parameters for database creation and scanning, including profile format and scoring weights. The output includes alignments and a summary file. ```python env.make_pssmdb(profile_list_file = 'profiles.list', matrix_offset = -450, rr_file = '${LIB}/blosum62.sim.mat', pssmdb_name = 'profiles.pssm', profile_format = 'TEXT', pssm_weights_type = 'HH1') prf = Profile(env, file='T3lzt-uniprot90.prf', profile_format='TEXT') psm = PSSMDB(env, pssmdb_name = 'profiles.pssm', pssmdb_format = 'text') prf.scan(profile_list_file = 'profiles.list', psm = psm, matrix_offset = -450, ccmatrix_offset = -100, rr_file = '${LIB}/blosum62.sim.mat', gap_penalties_1d = (-700, -70), score_statistics = False, output_alignments = True, output_score_file = None, profile_format = 'TEXT', max_aln_evalue = 1, aln_base_filename = 'T3lzt-ppscan', pssm_weights_type = 'HH1', summary_file = 'T3lzt-ppscan.sum') ``` -------------------------------- ### Comparative modeling with ligand transfer from template in Python Source: https://salilab.org/modeller/10.8/manual/node18 This Python script demonstrates comparative modeling using MODELLER, specifically focusing on transferring ligand information from a template to the generated model. It loads necessary classes, sets up the MODELLER environment, and configures directories for atom files. Ensure MODELLER is installed and accessible. ```python # Comparative modeling with ligand transfer from the template from modeller import * # Load standard Modeller classes from modeller.automodel import * # Load the AutoModel class log.verbose() # request verbose output env = Environ() # create a new MODELLER environment to build this model in # directories for input atom files env.io.atom_files_directory = ['.', '../atom_files'] ``` -------------------------------- ### Get Equivalent Atom in Another Residue (Python) Source: https://salilab.org/modeller/10.8/manual/node395 This function, `get_equivalent_atom(res)`, returns an Atom object that is structurally equivalent to the current atom but resides in a different Residue object. It returns None if no equivalent atom is found. The equivalency rules consider residue types, topology, and mappings defined in 'modlib/restyp.lib' and 'modlib/atmeqv.lib'. ```python def get_equivalent_atom(res): """Given another `Residue` object, this returns an `Atom` object representing the structurally equivalent atom in that residue, or `None` if no such atom can be found. (This is primarily used by **Restraints.make_distance()**.) The rules for determining equivalency are: * If either residue is non-standard, but is denoted as being 'similar' to a standard residue with the STD column in `'modlib/restyp.lib'`, treat it below as if it is the similar standard residue (_e.g._ , ASX is treated like ASN). * If the two residues are of the same type, or either residue has no topology (_e.g._ , it is a BLK residue), find an atom with the same name. * If the two residues are both standard amino acids, use the mapping defined in `'modlib/atmeqv.lib'` (this is not always a simple match on name; for example, CYS SG is equivalent to ASP CG, since they tend to be similarly placed in space). * Otherwise, no atom is treated as equivalent (even if the names are the same; for example, the O atom in water residues is not equivalent to the backbone O in standard amino acids).""" # Implementation details would follow here, referencing internal Modeller logic and library files. ``` -------------------------------- ### log.minimal() - Display minimal log output Source: https://salilab.org/modeller/10.8/manual/node448 Configures MODELLER to display only minimal log output. This is useful for getting essential information without excessive detail. ```APIDOC ## log.minimal() ### Description Displays minimal log output. ### Method `log.minimal()` ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Request Example ```python log.minimal() ``` ### Response #### Success Response (200) No specific return value indicated, operates as a setting. #### Response Example None ``` -------------------------------- ### Comparative Modeling with Multiple Templates in Python Source: https://salilab.org/modeller/10.8/manual/node21 This Python script demonstrates how to perform comparative modeling using multiple templates with MODELLER's AutoModel class. It requires an alignment file and the codes of the known template structures, as well as the target sequence. The script sets up the environment, specifies input directories, and then initiates the modeling process by calling the `make()` method. ```python # Comparative modeling with multiple templates from modeller import * from modeller.automodel import * log.verbose() # request verbose output env = Environ() # create a new MODELLER environment to build this model in # directories for input atom files env.io.atom_files_directory = ['.', '../atom_files'] a = AutoModel(env, alnfile = 'align-multiple.ali', # alignment filename knowns = ('5fd1', '1bqx'), # codes of the templates sequence = '1fdx') # code of the target a.starting_model= 1 # index of the first model a.ending_model = 1 # index of the last model # (determines how many models to calculate) a.make() # do the actual comparative modeling ``` -------------------------------- ### Align 3D Structures of Proteins Source: https://salilab.org/modeller/10.8/manual/node316 This example demonstrates how to align 3D structures of two proteins using the Alignment.align3d() method. It shows two approaches: reading sequences from an alignment file and reading sequences directly from PDB files. The method uses an iterative least-squares superposition and dynamic programming based on a residue-residue distance matrix. The 'gap_penalties_3d' parameter controls gap creation and extension penalties, influencing the identification of equivalent residue pairs. The example also includes superposing structures using Selection.superpose() after alignment. ```python # Example for: Alignment.align3d(), Selection.superpose() # This will align 3D structures of two proteins: from modeller import * log.verbose() env = Environ() env.io.atom_files_directory = ['../atom_files'] # First example: read sequences from a sequence file: aln = Alignment(env) aln.append(file='toxin.ali', align_codes=['1fas', '2ctx']) aln.align(gap_penalties_1d=[-600, -400]) aln.align3d(gap_penalties_3d=[0, 4.0]) aln.write(file='toxin-str.ali') # Second example: read sequences from PDB files to eliminate the # need for the toxin.ali sequence file: mdl = Model(env) aln = Alignment(env) for code in ['1fas', '2ctx']: mdl.read(file=code) aln.append_model(mdl, align_codes=code, atom_files=code) aln.align(gap_penalties_1d=(-600, -400)) aln.align3d(gap_penalties_3d=(0, 2.0)) aln.write(file='toxin-str.ali') # And now superpose the two structures using current alignment to get # various RMS's: mdl = Model(env, file='1fas') atmsel = Selection(mdl).only_atom_types('CA') mdl2 = Model(env, file='2ctx') atmsel.superpose(mdl2, aln) ``` -------------------------------- ### Model.rename_segments() Source: https://salilab.org/modeller/10.8/manual/node194 This method assigns single character PDB chain IDs to segments and renumbers residues within each chain. It can take an optional list for starting residue numbers. ```APIDOC ## Model.rename_segments() ### Description This method assigns single character PDB chain IDs (from `segment_ids`) to the chains in the current MODEL. The residues in each chain are also renumbered consecutively, starting with the corresponding element from `renumber_residues` if provided, or the existing first residue number otherwise. ### Method `rename_segments(segment_ids, renumber_residues=[])` ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body - **segment_ids** (tuple) - Required - A tuple of single characters representing the new PDB chain IDs for each segment. - **renumber_residues** (list) - Optional - A list of integers representing the starting residue number for each corresponding segment. If not provided, existing residue numbers are used. ### Request Example ```python # Example for: Model.rename_segments() # This will assign new PDB single-character chain id's to all the chains # in the input PDB file (in this example there are two chains). from modeller import * env = Environ() env.io.atom_files_directory = ['../atom_files'] mdl = Model(env, file='2abx') # Assign new segment names and write out the new model: mdl.rename_segments(segment_ids=('X', 'Y')) mdl.write(file='2abx-renamed.pdb') ``` ### Response #### Success Response (200) This method modifies the Model object in place and does not return a specific value, but the model's segments and residues are updated. #### Response Example N/A (modifies object in place) ``` -------------------------------- ### Profile-Profile Alignment using SALIGN Source: https://salilab.org/modeller/10.8/manual/node318 This example illustrates profile-profile alignment using SALIGN. It involves setting up the environment, loading sequences in FASTA format, and performing the SALIGN operation with parameters specific to profile alignment, such as `align_what='PROFILE'` and `comparison_type='PSSM'`. The output can be a multiple sequence alignment or pairwise alignments. ```python # profile-profile alignment using salign from modeller import * log.level(1, 0, 1, 1, 1) env = Environ() aln = Alignment(env, file='mega_prune.faa', alignment_format='FASTA') aln.salign(rr_file='${LIB}/blosum62.sim.mat', gap_penalties_1d=(-500, 0), output='', align_block=15, # no. of seqs. in first MSA align_what='PROFILE', alignment_type='PAIRWISE', comparison_type='PSSM', # or 'MAT' (Caution: Method NOT benchmarked # for 'MAT') similarity_flag=True, # The score matrix is not rescaled substitution=True, # The BLOSUM62 substitution values are # multiplied to the corr. coef. #output_weights_file='test.mtx', # optional, to write weight matrix smooth_prof_weight=10.0) # For mixing data with priors #write out aligned profiles (MSA) aln.write(file='salign.ali', alignment_format='PIR') # Make a pairwise alignment of two sequences aln = Alignment(env, file='salign.ali', alignment_format='PIR', align_codes=('12asA', '1b8aA')) aln.write(file='salign_pair.ali', alignment_format='PIR') aln.write(file='salign_pair.pap', alignment_format='PAP') ``` -------------------------------- ### Initialize AutoModel for Comparative Modeling Source: https://salilab.org/modeller/10.8/manual/node44 Initializes the AutoModel object for building comparative models. It requires an alignment file and can optionally take known templates and the target sequence. Parameters like deviation, library schedule, and assessment methods can be configured during initialization. ```python env = modeller.Environ() alnfile = "alignment.pir" knowns = "template_chain" sequence = "target_chain" # Basic initialization automodel = modeller.automodel.AutoModel(env, alnfile=alnfile, knowns=knowns, sequence=sequence) # With optional parameters automodel_custom = modeller.automodel.AutoModel(env, alnfile=alnfile, knowns=knowns, sequence=sequence, deviation=5.0, library_schedule=' செய்யவும்.lib', csrfile='restraints.csr', inifile='initial_model.pdb', assess_methods=['assess.GA341', 'assess.DOPE'], root_name='my_model') ``` -------------------------------- ### Get Optimizer Actions (AutoModel) Source: https://salilab.org/modeller/10.8/manual/node65 Retrieves a list of actions performed during the initial optimization phase. This method can be overridden to include custom actions like writing trajectory files. ```python def get_optimize_actions(self): """Return a list of optimizer actions.""" return [] ``` -------------------------------- ### File Operations and Optimization Setup Source: https://salilab.org/modeller/10.8/manual/node269 Opens a file in write mode to store optimization statistics and defines the atomic selection for optimization. This sets up the environment for subsequent optimization runs. ```python trcfil = open(code+'.D00000001', 'w') ``` -------------------------------- ### Build All Hydrogen Model with AllHModel Source: https://salilab.org/modeller/10.8/manual/node22 This Python script demonstrates how to build an all-hydrogen model using Modeller's AllHModel class. It initializes the environment, sets the atom file directory, and then constructs and optimizes the model from a given alignment and PDB codes. The AllHModel class automatically handles hydrogen atom inclusion and topology settings. ```python from modeller import * from modeller.automodel import * log.verbose() env = Environ() env.io.atom_files_directory = ['.', '../atom_files'] a = AllHModel(env, alnfile='alignment.ali', knowns='5fd1', sequence='1fdx') a.starting_model = a.ending_model = 4 a.make() ``` -------------------------------- ### Automodel Usage for HETATM Records Source: https://salilab.org/modeller/10.8/manual/node18 Demonstrates how to initialize and run AutoModel to perform comparative modeling, incorporating HETATM records from template PDB files. It highlights the use of the 'align-ligand.ali' alignment file and specifies the template and target sequences. ```python env.io.hetatm = True a = AutoModel(env, alnfile = 'align-ligand.ali', # alignment filename knowns = '5fd1', # codes of the templates sequence = '1fdx') # code of the target a.starting_model= 4 # index of the first model a.ending_model = 4 # index of the last model # (determines how many models to calculate) a.make() # do the actual comparative modeling ``` -------------------------------- ### Python Command Equivalents for TOP Models Source: https://salilab.org/modeller/10.8/manual/node516 This snippet details Python commands for model manipulation and generation, corresponding to TOP commands. It covers Model.build(), Model.color(), Model.generate_topology(), Model.to_iupac(), Model.make_chains(), Model.make_region(), Model.patch(), Model.patch_ss(), Model.patch_ss_templates(), Model.orient(), Model.rename_segments(), Model.reorder_atoms(), Model.res_num_from(), Model.transfer_xyz(), Model.write_data(), and Model.write(). ```python Model.build() Model.color() Model.generate_topology() Model.to_iupac() Model.make_chains() Model.make_region() Model.patch() Model.patch_ss() Model.patch_ss_templates() Model.orient() Model.rename_segments() Model.reorder_atoms() Model.res_num_from() Model.transfer_xyz() Model.write_data() Model.write() ```