从 PDB 文件中提取坐标

发布于 2024-12-29 18:17:21 字数 312 浏览 6 评论 0原文

为了从 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

情仇皆在手 2025-01-05 18:17:21

您不能对 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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文