***  For details on how to be removed from this list visit the  ***
***          CCP4 home page http://www.ccp4.ac.uk         ***


Thanks for the quick replies.  Marko Hyvonen and Josh Warren sent perl
scripts to split a multi-model pdb.  Josh's is shorter, so I share it with
the community (after modifying it to append END cards).

Use

./splitPDB < multiModel.pdb


Andreas



#!/usr/bin/perl

open OUT, ">header.txt";

while(<>) {
   if (/^MODEL(.*)/) {
       close OUT;
       ($name = $1) =~ s/\s//g;
       open OUT, ">model_$name.pdb";
   }
   elsif (/^ENDMDL/) {
       print OUT "END";
   }
   elsif (/^END/) {
       print "end of input file reached.\n";
   }
   else {
       print OUT;
   }
}

close OUT;


-- 
                  Andreas Forster
   phone:  ++33.438.789377 / 789585  fax: 785494
 Laboratoire de  Cristallographie Macromoleculaire
  Institut de Biologie Structurale Jean-Paul Ebel
 41 rue J. Horowitz, 38027 Grenoble Cedex 1 France
https://wasatch.biochem.utah.edu/~andreas/cv_e.html

Reply via email to