Thursday, June 20, 2013

How to calculate Dihedral Angle using Cartesian Coordinates or using RasMol

Dihedral angle is an angle between two planes.

Protein backbone dihedral angles are called φ (phi), involving the backbone atoms COn-1 - Nn - Cαn - COn , ψ (psi) involving the backbone atoms Nn - Cαn - COn - Nn+1) and ω (omega) involving the backbone atoms Cαn - COn - Nn+1 - Cαn+1). Thus, φ controls the COn-1 - COn distance, ψ controls the Nn - Nn+1 distance and ω controls the Cαn - Cαn+1 distance. Where n is the current atom for which you want to calculate the dihedral angles. Dihedral angle varies between -180 to +180. It is positive if rotation between atoms is clockwise and negative if rotation is anticlockwise.

To calculate phi for a residue "n" we need CO atom of n-1 residue thus we can not calculate phi for first residue of protein backbone similarly to calculate psi of residue "n" we need N atom of residue n+1 thus psi for last atom in protein backbone can not be calculated.


Calculate Dihedral Angle using Cartesian Coordinates


Atom arrangement is shown in figure 1 and 2. Figure 2 is newman projection of atom A, B, C, D, angle between A and D if we see arrangement through B-C axis is dihedral angle Ɵ. x,y,z are cartesian coordinates of atoms.


Thus using cartesian coordinates of these atoms these angles can be calculated by following method -

Using atom A, B, C, D we can define two planes. Plane 1 will have atom A-B-C and plane 2 will have atom B-C-D atoms. The angle between these two planes is dihedral angle.

Using cartesian coordinates of four atoms we can calculate 3 vectors v1, v2 and v3 as shown in figure 1.
Eg.-   v1 = ( x2-x1 )  , ( y2-y1 )  , ( z2-z1 ) likewise v2 and v3.

Get normal vectors to both of planes, first normal vector will be cross product of v1 and v2 
(v1 X v2), second normal vector will be cross product of vector v2 and v3 (v2 X v3). Name these normal vectors v4 and v5.

The angle between these two vectors v4 and v5 will be dot product of these vectors. This is dihedral angle.

To get rotation use vector v2. Vector produced by cross product of v4 and v5 will be either parallel or anti-parallel to v2 that can be used to determine rotation clockwise or anticlockwise.



Finding out Dihedral angle using RasMol - 

To find out dihedral angle using RasMol first choose CPK color by selecting "Colours" -> "CPK" and label atoms by selecting "Settings" -> "Pick Label", then clicking on individual atom or by selecting "Options" -> "Labels".
then select "Settings" -> "Pick Torsion" and choose four atoms for which we have to find out dihedral angle,
To find out phi of a residue "n" select atom CO of residue n-1 then N of n then Cα of n then CO of n
To find out psi of a residue "n" select N of n then Cα of n then CO of n then N of residue n+1.


Find out Dihedral Angle using RasMol
Find out Dihedral Angle using RasMol

Find out Dihedral Angle using RasMol
Find out Dihedral Angle using RasMol

N, CA, CO atoms in PDB Atom record will be represented as "N", "CA", "C" (column number 3)

PDB Atom Record





Monday, May 27, 2013

Perl script for Bootstrap analysis of Microarray data

New Blog, First Post!

So I've written perl code for bootstrap resampling and analysis of microarray data. Tested it on classic ALL-AML dataset from book by dov stekel and it worked.

Data file should be in csv format (attached file "allaml.csv"), bootstrap analysis will be done on only first line of the file ( you can  modify it ). Sample data i've attached is a gene expression data from ALL-AML dataset "allaml.xlsx" and "allaml.csv"

1000 random samples will be generated by the script ( you can modify that too ).

For randomization i've used shuffle subroutine from perl module List::Util, i don't know how good random sample it generates ( so use the script on your own risk ).

It will create a csv file named "means.csv" those are the mean difference of all samples.

One more file "meanint.csv" this file count of mean difference value how many times it appear in those 1000 samples first column is for mean difference second is their count. This file can be used for plotting open it in excel and you can plot there.

To check significance you can calculate mean difference of original sample and check whether it falls within confidence interval or not. If it falls within confidence interval then two samples are not significantly different otherwise if it falls outside of confidence interval then samples can be significantly different.

Confidence interval can be between (a) and ( + b) or we say 5% to 95% of mean difference data is not significantly different. Out of this range there is some significant difference. So we have to check where our original sample mean lies.

PS:-

  • Dont't know much about bootstrap analysis so if you find script is wrong please let me know.

  • The script appends data to already existing "means.csv" & "meanint.csv" so if you plan to run script second time in same folder delete alresdy existing files.


Download script from MediaFire -
http://www.mediafire.com/download/ox1du1ua33iyn4p/bs.pl.zip