4.5オングストローム以内の隣接残基を抽出するプログラムです。原子番号までプログラムを解決しました。これらから私は抽出したい
- 残基番号、
- 残基名、
- 原子番号と
- 原子名。
結果を直接コピーできるように、このデータを表形式で出力したいと思います。しかし今、私は立ち往生しており、 で取得した原子番号のフィールドを抽出する$close_atomno
方法と、複数の pdb ファイルと異なる触媒残基に対してプログラムを一度に使用する方法について助けが必要です。
どんな助けでも大歓迎です。
#!/usr/bin/perl
use List::Util qw(sum);
use Data::Dumper qw(Dumper);
use 5.010;
say "enter residue no.";
chomp(my $r_no = <STDIN>);
my (@all_pos, @all_data, @matching_pos, @matching_data);
my $residue_file = "neighbouring_residues.txt";
open my $out_fh1, '>', $residue_file or die "Can't open $residue_file: $!";
say "enter file name";
chomp(my $infile_name = <STDIN>);
open IN, '<', $infile_name or die "Can't open $infile_name: $!";
LINE: while (<IN>) {
chomp;
/^ATOM/ or next LINE;
my @fields = split;
push @all_pos, [ @fields[6 .. 8] ];
push @all_data, [ @fields[1 .. 3, 5] ];
if( $fields[6] eq $r_no) {
say $_;
push @matching_pos, [ @fields[6 .. 8] ];
push @matching_data, [ @fields[1 .. 3, 5] ];
}
}
say $out_fh1 "Neighbouring residues at position $r_no in the 4.5A region are:";
my %close_atoms;
MATCHING_ATOM:
for my $i1 ( 0 .. $#matching_pos ) {
my $matching_atom = $matching_data[$i1][1];
$matching_atom eq $_ and next MATCHING_ATOM for qw/N CA O C/;
for my $i2 ( 0 .. $#all_pos ) {
my ($close_atomno, $close_residueno) = @{$all_data[$i2]}[0, 3];
my $dist = distance($matching_pos[$i1], $all_pos[$i2]);
if($dist < 4.5 and $close_residueno != $r_no) {
$close_atoms{$close_atomno} = 1;
}
}
}
sub distance { sqrt sum map {$_**2} map {$_[0][$_] - $_[1][$_]} 0 .. $#{$_[0]} };
my @close_atoms = keys %close_atoms;
say $out_fh1 "@close_atoms";
for my $m (0 .. $#close_atoms) {
say $out_fh1 $all_pos[$m];# here is problem i want residue details according to $close_atomno
}
say "result in $residue_file";
これは典型的な入力ファイルです:
ATOM 9 N GLU A 1 35.540 1.925 27.662 1.00 19.70 N
ATOM 10 CA GLU A 1 35.626 1.018 28.802 1.00 20.96 C
ATOM 11 C GLU A 1 34.264 0.794 29.444 1.00 20.22 C
列をこの順序で:
- 原子
- 原子番号
- 原子名
- 残基名
- 鎖
- 残基番号
- ×座標
- Y 座標
- z 座標
- 無関係
- 無関係
- 無関係