📄 automolprep.perl
字号:
#!/bin/perl# mark AutoMolDockPrep######################################################################################## Author: Jim Arnold# Purpose: Prepares .pdb files for docking, i.e. does this:### Separate Molecules, add Hydrogens and Charges to .mol2# file_rec.pdb/mol2 (receptor and metals),# - file_lig.pdb/mol2, file_wat.pdb/mol2# /| # /# (list of) file.pdb ---> Connolly Surface, All Spheres, and Docking Sphere Set.# \ file_rec.ms, file_rec.sph, file_rec_as.sph (dock sph), # \|# - Grid Box and Docking Grids.# file_rec_box.pdb (grid box), file_rec_grid.bmp/cnt/nrg### Output: Molecules separated into protein, ligand, and waters, also grids, grid box# spheres, and a docking sphere set for the binding site.# Notes: Automated to simplify preparation for Docking to a large number of proteins,# and to make Dock easier to use. Also, this program (or subroutines) can# easily be called from an interface.## Use: /idk1/people/arnold >: AutoMolDockPrep.perl protein.in <ret># # Example Input File (protein.in):## ########################################### # Protein input file to AutoMolPrep.perl# # format: filename central_residue# ############################################ 1tps.pdb 195# 1ca0.pdb 195# 1fle.pdb 195# 4phv.pdb 25# etc...######################################################################################## ################ # logical defs. ################ $true = 1; $false = 0; ############## # mark debug ############## $MONITOR = $true; $DB_AUTO_PREP = $false; $DB_AUTO_PREP_L = $false; $DB_PARSE = $false; $DB_PARSE_PROT = $false; $DB_PARSE_LIG = $false; $DB_PARSE_WAT = $false; $DB_PARSE_MET = $false; $DB_WRITE = $false; $DB_WRITE_L = $false; $DB_WRITE_B = $false; $DB_PREP = $false; $DB_SYB_PREP = $true; $DB_WRITE_SPL = $false; $DB_SURF = $true; $DB_SPHGEN = $true; $DB_SPHGEN_WR = $true; $DB_AUTO_SPH = $true; $DB_AUTO_SPH_WR = $false; $DB_BOX = $true; $DB_BOX_W = $false; $DB_GRIDS = $true; $DB_GRIDS_W = $false; $DB_RM_KEY = $false; ## Grid Types: both, SP, Dock4 ### $grid_type = "SP"; $grid_type = "Dock4"; ## array of extensions to root pdb file names. ## $extn[0] = "_rec"; $extn[1] = "_lig"; $extn[2] = "_wat"; ## create dirs for root names (in loop), and use array of subdirs - grids, spheres, etc. ## $subdir[0] = "site"; $subdir[1] = "lig"; $subdir[2] = "spheres"; $subdir[3] = "grids"; ## begin the program. ## if (($DB_AUTO_PREP) || ($MONITOR)) {printf("\n Running AutoMolDockPrep on input file: |$ARGV[0]|.\n\n");} open(inF, "$ARGV[0]") || die "cannot open |$ARGV[0]| for reading"; if ($DB_AUTO_PREP_L) {printf(" Opened library header input file: |$ARGV[0]|.\n\n");} if ($DB_AUTO_PREP) {printf(" Reading the lines of the Prep input file.\n");} $ct = 0; while (<inF>) { chop($_); $comment = index($_, "#"); $blank = split(/\s+/,$_); if ($comment != -1) { if ($DB_AUTO_PREP_L) {printf(" Comment: |$_|.\n");} } elsif ($blank eq 0) { if ($DB_AUTO_PREP_L) {printf(" Blank: |$blank|.\n");} } else { $ct++; ($pdb_file, $cent_res) = split(/\s+/,$_); if (($DB_AUTO_PREP) || ($MONITOR)) {printf(" Prepping file: $ct, pdb |$pdb_file|, key residue: |$cent_res|.\n");} # ($dir) = split(/.pdb/,$pdb_file); # system("mkdir $dir"); # $pdb_file = sprintf("%s%s%s", $dir, "/", $init_pdb_file); ParsePDB($pdb_file); PrepMol($pdb_file, $cent_res); if (($DB_AUTO_PREP) || ($MONITOR)) {printf(" Molecule $pdb_file has been prepared for Docking.\n");} } } close (inF); if (($DB_AUTO_PREP) || ($MONITOR)) {printf("\n Finished processing $ct .pdb files.\n\n");}# fin.# mark PrepMol############################################################################### Author: Jim Arnold# Purpose: Prepares the molecule for docking.# Output: Generates mol2 files with hydrogens and charges. Also produces# spheres, a docking sphere set, a grid box, and grids.# Notes: ##############################################################################sub PrepMol($pdb_file, $cent_res){ if ($DB_PREP) {printf("**PrepMol, file: |%s|, res: |%s|.\n", $pdb_file, $cent_res);} ($root_file_name) = split(/.pdb/,$pdb_file); $surf_ex = ".ms"; $sph_ex = ".sph"; if ($DB_PREP) {printf(" -> Preparing mols by adding hydrogens and charges.\n");} PrepMols($root_file_name); if ($DB_PREP) {printf(" -> calling mol surface program.\n");} MakeSurface($root_file_name, $surf_ex); if ($DB_PREP) {printf(" -> calling SPHGEN to generate spheres.\n");} CallSPHGEN($root_file_name, $surf_ex, $sph_ex); if ($DB_PREP) {printf(" -> calling AutoSphere to form docking sphere set.\n");} MakeDockingSpheres($root_file_name, $sph_ex, $cent_res); if ($DB_PREP) {printf(" -> calling showbox to produce a grid box.\n");} CallShowBox($root_file_name, $sph_ex); if ($DB_PREP) {printf(" -> calling Grid to make grids.\n");} MakeGrids($root_file_name, $sph_ex); if ($DB_PREP) {printf(" returning from PrepMol.\n");}}# mark MakeGrids############################################################################### Author: Jim Arnold# Purpose: Calls grid to make grids for a given protein.# Notes: ##############################################################################sub MakeGrids($root_file_name, $sph_ex){ if ($DB_GRIDS) {printf("**MakeGrids, file: $root_file_name.\n");} $grid_file = sprintf("%s%s", $root_file_name, "_grid.in");# $grid_out = sprintf("%s%s", $root_file_name, "_grid_out.txt"); if (($grid_type eq "both") || ($grid_type eq "SP")) { WriteGridInput_SP($grid_file, $root_file_name); $sys = sprintf("%s %s", "/idk1/people/arnold/fulcrum/Energy/calculate_ff", $grid_file); if ($DB_GRIDS) {printf(" making grids with command: |$sys|.\n");} system($sys); } if (($grid_type eq "both") || ($grid_type eq "Dock4")) { WriteGridInput_Dock4($grid_file, $root_file_name); $sys = sprintf("%s %s %s %s", "/idk2/private/dock/bin_IRIX6.5/grid -i", $grid_file); if ($DB_GRIDS) {printf(" making grids with command: |$sys|.\n");} if (system($sys) != 0) {printf("\n--> ERROR: system call |$sys| NOT successful.\n\n");} }# unlink($grid_out); if ($DB_GRIDS) {printf(" returning from MakeGrids.\n");}}# mark WriteGridInput_SP ################################################################################ Author: Jim Arnold# Purpose: Writes a grid.in file for the SitePrint grids, Shingo's grids.# Notes: ##############################################################################sub WriteGridInput_SP($grid_file, $root_file_name){ if ($DB_GRIDS_W) {printf("**WriteGridInput_SP, file: $grid_file, root: $root_file_name.\n");} open(gridF, ">$grid_file") || die "cannot open $grid_file for writing."; if ($DB_GRIDS_W) {printf(" opened grid_in file: $grid_file\n");} $type = "all"; $vdw_def = sprintf("%s", "/idk1/people/arnold/fulcrum/Param/Param.vdw"); $rec_file = sprintf("%s%s%s", $root_file_name, $extn[0], ".mol2"); $grid_pre = sprintf("%s%s", $root_file_name, "_grid"); $box_file = sprintf("%s%s%s", $root_file_name, $extn[0], "_box.pdb"); $spc = "0.3"; $dist_dif = "4.0"; $dist_di = "true"; $cut_d = "10.0"; $bump_e = "50.0"; $scale = "1.0"; printf gridF ("type $type\n"); printf gridF ("vdw $vdw_def\n"); printf gridF ("file_name_receptor $rec_file\n"); printf gridF ("file_prefix_ff $grid_pre\n"); printf gridF ("file_name_box $box_file\n"); printf gridF ("grid_spacing $spc\n"); printf gridF ("dielectric_factor $dist_dif\n"); printf gridF ("dielectric_distance $dist_di\n"); printf gridF ("cutoff_distance $cut_d\n"); printf gridF ("bump_energy_criteria $bump_e\n"); printf gridF ("scale $scale\n"); close(gridF); if ($DB_GRIDS_W) {printf(" returning from WriteGridInput.\n");}}# mark WriteGridInput_Dock4############################################################################### Author: Jim Arnold# Purpose: Writes the input file for the Dock grid program.# Notes: Params can later be set from a preferences file.##############################################################################sub WriteGridInput_Dock4($grid_file, $root_file_name){ if ($DB_GRIDS_W) {printf("**WriteGridInput_Dock4, file: $grid_file, root: $root_file_name.\n");} printf("\n\n!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\n"); printf("!! CAUTION: Grids Being Created With Default Parameters. !!\n"); printf("!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\n\n\n"); open(gridF, ">$grid_file") || die "cannot open $grid_file for writing."; if ($DB_GRIDS_W) {printf(" opened grid_in file: $grid_file\n");} $comp = "yes"; $spc = "0.3"; $out_mol = "no"; $con_sc = "no"; $con_cut = "4.5"; $chem_sc = "no"; $e_sc = "yes"; $e_cut = "10"; $at_mod = "a"; $at_exp = "6"; $rep_exp = "12"; $dist_di = "yes"; $dist_dif = "4"; $bumps = "yes"; $bump_ov = "0.75"; $rec_file = sprintf("%s%s%s", $root_file_name, $extn[0], ".mol2"); $box_file = sprintf("%s%s%s", $root_file_name, $extn[0], "_box.pdb"); $vdw_def = sprintf("%s", "/idk2/private/dock/parameter/vdw_cornell.defn"); $chem_def = sprintf("%s", "/idk2/private/dock/parameter/chem.defn"); $grid_pre = sprintf("%s%s", $root_file_name, "_grid"); printf gridF ("compute_grids $comp \n"); printf gridF ("grid_spacing $spc \n"); printf gridF ("output_molecule $out_mol \n"); printf gridF ("contact_score $con_sc \n"); printf gridF ("contact_cutoff_distance $con_cut \n"); printf gridF ("chemical_score $chem_sc \n"); printf gridF ("energy_score $e_sc \n"); printf gridF ("energy_cutoff_distance $e_cut \n"); printf gridF ("atom_model $at_mod \n"); printf gridF ("attractive_exponent $at_exp \n"); printf gridF ("repulsive_exponent $rep_exp \n"); printf gridF ("distance_dielectric $dist_di \n"); printf gridF ("dielectric_factor $dist_dif \n"); printf gridF ("bump_filter $bumps \n"); printf gridF ("bump_overlap $bump_ov \n"); printf gridF ("receptor_file $rec_file \n"); printf gridF ("box_file $box_file \n"); printf gridF ("vdw_definition_file $vdw_def \n"); printf gridF ("chemical_definition_file $chem_def \n"); printf gridF ("score_grid_prefix $grid_pre \n"); close(gridF); if ($DB_GRIDS_W) {printf(" returning from WriteGridInput.\n");}}# mark CallShowBox############################################################################### Author: Jim Arnold# Purpose: Calls showbox to put a solid rectangle around the docking sphere# set.# Notes: ##############################################################################sub CallShowBox($root_file_name, $sph_ex){ if ($DB_BOX) {printf("**CallShowBox, file: $root_file_name.\n");} $box_file = "box.in"; unlink($box_file); WriteShowBoxInput($box_file, $root_file_name, $sph_ex); $sys = sprintf("%s %s", "showbox < ", $box_file); if (system($sys) != 0) { printf("\n--> ERROR: system call |$sys| NOT successful.\n\n"); } unlink($box_file); if ($DB_BOX) {printf(" returning from CallShowBox.\n");}}# mark WriteShowBoxInput############################################################################### Author: Jim Arnold# Purpose: Writes a showbox input file that will be redirected through# std input to simulate command line user input to showbox.# Notes: Params can later be set from a preferences file.##############################################################################sub WriteShowBoxInput($box_file, $root_file_name, $sph_ex){ if ($DB_BOX_W) {printf("**WriteShowBoxInput, file: $root_file_name.\n");} open(boxF, ">$box_file") || die "cannot open $box_file for writing."; if ($DB_BOX_W) {printf(" opened box_in file: $box_file\n");} $auto_box = "Y"; $cushon = "6.0"; $sph_file = sprintf("%s%s%s%s", $root_file_name, $extn[0], "_as.sph"); $clus_num = "0"; $out_file = sprintf("%s%s%s", $root_file_name, $extn[0], "_box.pdb"); printf boxF ("$auto_box \n"); printf boxF ("$cushon \n"); printf boxF ("$sph_file \n"); printf boxF ("$clus_num \n"); printf boxF ("$out_file \n"); close(boxF); if ($DB_BOX_W) {printf(" returning from WriteShowBoxInput.\n");}}# mark MakeDockingSpheres############################################################################### Author: Jim Arnold# Purpose: Calls AutoSphere to make a set of spheres you can dock into.# Notes: ##############################################################################sub MakeDockingSpheres($root_file_name, $sph_ex, $cent_res){ if ($DB_AUTO_SPH) {printf("**MakeDockingSpheres, file: $root_file_name, res: $cent_res.\n");} $a_sph_in = sprintf("%s%s", $root_file_name, "_auto_sph.in"); WriteAutoSphereInput($root_file_name, $sph_ex, $a_sph_in, $cent_res); $sys = sprintf("%s %s", "/idk2/private/dock/bin_IRIX6.5/AutoSphere", $a_sph_in); if (system($sys) != 0) { printf("\n--> ERROR: system call |$sys| NOT successful.\n\n"); } if ($DB_AUTO_SPH) {printf(" returning from MakeDockingSpheres.\n");}}# mark WriteAutoSphereInput############################################################################### Author: Jim Arnold# Purpose: Writes an AutoSphere input file.# Notes: Params can later be set from a preferences file.##############################################################################sub WriteAutoSphereInput($root_file_name, $sph_ex, $a_sph_in, $cent_res){
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -