从PDB文件中删除HETATM

时间:2015-02-22 03:41:00

标签: perl python-3.x bioinformatics

我想从本地的PDB文本文件中删除杂原子(HETATM)。我发现了一个perl脚本,显然需要快速调整以使其按照我想要的方式进行,但我不确定该调整是什么。

!#/usr/bin/env perl

open(FILE,"file.pdb");
@file=<FILE>;
foreach (@file){
if (/^HETATM/){
print $_,"\n";
}}

此外,如果任何人有一个现有的perl或python脚本,他们可以分享,我会非常感激。

2 个答案:

答案 0 :(得分:1)

在R中,您可以使用Bio3D package

library(bio3d)

# read pdb
pdb <- read.pdb("1hel")

# make a subset based on TYPE
new <- trim.pdb(pdb, type="ATOM")

# write new pdb to disk
write.pdb(new, file="1hel_ATOM.pdb")

这也可以与各种其他选择标准相结合,例如链ID,残留数,残留名称等等:

# select ATOM records for chain A
n1 <- trim.pdb(pdb, type="ATOM", chain="A")

# select residue numbers 10 through 20
n2 <- trim.pdb(pdb, resno=10:20)

答案 1 :(得分:0)

在PERL中试试这个

use warnings;
use strict;
my $filename = "4BI7.pdb";
die "Error opening file" unless (open my $handler , '<' , "$filename");
open my $newfile, '>', "filename.pdb" or  die "New file not create";
while($_ = <$handler>){
    print $newfile "$_" unless /^HETATM.*/;
}
相关问题