Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/powershell/12.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
从pdb文件计算邻接残留物的Perl程序_Perl_Bioinformatics - Fatal编程技术网

从pdb文件计算邻接残留物的Perl程序

从pdb文件计算邻接残留物的Perl程序,perl,bioinformatics,Perl,Bioinformatics,这是一个在4.5埃范围内提取相邻残留物的程序。我已将程序解析到原子数。我想从中提取 剩余数 剩余名称 原子№ 及 原子名 我想以表格形式输出这些数据,以便直接复制结果。但现在我陷入困境,需要帮助来提取我在$close\u atomno中获得的原子数字段,以及如何使用该程序一次性处理多个pdb文件和不同的催化残留物 感谢您的帮助 #!/usr/bin/perl use List::Util qw(sum); use Data::Dumper qw(Dumper); use 5.010; sa

这是一个在4.5埃范围内提取相邻残留物的程序。我已将程序解析到原子数。我想从中提取

  • 剩余数
  • 剩余名称
  • 原子№ 及
  • 原子名
我想以表格形式输出这些数据,以便直接复制结果。但现在我陷入困境,需要帮助来提取我在
$close\u 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";
对于按此顺序排列的列:

  • 原子
  • 原子数
  • 原子名
  • 剩余名称
  • 链子
  • 剩余数
  • x坐标
  • y坐标
  • z坐标
  • 无关的
  • 无关的
  • 无关的
使用警告;
严格使用;
我的$base_r_no=$ARGV[0];

在中打开,“我对Perl了解很多,但对
PDB
文件一无所知。您能提供一个简短的测试用例(示例输入+该输入的预期输出)吗这样就更容易理解发生了什么,出了什么问题?您可以将您的问题包括文件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.22C第一列是原子,第二列是原子数,第三列是原子名,第四列是残基名,第五列是链,第六列是残基号,7,8,9是取距离的坐标,通过原子号我想提取相应的残基名,编号和原子名,第10,11列没有用。输入的是这个数据,通过坐标我们计算距离在原子和与用户给定的残数no对应的原子之间,如果dist小于4.5,则打印原子、残数,并删除多余的残数名称。我通过使用逻辑等效转换、删除未使用的变量、删除相同数据的多个计算和重命名简化了源代码一些变量。它现在将使用
使用严格;使用警告;
编译,您应该始终使用这些变量。现在您可以通过将一些变量重命名为有用的变量来提供帮助(
@pointsX
不是),并且在没有完整的测试用例的情况下为您给出的输入示例提供预期的输出。编写工作代码来解决复杂问题相当困难。
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
use warnings;
use strict;

my $base_r_no = $ARGV[0];
open IN, "<$ARGV[1]" or die;

my @atoms_data = map {[split]} grep {/^ATOM/} <IN>; 
foreach my $base_atom (grep {($$_[2] !~ /^N|CA|O|C$/) && ($$_[5] eq $base_r_no)} @atoms_data) {
    foreach my $matched_atom (grep {dist($base_atom,$_) < 4.5} @atoms_data) {
        print join("\t",@{$matched_atom})."\n";
    }
}

sub dist {
    return sqrt( ($$_[1][5]-$$_[0][5])**2 + ($$_[1][6]-$$_[0][6])**2 + ($$_[1][7]-$$_[0][7])**2 );
}