Advertisement
ProzacR

unique_atoms_pdb-file

Sep 15th, 2014
582
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Perl 0.54 KB | None | 0 0
  1. #!/usr/bin/perl
  2. #kievienam atomui prideti unikalu nr.
  3. #
  4. # VR
  5.  
  6.  
  7. #print STDERR $ARGV[0];
  8. if (@ARGV != 1) {
  9.  die "usage ./unikalus_atomai.pl file.pdb > file_fix.pdb"
  10. }
  11. open (FILE, "@ARGV[0]") or die $!;
  12. while (<FILE>) {
  13.  #print STDERR $_;
  14.  push (@lines, $_) if ($_ =~ "ATOM" || $_ =~ "HETATM");
  15. }
  16.  
  17.  
  18. $x = 10;
  19. foreach (@lines) {
  20.  @char = split (//, $_);
  21.  #print STDERR $char[0];
  22.  @nr = split (//, $x);
  23.  #print STDERR $nr[0];
  24.  $char[14] = $nr[0];
  25.  $char[15] = $nr[1];
  26.  $newline = join ('' , @char);
  27.  print "$newline";
  28.  $x++;
  29. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement