fahadm89 has asked for the wisdom of the Perl Monks concerning the following question:
Hello im new to programming i need help what i am trying to do is to compare a set of coordinates from one file to another set of coordinates from many different files. i am having trouble doing this please can some 1 help me here is what i have done so far which compares 2 sets. i want to be able to change the first part to cycle through all files i have in a directory.
#!/usr/bin/perl -w #$dir = "/net/klab2/u2/home/fmohammad/GFP2/run1"; #opendir (DIR, $dir) or die $!; #@one = readdir (DIR); #foreach $file (@one) #{ $initialfile2 = "UM_802_R203E112_1GFL_clean_gfp_5.pdb"; open FILETWO, "$initialfile2" or die "cannot open $initialfile2 for re +ad\n"; while ($line2 = <FILETWO>) { chomp $line2; @one=split(/\s+/, $line2); if ($one[0]=~m/^HETATM/) { if ($one[2]eq "C4") { $xC4=$one[6]; $yC4=$one[7]; $zC4=$one[8]; } if ($one[2]eq "C1") { $xC1=$one[6]; $yC1=$one[7]; $zC1=$one[8]; } if ($one[2]eq "C13") { $xC13=$one[6]; $yC13=$one[7]; $zC13=$one[8]; } } } close FILETWO; $initialfile = "1GFL.pdb"; open FILEONE, "$initialfile" or die "cannot open $initialfile for read +\n"; while ($line = <FILEONE>) { chomp $line; @two=split(/\s+/, $line); if ($two[0]=~m/^ATOM/) { if ($two[1]eq "479") { $xS=$two[6]; $yS=$two[7]; $zS=$two[8]; } if ($two[1]eq "484") { $xY=$two[6]; $yY=$two[7]; $zY=$two[8]; } if ($two[1]eq "496") { $xG=$two[6]; $yG=$two[7]; $zG=$two[8]; } } } close FILEONE; $part1 = ((($xC1 - $xS)**2) + (($yC1 - $yS)**2) + (($zC1 - $zS)**2)); $part2 = ((($xC4 - $xY)**2) + (($yC4 - $yY)**2) + (($zC4 - $zY)**2)); $part3 = ((($xC13 - $xG)**2) + (($yC13 - $yG)**2) + (($zC13 - $zG)**2) +); $sum = $part1 + $part2 + $part3; $sum1 = $sum / 3; $rmsd = sqrt ($sum1); print"$rmsd\n"; #}
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Hello im new to programming i need help
by jethro (Monsignor) on Feb 10, 2013 at 00:54 UTC | |
by fahadm89 (Initiate) on Feb 10, 2013 at 01:17 UTC | |
by jethro (Monsignor) on Feb 10, 2013 at 02:11 UTC | |
|
Re: Hello im new to programming i need help
by Kenosis (Priest) on Feb 10, 2013 at 05:51 UTC | |
|
Re: Hello im new to programming i need help
by Anonymous Monk on Feb 09, 2013 at 23:54 UTC | |
by 7stud (Deacon) on Feb 10, 2013 at 01:17 UTC | |
|
Re: Hello im new to programming i need help
by 7stud (Deacon) on Feb 10, 2013 at 01:23 UTC | |
by fahadm89 (Initiate) on Feb 10, 2013 at 01:29 UTC | |
|
Re: Hello im new to programming i need help
by 7stud (Deacon) on Feb 10, 2013 at 01:40 UTC | |
|
Re: Hello im new to programming i need help
by locked_user sundialsvc4 (Abbot) on Feb 10, 2013 at 19:42 UTC |