Hey,
Iam working with PDB files, and have some problems with extracting and calculating...
a PDB file look like thise for those how dont know:
see attached file
What I want is to read the whole file, find were there are lines with CA
atoms and calculate the distance between every two CA atom in a xzy-plane
and if the distance is over 4.3 it should give me the position of the two
CA atoms.
I am pretty stuck, but what I have done untill now is:
#!/usr/bin/perl -w
use strict;
################# Parameters ########################
#my $threshold_Å = 4.30; # Save position with scores greater than $threshold_Å
###################### FILES ########################
# PDB_input: input file
#
#
#
#The program is given a PDB file as input on the command line comments if there are erros
sub usage {
my ($msg) = @_;
print "$msg\n\n" if defined $msg;
print "Usage: project.pl <PDBfile.pdb>\n";
exit;
}
if (scalar @ARGV !=1){
&usage("Wrong number of arguments");
}
my $PDBfile = @ARGV ;
############## ALPHA CARBON SUBROUTINES ##################
sub get_alpha_carbon {
open(IN,'<',$PDBfile ) or die "Could not find file\n";
my @alpha_carbon = ();
my $line = '';
while (defined (my $line = <IN>)) {
chomp ($line);
if ($line =~ m/^ATOM\s+\d+\s+CA\s+\[A-Z]{3}\A\s\d+\s+\d+(\.\d+)\s+\d+(\.\d+)\s+\d+(\.\d+)$/) {
push my @alpha_carbon, my $alpha_carbon;
}
}
sub calc_chain_breaks {
my ($ax, $ay, $az, $bx, $by, $bz);
my $distance = sqrt(($ax - $bx) ** 2 + ($ay - $by) ** 2
+ ($az - $bz) ** 2);
if ($distance > 4.3){
print "....
I know I have to define my $ax, $ay, $az, $bx, $by, $bz
( which are coordinates to the two CA atoms) but I have no idea how!!!!
Thanks for your time...