Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Flipkin: Add binary command detection for reduce, probe, and prekin. #8

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
67 changes: 55 additions & 12 deletions bin/flipkin
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,9 @@
# 7/31/2007 - J Headd and R Immormino - - fixed hydrogens on hets
# 11/29/2007 - RMI - updated for two character chains
# 01/11/2014 - JJH - changed to phenix.reduce and phenix.probe
# 01/08/2017 - Jared Sampson - added binary detection for reduce, probe and prekin
use strict;
use File::Which;

my $probe_chain_length = 1;
my $isHis = 0;
Expand Down Expand Up @@ -91,6 +93,47 @@
die "command line parameter error, stopped";
}


# -----------------------------------------------------------

# detect Reduce, Probe, and Prekin executables
my $reduce_cmd;
my $probe_cmd;
my $prekin_cmd;

# Reduce
if (which("reduce")) {
$reduce_cmd = "reduce";
}
elsif (which("phenix.reduce")) {
$reduce_cmd = "phenix.reduce";
}
else {
die "No reduce executable was found in the PATH. Please install reduce.";
}

# Probe
if (which("probe")) {
$probe_cmd = "probe";
}
elsif (which("phenix.probe")) {
$probe_cmd = "phenix.probe";
}
else {
die "No probe executable was found in the PATH. Please install probe.";
}

# Prekin
if (which("prekin")) {
$prekin_cmd = "prekin";
}
elsif (which("phenix.prekin")) {
$prekin_cmd = "phenix.prekin";
}
else {
die "No prekin executable was found in the PATH. Please install prekin.";
}

# -----------------------------------------------------------

# temp file names
Expand Down Expand Up @@ -268,12 +311,12 @@

my $runReduce;
if ($nuclear) {
$runReduce = "phenix.reduce -quiet -trim $redpdb | " .
"phenix.reduce $verb $limitFlag $dbFile -build -nuclear -fix $fixFile - > $flipdb";
$runReduce = "$reduce_cmd -quiet -trim $redpdb | " .
"$reduce_cmd $verb $limitFlag $dbFile -build -nuclear -fix $fixFile - > $flipdb";
}
else {
$runReduce = "phenix.reduce -quiet -trim $redpdb | " .
"phenix.reduce $verb $limitFlag $dbFile -build -fix $fixFile - > $flipdb";
$runReduce = "$reduce_cmd -quiet -trim $redpdb | " .
"$reduce_cmd $verb $limitFlag $dbFile -build -fix $fixFile - > $flipdb";
}
my $rc = system($runReduce);

Expand Down Expand Up @@ -452,10 +495,10 @@

unlink($kintmp);
if ($segid) {
$pkin = "prekin -append -segid -in $redpdb -out $kintmp -scope -bval";
$pkin = "$prekin_cmd -append -segid -in $redpdb -out $kintmp -scope -bval";
}
else {
$pkin = "prekin -append -in $redpdb -out $kintmp -scope -bval";
$pkin = "$prekin_cmd -append -in $redpdb -out $kintmp -scope -bval";
}
system("$pkin -show \"mc(white),hy(gray)\"");
system("$pkin -show \"sc(cyan),hy(gray)\" " .
Expand All @@ -477,10 +520,10 @@
unlink($kintmp);

if ($segid) {
$pkin = "prekin -append -segid -in $redpdb -out $kintmp -scope -bval";
$pkin = "$prekin_cmd -append -segid -in $redpdb -out $kintmp -scope -bval";
}
else {
$pkin = "prekin -append -in $redpdb -out $kintmp -scope -bval";
$pkin = "$prekin_cmd -append -in $redpdb -out $kintmp -scope -bval";
}
if ($nuclear) {
$probeParams = "-dens12 -lens -nogroup -3 -q -wat -het -both -nuclear";
Expand All @@ -494,7 +537,7 @@
system("echo \"\@group \{movable\}\" >> $kintmp");
system("$pkin -show \"sc(cyan),hy(gray)\" -sc \"cys,ser,thr,${nselSC},lys,met,tyr\"");
system("echo \"\@group \{contacts\}\" >> $kintmp");
system("phenix.probe $probeParams " .
system("$probe_cmd $probeParams " .
"\"${prbSC} sc alta ogt1 not (beta,atom1HG_,atom2HG_,atom3HG_)\" " .
"\"not water alta ogt1 | water alta blt40 ogt66\" $redpdb >> $kintmp");

Expand All @@ -514,10 +557,10 @@
unlink($kintmp);

if ($segid) {
$pkin = "prekin -append -segid -in $flipdb -out $kintmp -scope -bval -code \"$fileID\"";
$pkin = "$prekin_cmd -append -segid -in $flipdb -out $kintmp -scope -bval -code \"$fileID\"";
}
else {
$pkin = "prekin -append -in $flipdb -out $kintmp -scope -bval -code \"$fileID\"";
$pkin = "$prekin_cmd -append -in $flipdb -out $kintmp -scope -bval -code \"$fileID\"";
}
if ($nuclear) {
$probeParams = "-dens12 -lens -nogroup -3 -q -wat -het -both -nuclear";
Expand All @@ -531,7 +574,7 @@
system("echo \"\@group \{movable\}\" >> $kintmp");
system("$pkin -show \"sc(cyan),hy(gray)\" -sc \"cys,ser,thr,${nselSC},lys,met,tyr\"");
system("echo \"\@group \{contacts\}\" >> $kintmp");
system("phenix.probe $probeParams " .
system("$probe_cmd $probeParams " .
"\"${prbSC} sc alta ogt1 not (beta,atom1HG_,atom2HG_,atom3HG_)\" " .
"\"not water alta ogt1 | water alta blt40 ogt66\" $flipdb >> $kintmp");

Expand Down