#!/usr/bin/perl -w #Prgram to check PDB file #Written by Surendra Negi # USE:perl PDB.pl InputPDB_file.pdb PDB_CHAIN > OutPDB_file.pdb"; use strict; print "Please use:: perl PDB.pl InputPDB_file.pdb PDB_CHAIN > OutPDB_file.pdb\n"; my $filename = shift; my $chainName=shift; my @In_File=(); open(PDBFILE,"$filename") or dienice(" Can't open sorted data file $!"); @In_File=; chomp(@In_File); close(PDBFILE); foreach my $line (@In_File) { if( $line =~ /^ATOM\s*./){ my $rc=substr($line,0, 6); my $sno1=substr($line,6, 5); my $atm1=substr($line,12,4); my $prname1=substr($line,17,3); my $sdchai1=substr($line,21,1); my $atomno1=substr($line,22,4); my $x= substr($line, 30, 8); my $y= substr($line, 38, 8); my $z= substr($line, 46, 8); my $occ=substr($line, 57, 3); my $tf=substr($line, 70, 3); if ($sdchai1 eq $chainName){print "$rc$sno1 $atm1 $prname1 $sdchai1$atomno1 $x$y$z $tf"; print "\n";} } } print "TER\n"; print "END\n";