从 PDB 文件中提取坐标
为了从 PDB 文件中提取 Atom 行,我编写了下面的代码,当我运行程序时,该代码没有显示任何输出文件
print" Enter the file name";
$a=<>;
@arr=split(" ",$a);
if($i=0; $i< scalar @arr; $i++)
foreach $values(@arr)
{
if($values=~/^ATOM/)
{
print FH1 $a;
open(FH1,">>output.pdb")
}
}
To extract the Atom lines from PDB file i have written the code bellow which is not showing any outputfile when i run the program
print" Enter the file name";
$a=<>;
@arr=split(" ",$a);
if($i=0; $i< scalar @arr; $i++)
foreach $values(@arr)
{
if($values=~/^ATOM/)
{
print FH1 $a;
open(FH1,">>output.pdb")
}
}
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您不能对 PDB 文本文件使用 split,因为字段是按位置而不是分隔符定义的。请参阅坐标文件说明(PDB 格式)。
相反,您应该对每个字段使用
substr ($line,$start,$len)
以及不同的$start
和$len
值(取自坐标文件描述),或依赖可用的 PDB 解析器之一,例如Bioperl 的。You cannot use split with PDB text files since the fields are defined by position and not by separators. See Coordinate File Description (PDB Format).
Instead, you should use
substr ($line,$start,$len)
with different values of$start
and$len
for each field (taken from the Coordinate File Description), or rely on one of the available PDB parsers, such as Bioperl's.