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