Esempio n. 1
0
/**
* $outfile will be overwritten.
* $cnit is an array of CNIT codes for the residues that were processed.
*/
function makeSswingKin($pdb1, $pdb2, $outfile, $cnit)
{
    if (file_exists($outfile)) {
        unlink($outfile);
    }
    $stats = describePdbStats(pdbstat($pdb1), false);
    $h = fopen($outfile, 'a');
    fwrite($h, "@text\n");
    fwrite($h, "Sidechains have been refit by SSWING. Details of the input file:\n\n");
    foreach ($stats as $stat) {
        fwrite($h, "[+]   {$stat}\n");
    }
    fwrite($h, "@kinemage 1\n");
    // Calculate views for each residue in CNIT
    $ctr = computeResCenters($pdb1);
    foreach ($cnit as $res) {
        $i++;
        $c = $ctr[$res];
        fwrite($h, "@{$i}viewid {{$res}}\n@{$i}span 12\n@{$i}zslab 100\n@{$i}center {$c['x']} {$c['y']} {$c['z']}\n");
    }
    fclose($h);
    exec("prekin -quiet -append -animate -onegroup -show 'mc,sc(peach),ca,hy,ht,wa' {$pdb1} >> {$outfile}");
    exec("phenix.probe -quiet -noticks -nogroup -self 'alta' {$pdb1} >> {$outfile}");
    //exec("probe -quiet -noticks -nogroup -self 'alta' $pdb1 >> $outfile");
    exec("prekin -quiet -append -animate -onegroup -show 'mc,sc(sky),ca,hy,ht,wa' {$pdb2} >> {$outfile}");
    exec("phenix.probe -quiet -noticks -nogroup -self 'alta' {$pdb2} >> {$outfile}");
    //exec("probe -quiet -noticks -nogroup -self 'alta' $pdb2 >> $outfile");
}
Esempio n. 2
0
 function onEditPDB()
 {
     $req = $_REQUEST;
     //if($req['cmd'] == 'Cancel')
     if ($req['cmd'] == 'Go back') {
         pageGoto("editpdb_setup1.php");
         return;
     }
     // Otherwise, moving forward:
     $oldID = $req['modelID'];
     $oldModel = $_SESSION['models'][$oldID];
     $inpath = $_SESSION['dataDir'] . '/' . MP_DIR_MODELS . '/' . $oldModel['pdb'];
     $newModel = createModel($oldID . "_edit");
     $newID = $newModel['id'];
     $outpath = $_SESSION['dataDir'] . '/' . MP_DIR_MODELS . '/' . $newModel['pdb'];
     $s = "";
     if (is_array($req['removechain']) && count($req['removechain']) > 0) {
         removeChains($inpath, $outpath, $req['removechain']);
         $s .= "<p>You created {$newModel['pdb']} by removing chain(s) " . implode(', ', $req['removechain']) . " from {$oldModel['pdb']}.\n";
         mpLog("editpdb:Removed chains from a PDB file");
     } else {
         copy($inpath, $outpath);
     }
     $resolu = $req['resolution'] + 0;
     $oldRes = $oldModel['stats']['resolution'] + 0;
     if ($resolu && ($oldRes == 0 || $oldRes != $resolu)) {
         $remark2 = sprintf("REMARK   2                                                                      \nREMARK   2 RESOLUTION. %.2f ANGSTROMS.                                          \n", $resolu);
         replacePdbRemark($outpath, $remark2, 2);
         $s .= "<p>You manually set the resolution for {$newModel['pdb']}.\n";
         mpLog("editpdb:Changed/set resolution for a PDB file");
     }
     if ($req['removeHs']) {
         $newModel = createModel($oldID . "_trimmed");
         $newID = $newModel['id'];
         $outpath = $_SESSION['dataDir'] . '/' . MP_DIR_MODELS . '/' . $newModel['pdb'];
         reduceTrim($inpath, $outpath);
         $s .= "<p>You created {$newModel['pdb']} by removing hydrogens from {$oldModel['pdb']}.\n";
         mpLog("editpdb:Removed hydrogens from a PDB file");
     }
     $newModel['stats'] = pdbstat($outpath);
     $newModel['history'] = "Edited {$oldModel['pdb']}";
     $newModel['isUserSupplied'] = $oldModel['isUserSupplied'];
     $_SESSION['models'][$newID] = $newModel;
     $_SESSION['lastUsedModelID'] = $newID;
     // this is now the current model
     $details = describePdbStats($newModel['stats'], true);
     $s .= "<ul>\n";
     foreach ($details as $detail) {
         $s .= "<li>{$detail}</li>\n";
     }
     $s .= "</ul>\n";
     $entrynum = addLabbookEntry("Created PDB file {$newModel['pdb']}", $s, "{$oldID}|{$newID}", "auto", "scissors.png");
     pageGoto("generic_done.php", array('labbookEntry' => $entrynum));
 }
Esempio n. 3
0
    /**
    * $context['modelID'] - the ID of the model the user will work with
    */
    function display($context)
    {
        echo $this->pageHeader("Visualize interface contacts");
        $modelID = $context['modelID'];
        $model = $_SESSION['models'][$modelID];
        // These lines create an HTML form that will call onRunProbe() to be called
        // when the user clicks the submit button. onRunProbe() is declared below.
        echo makeEventForm("onRunProbe");
        echo "<input type='hidden' name='modelID' value='{$modelID}'>\n";
        echo "<h3>Choose Probe options:</h3>";
        ?>
<table border='0' width='100%' cellspacing='0' cellpadding='4'><tr align='left' valign='top'>
<td>
<p>Type(s) of output: <select name="output_type">
        <option value='both'>kinemage and list of contacts</option>
        <option value='kin'>kinemage only</option>
        <option value='list'>list of contacts only</option>
    </select>
<p>Mode of action: <select name="probe_mode">
    <option value="both" selected>both (src &lt;=&gt; targ)</option>
    <option value="once">once (src -&gt; targ)</option>
    <option value="self">self (src -&gt; src)</option>
    <option value="out">out (src -&gt; solvent)</option>
</select>
<p>Remove dots up to <select name="remove_dist">
    <option value="4" selected>4</option>
    <option value="3">3</option>
    <option value="2">2</option>
    <option value="1">1</option>
</select> bonds away
<p>Color dots <select name="color_by">
    <option value="gap" selected>by gap/overlap distance (cool to warm)</option>
    <option value="atom">by element (CPK colors)</option>
    <option value="base">by nucleic acid base type</option>
    <option value="gray">solid gray (for -out only)</option>
    <option value="">[suggest other solid colors for -out using Feedback]</option>
</select>
<p><input  type="checkbox" name="show_clashes" value="1" checked> Dots for clashes
<br><input type="checkbox" name="show_hbonds" value="1" checked> Dots for H-bonds
<br><input type="checkbox" name="show_vdw" value="1" checked> Dots for van der Waals contacts
<br><input type="checkbox" name="show_mc" value="1" checked> Mainchain-mainchain dots
<br><input type="checkbox" name="show_hets" value="1" checked> Dots to hets
<br><input type="checkbox" name="show_wat" value="1" checked> Dots to waters
<br><input type="checkbox" name="wat2wat" value="1"> Dots between waters
<br><input type="checkbox" name="alta" value="1" checked> 'A' conformation only
<br><input type="checkbox" name="blt40" value="1"> Atoms with B&lt;40 only
<br><input type="checkbox" name="ogt33" value="1"> Atoms with &gt;33% occupancy only
<br><input type='checkbox' name='drop_flag' value='1'> Non-selected atoms don't exist (-drop)
<br><input type="checkbox" name="elem_masters" value="1"> Masters for each element (C,H,O,...)
<p>Output file: <?php 
        echo $model['prefix'];
        ?>
<input type="text" name="kin_suffix" value="interface" size=10 maxlength=20>.kin
    <br><small>(Will be overwritten, alphanumeric only, no spaces or symbols, &lt;20 chars)</small>
</td>
<td width='20'><!-- ##################################################################### --></td>
<td>
Just as a reminder:
<ul>
<?php 
        $details = describePdbStats($model['stats'], true);
        foreach ($details as $detail) {
            echo "<li>{$detail}</li>\n";
        }
        ?>
</ul>
<p><table border=1 width=100% cellspacing=0 cellpadding=4>
<tr align=center>
    <td></td>
    <td><b>"Src" pattern</b></td>
    <td><b>"Targ" pattern</b></td>
</tr>
<tr align=center>
    <td><b>Protein</b></small></td>
    <td><input type=checkbox name="src_prot"  value="protein" checked></td>
    <td><input type=checkbox name="targ_prot" value="protein" checked></td>
</tr>
<tr align=center>
    <td><b>DNA, RNA</b></small></td>
    <td><input type=checkbox name="src_nucacid"  value="dna,rna" checked></td>
    <td><input type=checkbox name="targ_nucacid" value="dna,rna" checked></td>
</tr>
<tr align=center>
    <td><b>Hets</b></td>
    <td><input type=checkbox name="src_hets"  value="het" checked></td>
    <td><input type=checkbox name="targ_hets" value="het" checked></td>
</tr>
<tr align=center>
    <td><b>Waters</b></td>
    <td><input type=checkbox name="src_waters"  value="water" checked></td>
    <td><input type=checkbox name="targ_waters" value="water" checked></td>
</tr>
<tr align=center>
    <td colspan=3 bgcolor=#999999>
        <b>- AND -</b>
        <br><small>(i.e., the logical intersection of the top half and the bottom half)</small>
    </td>
</tr>
<?php 
        foreach ($model['stats']['chainids'] as $cid) {
            echo "<tr align='center'>\n";
            echo "<td><b>Chain &quot;{$cid}&quot;</b></td>\n";
            echo "<td><input type='checkbox' name='src_chains[{$cid}]' value='{$cid}'  checked></td>\n";
            echo "<td><input type='checkbox' name='targ_chains[{$cid}]' value='{$cid}'  checked></td>\n";
            echo "</tr>\n";
        }
        ?>
</table>
</td>
</tr></table>


<p>Note that some steps are processor-intensive and may require several minutes to complete. Please be patient.
<?php 
        echo "<p><table width='100%' border='0'><tr>\n";
        echo "<td><input type='submit' name='cmd' value='Run Probe &gt;'></td>\n";
        echo "<td align='right'><input type='submit' name='cmd' value='Go back'></td>\n";
        echo "</tr></table></p></form>\n";
        // Note the explicit </form> to end the form!
        ?>
<hr>
<div class='help_info'>
<h4>Visualizing interface contacts</h4>
<i>TODO: Help text about interfaces and Probe goes here</i>
</div>
<?php 
        echo $this->pageFooter();
    }
Esempio n. 4
0
/**
* $infiles is an array of one or more PDB files to process
* $outfile will be overwritten.
* $opt controls what will be output. Each key below maps to a boolean:
*   Bscale              color scale by B-factor
*   Qscale              color scale by occupancy
*   altconf             alternate conformations
*   ribbons             ribbons rainbow colored N to C
*   rama                Ramachandran outliers
*   rota                rotamer outliers
*   geom                Bond length and angle geometry
*   cbdev               C-beta deviations greater than 0.25A
*   pperp               phosphate-base perpendicular outliers
*   clashdots           small and bad overlap dots
*   hbdots              H-bond dots
*   vdwdots             van der Waals (contact) dots
* $viewRes is a list of 9-char "CNIT" names of residues for which there should views
*   (e.g. outliers that someone should inspect, etc.)
* $nmrConstraints is optional, and if present will generate lines for violated NOEs
* $clashLimit is an option for probe, to set the clash cutoff to something different than -0.4
*/
function makeMulticritKin2($infiles, $outfile, $opt, $viewRes = array(), $nmrConstraints = null, $clashLimit = null)
{
    if (file_exists($outfile)) {
        if (!unlink($outfile)) {
            echo "delete .kin file failed!\n";
        }
    }
    $pdbstats = pdbstat(reset($infiles));
    $stats = describePdbStats($pdbstats, false);
    $h = fopen($outfile, 'a');
    fwrite($h, "@text\n");
    foreach ($stats as $stat) {
        fwrite($h, "[+]   {$stat}\n");
    }
    $isMultiModel = count($infiles) > 1;
    if ($isMultiModel) {
        fwrite($h, "Statistics for first model only; " . count($infiles) . " total models included in kinemage.\n");
    }
    // For Dave and Jane: version numbers!
    // This *is* useful for looking at old multikins...
    fwrite($h, "\n\n\n");
    fwrite($h, exec("prekin -version") . "\n");
    $reduce_help = explode("\n", shell_exec("phenix.reduce -help 2>&1"));
    //$reduce_help = explode("\n", shell_exec("reduce -help 2>&1"));
    fwrite($h, "{$reduce_help['0']}\n");
    //fwrite($h, "Probe: ".exec("probe -version")."\n"); -- Probe puts its version in the @caption
    fwrite($h, "@kinemage 1\n");
    fwrite($h, "@onewidth\n");
    fclose($h);
    $view_info = makeResidueViews(reset($infiles), $outfile, $viewRes);
    #echo "made residue views OK\n";
    foreach ($infiles as $infile) {
        // Animate is used even for single models, so they can be appended later.
        //echo("prekin -quiet -lots -append -animate -onegroup $infile >> $outfile\n");
        if (!$_SESSION['useSEGID']) {
            exec("prekin -quiet -lots -append -animate -onegroup {$infile} >> {$outfile}");
        } else {
            exec("prekin -quiet -segid -lots -append -animate -onegroup {$infile} >> {$outfile}");
        }
        #echo "before ribbon options\n";
        if ($opt['ribbons']) {
            makeRainbowRibbons($infile, $outfile);
            //rainbow ribbons are now default, since change in refinement practices has made b-factor ribbons less useful
            //consider adding ribbon type selection to user options
            //if($isMultiModel)   makeRainbowRibbons($infile, $outfile);
            //else                makeBfactorRibbons($infile, $outfile);
        }
        #echo "after ribbon options\n";
        if ($nmrConstraints) {
            exec("noe-display -cv -s viol -ds+ -fs -k {$infile} {$nmrConstraints} < /dev/null >> {$outfile}");
        }
        if ($opt['clashdots'] || $opt['hbdots'] || $opt['vdwdots']) {
            #echo "making Probe Dots...\n";
            if ($clashLimit == null) {
                makeProbeDots($infile, $outfile, $opt['hbdots'], $opt['vdwdots'], $opt['clashdots']);
            } else {
                makeProbeDots($infile, $outfile, $opt['hbdots'], $opt['vdwdots'], $opt['clashdots'], $clashLimit);
            }
            #echo "Probe dots OK\n";
        }
        if ($opt['omega']) {
            #"making Cis Peptides...\n";
            makeBadOmegaKin($infile, $outfile);
            #"Cis Peptides OK\n";
        }
        if ($opt['rama']) {
            #echo "making Rama...\n";
            makeBadRamachandranKin($infile, $outfile);
            #echo "Rama OK\n";
        }
        if ($opt['rota']) {
            #"making Bad Rota...\n";
            makeBadRotamerKin($infile, $outfile);
            #"Bad Rota OK\n";
        }
        if ($opt['geom']) {
            #"making Geom...\n";
            makeBadGeomKin($infile, $outfile);
            #"Geom OK\n";
        }
        if ($opt['cbdev']) {
            #"making Cbeta...\n";
            makeBadCbetaBalls($infile, $outfile);
            #"Cbeta OK\n";
        }
        if ($opt['cablam']) {
            #"making CaBLAM...\n";
            makeBadCablamKin($infile, $outfile);
            #"CaBLAM OK\n";
        }
        if ($opt['pperp']) {
            #"Making BadPPerp...\n";
            makeBadPPerpKin($infile, $outfile);
            #"BadPPerp OK\n";
        }
        if ($opt['Bscale']) {
            #"making Bfactor...\n";
            makeBfactorScale($infile, $outfile);
            #"Bfactor OK\n";
        }
        if ($opt['Qscale']) {
            #"making Occupancy...\n";
            makeOccupancyScale($infile, $outfile);
            #"Occupancy OK\n";
        }
        if ($opt['altconf']) {
            #"making Alts...\n";
            makeAltConfKin($infile, $outfile);
            #"Alts OK\n";
        }
        if ($view_info) {
            #"making ViewMarkers...\n";
            makeResidueViewMarkers($outfile, $view_info);
            #"ViewMarkers OK\n";
        }
        #echo "make it through all options OK\n";
    }
    // KiNG allows us to do this to control what things are visible
    $h = fopen($outfile, 'a');
    fwrite($h, "@master {mainchain} off\n");
    fwrite($h, "@master {sidechain} off\n");
    if ($pdbstats['hydrogens'] > 0) {
        fwrite($h, "@master {H's} off\n");
    }
    if ($pdbstats['waters'] > 0) {
        fwrite($h, "@master {water} off\n");
    }
    fwrite($h, "@master {Calphas} on\n");
    fwrite($h, "@master {Virtual BB} on\n");
    // for protein + DNA/RNA structures
    if ($opt['vdwdots']) {
        fwrite($h, "@master {vdw contact} off\n");
    }
    if ($opt['clashdots']) {
        fwrite($h, "@master {small overlap} off\n");
    }
    if ($opt['hbdots']) {
        fwrite($h, "@master {H-bonds} off\n");
    }
    if ($opt['ribbons']) {
        fwrite($h, "@master {ribbon} off\n");
    }
    if ($opt['Bscale']) {
        fwrite($h, "@master {B factors} off\n");
    }
    if ($opt['Qscale']) {
        fwrite($h, "@master {occupancy} off\n");
    }
    if ($opt['altconf'] && $pdbstats['all_alts'] > 0) {
        fwrite($h, "@master {mc alt confs} off\n");
        fwrite($h, "@master {sc alt confs} off\n");
    }
    fclose($h);
}
Esempio n. 5
0
 $s .= "<applet code='Magelet.class' archive='magejava.jar' width='150' height='150'>\n";
 $s .= "  <param name='kinemage' value='{$kinURL}/{$model['prefix']}thumbnail.kin'>\n";
 $s .= "  <param name='buttonpanel' value='no'>\n";
 $s .= "</applet>\n";
 $s .= "<center><small><a href='help/java.html' target='_blank'>Don't see anything?</a></i></small></center>\n";
 $s .= "</div>\n";
 if (count($idList) > 1) {
     $ensemble = $_SESSION['ensembles'][$id];
     $title = "Uploaded " . count($idList) . "-model ensemble as {$ensemble['pdb']}";
     $s .= "Your file from {$fileSource} was uploaded as an ensemble of " . count($idList) . " separate models.\n";
     $s .= "The following description applies to the first of these models, which is shown in the thumbnail kinemage:\n";
 } else {
     $title = "Uploaded PDB file as {$model['pdb']}";
     $s .= "Your file from {$fileSource} was uploaded as {$model['pdb']}.\n";
 }
 $details = describePdbStats($model['stats'], true);
 $s .= "<ul>\n";
 foreach ($details as $detail) {
     $s .= "<li>{$detail}</li>\n";
 }
 $s .= "</ul>\n";
 $s .= $map_notebook_msg;
 if ($model['stats']['originalInputH']) {
     $cur = $_SESSION['lastUsedModelID'];
     if (isset($_SESSION['ensembles'][$cur])) {
         $orig = "the original ensemble (or individual model)";
     } else {
         foreach ($_SESSION['models'] as $id_m => $model_m) {
             if ($_SESSION['lastUsedModelID'] != $id_m) {
                 $orig = $model_m['pdb'];
             }