Friday, January 27, 2012

Useful commands in Pymol


load file.pdb
create protein, all and segid PROT
create water, all and resname WAT
create res40, protein and resid 40
# To set display to orthoscopic
cmd.set('''orthoscopic''','''1''',quiet=0)
# To reset to default view
reset
hide everything, all
hide everything, protein
show sticks, protein
show surface, protein
set transparency=0.5
bg_color white
# To save images
ray 1200,1200
save file.png
distance (selection1), (selection2)
distance name = (selection1), (selection1) [,cutoff [,mode] ]
fit (selection), (target-selection)
# Colors everything by chain id
util.cbc

Resources:
http://pymol.sourceforge.net/newman/ref/S1000comref.html
http://www.pymolwiki.org/index.php/TOPTOC
http://www.pymolwiki.org
http://www.pymol.org/support
http://www.pymolwiki.org/images/7/77/PymolRef.pdf
http://people.mbi.ucla.edu/sawaya/tutorials/Graphics/pymol.html

The last link is particularly useful in the post-beginner stage of using Pymol.


 
load xxx.pdb
hide everything, all
create protein, all and not name h*
show sticks, protein
distance resi 22 and name CD and chain A, resi 22 and name CD and chain B
distance resi 22 and name CD and chain B, resi 22 and name CD and chain C
distance resi 22 and name CD and chain C, resi 22 and name CD and chain D
distance resi 22 and name CD and chain D, resi 22 and name CD and chain E
distance resi 28 and name NZ and chain D, resi 23 and name OD1 and chain C
distance resi 28 and name NZ and chain D, resi 23 and name OD2 and chain C
distance resi 28 and name NZ and chain C, resi 23 and name OD1 and chain B
distance resi 28 and name NZ and chain C, resi 23 and name OD2 and chain B
distance resi 28 and name NZ and chain B, resi 23 and name OD1 and chain A
distance resi 28 and name NZ and chain B, resi 23 and name OD2 and chain A
hide labels, all

March 2nd 2012

create protein, all and not resn DT+DG+NAG+HOH+OG6
create rna, all and resn DG+DT
create nag, all and resn NAG
create og6, all and resn OG6
hide everything, all
show cartoon, rna
show lines, rna
create closeprotein, (rna around 10) and not resn DG+DT
show sticks, closeprotein
distance /rna//D/DT`13/O4, /closeprotein//H/ARG`75/NH1
distance /rna//D/DT`13/O4, /closeprotein//H/ARG`75/NH2
distance /rna//D/DG`2/OP2, /closeprotein//H/ARG`77A/NH1
distance /rna//D/DG`2/OP2, /closeprotein//H/ARG`77A/NH2


March 5th, 2012

 # simple example: label residue 22's atoms with their names
label i. 22, name
 
# Label residue #44's alpha carbon with it's residue name, number and B-factor.
label n. CA and i. 44, "(%s, %s, %s") % (resn, resi, b)


This link has a lot of info on labeling. http://pymolwiki.org/index.php/Label

Monday, January 23, 2012

Printers

Here are a few commands to work with printers on Suse Linux.

# To check the status of all printers
lpstat -a
# To check the status of a printer
lpstat -p printer
# To set a default printer
lpoptions -d printer-name
lpq
# To print a file
lp -d printer file
# To remove a print job
lprm -Pprinter job-id


sudo -u pkc  /usr/sbin/cupsenable HP_LaserJet_6MP

Friday, January 20, 2012

To merge pdf files in Mac

Here's a neat little trick to combine pdf files on a Mac
http://macintoshhowto.com/leopard/how-to-merge-pdf-files-with-preview-in-leopard.html

Wednesday, January 18, 2012

VMD script to pick a box within a box


set cellxmin [lindex [lindex [measure minmax $all] 0] 0]
set cellxmax [lindex [lindex [measure minmax $all] 1] 0]
set cellymin [lindex [lindex [measure minmax $all] 0] 1]
set cellymax [lindex [lindex [measure minmax $all] 1] 1]
set cellzmin [lindex [lindex [measure minmax $all] 0] 2]
set cellzmax [lindex [lindex [measure minmax $all] 1] 2]

for {set i 0} {$i < 100} {incr i} {
# This lets you pick a random box of size 10x10x10 in the simulation box
set xmin [expr $cellxmin + ( ($cellxmax-$cellxmin-$boxsize) * rand())]
set ymin [expr $cellymin + ( ($cellymax-$cellymin-$boxsize) * rand())]
set zmin [expr $cellzmin + ( ($cellzmax-$cellzmin-$boxsize) * rand())]
set xmax [expr $xmin + $boxsize]
set ymax [expr $ymin + $boxsize]
set zmax [expr $zmin + $boxsize]

set selection [atomselect top "(x>$xmin and x<$xmax and y>$ymin and y<$ymax and z>$zmin and z<$zmax)"]
# This gives the number of atom in that selection
set n [$selection num];
#This gives the number of non-bonded interactions in the 10x10x10 box selected.
puts $file [expr $n * ($n -1)/2 ]
}

Thursday, January 12, 2012

Useful perl code

#!/usr/bin/perl

$infile  = "./test.pdb";
$outa = "./test.pdb.A";
$outb = "./test.pdb.B";
open (FH,$infile) || die;
open (OUTA, ">$outa") || die;
open (OUTB, ">$outb") || die;

while ($buf = )
{
    $x = substr($buf,16,1);
    if ($x eq 'A') { print OUTA $buf; }
    elsif ($x eq 'B') { print OUTB $buf; }
    else { print OUTA $buf; print OUTB $buf; }
}

close FH;
close OUTA;
close OUTB;


# This code reads in a file and if the 17th column in each line matches A/B, that line is put in OUTA/OUTB.This is useful in separating multiple coordinates for particular residues in 3D coordinate file of a protein. Sometimes studying all possible conformations is important especially if it involves an aromatic ring flip or flips in residues with amine ends.

Thursday, January 5, 2012