Changes

From CCP4 wiki
Jump to navigationJump to search
no edit summary
Line 8: Line 8:  
This one-liner splits the file models.pdb into individual pdb files names model_###.pdb.
 
This one-liner splits the file models.pdb into individual pdb files names model_###.pdb.
   −
grep -n 'MODEL\|ENDMDL' models.pdb |  
+
'''grep -n 'MODEL\|ENDMDL' models.pdb | '''
cut -d: -f 1 |  
+
'''cut -d: -f 1 | '''
awk '{if(NR%2) printf "sed -n %d,",$1+1; else printf "%dp > model_%03d.pdb\n", $1-1,NR/2;}' |  
+
'''awk '{if(NR%2) printf "sed -n %d,",$1+1; else printf "%dp > model_%03d.pdb\n", $1-1,NR/2;}' | '''
bash -sf
+
'''bash -sf'''
    
== Perl script ==
 
== Perl script ==
   −
$base='1g9e';open(IN,"<$base.pdb");@indata = <IN>;$i=0;
+
'''$base='1g9e';open(IN,"<$base.pdb");@indata = <IN>;$i=0;'''
   −
foreach $line(@indata) {
+
'''foreach $line(@indata) {'''
   −
if($line =~ /^MODEL/) {++$i;$file="${base}_$i.pdb";open(OUT,">$file");next}
+
'''if($line =~ /^MODEL/) {++$i;$file="${base}_$i.pdb";open(OUT,">$file");next}'''
   −
if($line =~ /^ENDMDL/) {next}
+
'''if($line =~ /^ENDMDL/) {next}'''
   −
if($line =~ /^ATOM/ || $line =~ /^HETATM/) {print OUT "$line"}
+
'''if($line =~ /^ATOM/ || $line =~ /^HETATM/) {print OUT "$line"}'''
   −
}
+
'''}'''
       
Back to [[Useful scripts (aka smart piece of code)]]
 
Back to [[Useful scripts (aka smart piece of code)]]
67

edits

Cookies help us deliver our services. By using our services, you agree to our use of cookies.

Navigation menu