annotate tools/rdock/bin/run_rbdock.pl @ 2:0faa03a92843 draft default tip

Uploaded
author dzesikah
date Fri, 26 Aug 2016 10:19:49 -0400
parents
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
2
0faa03a92843 Uploaded
dzesikah
parents:
diff changeset
1 #!/usr/bin/perl
0faa03a92843 Uploaded
dzesikah
parents:
diff changeset
2 use lib "$ENV{'RBT_ROOT'}/lib";
0faa03a92843 Uploaded
dzesikah
parents:
diff changeset
3 require "run_rbfuncs.pl";
0faa03a92843 Uploaded
dzesikah
parents:
diff changeset
4
0faa03a92843 Uploaded
dzesikah
parents:
diff changeset
5 my $rbtroot = $ENV{'RBT_ROOT'};
0faa03a92843 Uploaded
dzesikah
parents:
diff changeset
6 my $rbthome = $ENV{'RBT_HOME'};
0faa03a92843 Uploaded
dzesikah
parents:
diff changeset
7 my $recepDir = "$rbtroot/data/receptors";
0faa03a92843 Uploaded
dzesikah
parents:
diff changeset
8 my $scriptDir = "$rbtroot/data/scripts";
0faa03a92843 Uploaded
dzesikah
parents:
diff changeset
9 my $libraryDir = "$rbtroot/data/libraries";
0faa03a92843 Uploaded
dzesikah
parents:
diff changeset
10 my $binDir = "$rbtroot/bin";
0faa03a92843 Uploaded
dzesikah
parents:
diff changeset
11
0faa03a92843 Uploaded
dzesikah
parents:
diff changeset
12 #override default directories
0faa03a92843 Uploaded
dzesikah
parents:
diff changeset
13 #Parse command line arguments
0faa03a92843 Uploaded
dzesikah
parents:
diff changeset
14 my $nArgs = scalar(@ARGV);
0faa03a92843 Uploaded
dzesikah
parents:
diff changeset
15
0faa03a92843 Uploaded
dzesikah
parents:
diff changeset
16 while (scalar(@ARGV)) {
0faa03a92843 Uploaded
dzesikah
parents:
diff changeset
17 my $arg = shift @ARGV;
0faa03a92843 Uploaded
dzesikah
parents:
diff changeset
18 if (index($arg,'-r')==0) {
0faa03a92843 Uploaded
dzesikah
parents:
diff changeset
19 $recepDir = substr($arg,2);
0faa03a92843 Uploaded
dzesikah
parents:
diff changeset
20 }
0faa03a92843 Uploaded
dzesikah
parents:
diff changeset
21 elsif (index($arg,'-s')==0) {
0faa03a92843 Uploaded
dzesikah
parents:
diff changeset
22 $scriptDir = substr($arg,2);
0faa03a92843 Uploaded
dzesikah
parents:
diff changeset
23 }
0faa03a92843 Uploaded
dzesikah
parents:
diff changeset
24 elsif (index($arg,'-l')==0) {
0faa03a92843 Uploaded
dzesikah
parents:
diff changeset
25 $libraryDir = substr($arg,2);
0faa03a92843 Uploaded
dzesikah
parents:
diff changeset
26 }
0faa03a92843 Uploaded
dzesikah
parents:
diff changeset
27 }
0faa03a92843 Uploaded
dzesikah
parents:
diff changeset
28
0faa03a92843 Uploaded
dzesikah
parents:
diff changeset
29
0faa03a92843 Uploaded
dzesikah
parents:
diff changeset
30 # Get the receptor, library and script tables
0faa03a92843 Uploaded
dzesikah
parents:
diff changeset
31 my %receptor_table = get_prm_table($recepDir);
0faa03a92843 Uploaded
dzesikah
parents:
diff changeset
32 my %script_table = get_prm_table($scriptDir);
0faa03a92843 Uploaded
dzesikah
parents:
diff changeset
33 my %library_table = get_prm_table($libraryDir);
0faa03a92843 Uploaded
dzesikah
parents:
diff changeset
34
0faa03a92843 Uploaded
dzesikah
parents:
diff changeset
35 #GET ALL THE INPUTS
0faa03a92843 Uploaded
dzesikah
parents:
diff changeset
36 my $defFiles = "*.{sd,sdf,mol,mdl}";
0faa03a92843 Uploaded
dzesikah
parents:
diff changeset
37 print join("\n",glob $defFiles);
0faa03a92843 Uploaded
dzesikah
parents:
diff changeset
38 my $libFiles = get_input("\n\nEnter expression for SD files to dock",$defFiles);
0faa03a92843 Uploaded
dzesikah
parents:
diff changeset
39 my $receptor = get_selection(\%receptor_table,"receptor");
0faa03a92843 Uploaded
dzesikah
parents:
diff changeset
40 my $script = get_selection(\%script_table,"docking script");
0faa03a92843 Uploaded
dzesikah
parents:
diff changeset
41 my $flags = get_input("Enter optional rbdock flags","-ap -an");
0faa03a92843 Uploaded
dzesikah
parents:
diff changeset
42 my $runs = get_input("Enter number of runs/ligand",20);
0faa03a92843 Uploaded
dzesikah
parents:
diff changeset
43
0faa03a92843 Uploaded
dzesikah
parents:
diff changeset
44 my $runRoot = get_input("Enter run name","rbdock");
0faa03a92843 Uploaded
dzesikah
parents:
diff changeset
45 my $queueSys = get_input("Enter queuing system (NQS,CODINE,CONDOR,NONE)","CONDOR");
0faa03a92843 Uploaded
dzesikah
parents:
diff changeset
46 my $queueName;
0faa03a92843 Uploaded
dzesikah
parents:
diff changeset
47 $queueName = get_input("Enter NQS queue","QRBD") if ($queueSys eq "NQS");
0faa03a92843 Uploaded
dzesikah
parents:
diff changeset
48
0faa03a92843 Uploaded
dzesikah
parents:
diff changeset
49 $pwd = `pwd`;
0faa03a92843 Uploaded
dzesikah
parents:
diff changeset
50 chomp $pwd;
0faa03a92843 Uploaded
dzesikah
parents:
diff changeset
51
0faa03a92843 Uploaded
dzesikah
parents:
diff changeset
52 #WRITE THE NQS SCRIPTS
0faa03a92843 Uploaded
dzesikah
parents:
diff changeset
53
0faa03a92843 Uploaded
dzesikah
parents:
diff changeset
54 #GET THE LIST OF SD FILES TO DOCK
0faa03a92843 Uploaded
dzesikah
parents:
diff changeset
55 my @libList = glob "${libFiles}";
0faa03a92843 Uploaded
dzesikah
parents:
diff changeset
56
0faa03a92843 Uploaded
dzesikah
parents:
diff changeset
57 my $subFile = "submit_$runRoot.csh";
0faa03a92843 Uploaded
dzesikah
parents:
diff changeset
58 open SUBHANDLE,">$subFile";
0faa03a92843 Uploaded
dzesikah
parents:
diff changeset
59 print SUBHANDLE "#!/bin/csh -ef\n";
0faa03a92843 Uploaded
dzesikah
parents:
diff changeset
60
0faa03a92843 Uploaded
dzesikah
parents:
diff changeset
61 my $iFile=0;
0faa03a92843 Uploaded
dzesikah
parents:
diff changeset
62 foreach $libFile (@libList) {
0faa03a92843 Uploaded
dzesikah
parents:
diff changeset
63 $iFile++;
0faa03a92843 Uploaded
dzesikah
parents:
diff changeset
64 #Write the NQS script file
0faa03a92843 Uploaded
dzesikah
parents:
diff changeset
65 $runName = "${runRoot}_$iFile";
0faa03a92843 Uploaded
dzesikah
parents:
diff changeset
66 $nqsFile = "run_${runName}.csh";
0faa03a92843 Uploaded
dzesikah
parents:
diff changeset
67 my $logFile = "${runName}.log";
0faa03a92843 Uploaded
dzesikah
parents:
diff changeset
68
0faa03a92843 Uploaded
dzesikah
parents:
diff changeset
69 print "Writing $nqsFile...\n";
0faa03a92843 Uploaded
dzesikah
parents:
diff changeset
70
0faa03a92843 Uploaded
dzesikah
parents:
diff changeset
71 open NQSHANDLE,">$nqsFile";
0faa03a92843 Uploaded
dzesikah
parents:
diff changeset
72 print NQSHANDLE "#!/bin/csh -ef\n";
0faa03a92843 Uploaded
dzesikah
parents:
diff changeset
73 print NQSHANDLE "setenv RBT_ROOT $rbtroot\n";
0faa03a92843 Uploaded
dzesikah
parents:
diff changeset
74 print NQSHANDLE "setenv RBT_HOME $rbthome\n";
0faa03a92843 Uploaded
dzesikah
parents:
diff changeset
75 print NQSHANDLE "source \$RBT_ROOT/bin/setlibrbt.com\n";
0faa03a92843 Uploaded
dzesikah
parents:
diff changeset
76 print NQSHANDLE "cd $pwd\n";
0faa03a92843 Uploaded
dzesikah
parents:
diff changeset
77 print NQSHANDLE "if (-e $logFile) rm -f $logFile\n";
0faa03a92843 Uploaded
dzesikah
parents:
diff changeset
78 print NQSHANDLE "\$RBT_ROOT/bin/rbdock -i$libFile -o${runName} -r$receptor -p$script -n$runs $flags > $logFile\n";
0faa03a92843 Uploaded
dzesikah
parents:
diff changeset
79 close NQSHANDLE;
0faa03a92843 Uploaded
dzesikah
parents:
diff changeset
80
0faa03a92843 Uploaded
dzesikah
parents:
diff changeset
81 chmod 0755,$nqsFile;
0faa03a92843 Uploaded
dzesikah
parents:
diff changeset
82 print SUBHANDLE "qsub -q $queueName $nqsFile\n" if ($queueSys eq "NQS");
0faa03a92843 Uploaded
dzesikah
parents:
diff changeset
83 print SUBHANDLE "qsub -e $pwd/$runRoot/tmp/ -o $pwd/$runRoot/tmp/ $nqsFile\n" if ($queueSys eq "CODINE");
0faa03a92843 Uploaded
dzesikah
parents:
diff changeset
84 if ($queueSys eq "CONDOR") {
0faa03a92843 Uploaded
dzesikah
parents:
diff changeset
85 my $condorFile = "run_${runName}.cmd";
0faa03a92843 Uploaded
dzesikah
parents:
diff changeset
86 open CMDHANDLE,">$condorFile";
0faa03a92843 Uploaded
dzesikah
parents:
diff changeset
87 print CMDHANDLE "#CONDOR FILE WRITTEN BY run_rbscreen.pl\n";
0faa03a92843 Uploaded
dzesikah
parents:
diff changeset
88 print CMDHANDLE "universe = vanilla\n";
0faa03a92843 Uploaded
dzesikah
parents:
diff changeset
89 print CMDHANDLE "executable = ${nqsFile}\n";
0faa03a92843 Uploaded
dzesikah
parents:
diff changeset
90 print CMDHANDLE "Requirements = CATALYST_NODE =!= True\n";
0faa03a92843 Uploaded
dzesikah
parents:
diff changeset
91 print CMDHANDLE "output = ${nqsFile}.out\n";
0faa03a92843 Uploaded
dzesikah
parents:
diff changeset
92 print CMDHANDLE "error = ${nqsFile}.err\n";
0faa03a92843 Uploaded
dzesikah
parents:
diff changeset
93 print CMDHANDLE "log = ${nqsFile}.log\n";
0faa03a92843 Uploaded
dzesikah
parents:
diff changeset
94 print CMDHANDLE "queue\n";
0faa03a92843 Uploaded
dzesikah
parents:
diff changeset
95 close NQSHANDLE;
0faa03a92843 Uploaded
dzesikah
parents:
diff changeset
96 print SUBHANDLE "condor_submit $condorFile\n";
0faa03a92843 Uploaded
dzesikah
parents:
diff changeset
97 }
0faa03a92843 Uploaded
dzesikah
parents:
diff changeset
98 }
0faa03a92843 Uploaded
dzesikah
parents:
diff changeset
99 close SUBHANDLE;
0faa03a92843 Uploaded
dzesikah
parents:
diff changeset
100 chmod 0755,$subFile;
0faa03a92843 Uploaded
dzesikah
parents:
diff changeset
101
0faa03a92843 Uploaded
dzesikah
parents:
diff changeset
102
0faa03a92843 Uploaded
dzesikah
parents:
diff changeset
103
0faa03a92843 Uploaded
dzesikah
parents:
diff changeset
104
0faa03a92843 Uploaded
dzesikah
parents:
diff changeset
105
0faa03a92843 Uploaded
dzesikah
parents:
diff changeset
106
0faa03a92843 Uploaded
dzesikah
parents:
diff changeset
107
0faa03a92843 Uploaded
dzesikah
parents:
diff changeset
108
0faa03a92843 Uploaded
dzesikah
parents:
diff changeset
109
0faa03a92843 Uploaded
dzesikah
parents:
diff changeset
110
0faa03a92843 Uploaded
dzesikah
parents:
diff changeset
111
0faa03a92843 Uploaded
dzesikah
parents:
diff changeset
112
0faa03a92843 Uploaded
dzesikah
parents:
diff changeset
113
0faa03a92843 Uploaded
dzesikah
parents:
diff changeset
114
0faa03a92843 Uploaded
dzesikah
parents:
diff changeset
115
0faa03a92843 Uploaded
dzesikah
parents:
diff changeset
116