使用vmd atomselect命令删除残留物

时间:2015-09-13 15:00:18

标签: linux tcl vmd

我正在尝试使用atomselect命令删除.gro文件中蛋白质区域内的脂质。由于它是马提尼粗粒度文件,我可以使用关键字resname作为剩余名称,nametype作为珠子类型(我的伪原子)。因此,未定义默认单字。

我用命令尝试了它:

atomselect 0 "all not resname DPPE DOPE POPE POPG within 1 of resname ALA ARG ASN ASP CYS GLN GLU GLY HIS ILE LEU LYS MET PHE PRO SER THR TRP TYR VAL"

并收到以下错误:

  

错误)选择太早终止

     

错误)语法错误atomselect:无法解析选择文本:所有没有resname DPPE DOPE POPE POPG in 1 of resname ALA ARG ASN ASP CYS GLN GLU GLY HIS ILE LEU LYS MET PHE PRO SER THR TRP TYR VAL

显然我没有正确的语法。我尝试了几个不同的版本并将resname选项存储在变量中,但没有任何效果。我怎么能解决这个问题?

1 个答案:

答案 0 :(得分:0)

所以,我在R中使用bio3d编写了一些代码来执行任务:

library(bio3d)
library (gdata)

#read pdb input
insane <- read.pdb("nice.pdb")


#vector with residuenumbers to delete 
select_resi <- c(1000, 1136, 1026, 1252, 1449, 970, 1067, 1298, 
                 1287, 1357, 1051, 993, 1241, 1282, 1341, 1344, 
                 1048, 1154, 1205, 1274, 1465, 1322, 1418, 992)

select_resi <- sort(select_resi)

#select residues to delete
selected_resi <-  atom.select(insane, resno = select_resi)


#delete selected residues
insane$atom <- insane$atom[-selected_resi$atom,]
insane$calpha <- insane$calpha[-selected_resi$atom]
insane$xyz <- insane$xyz[-selected_resi$xyz]

#renumber residuenumbers and convert to gromacs type pdb
printstuff <- convert.pdb(insane, type = "gromacs", 
                          renumber = TRUE, first.resno = 1, first.eleno = 1)

#write pdb file
write.pdb(pdb = printstuff, file = "memb2R.pdb", xyz = printstuff$xyz, 
          type = printstuff$atom$type, resno = printstuff$atom$resno, 
          resid = printstuff$atom$resid, eleno = printstuff$atom$eleno, 
          elety = printstuff$atom$elety, end = TRUE, verbose = TRUE)

如果您之后需要.gro格式(这就是加载gdata的原因),您可以继续这样做:

#preparing xyz to match with .gro format
xyz_vector <- insane$xyz/10 

pos_x <- c()
pos_y <- c()
pos_z <- c()

#sorting loop for x, y, z coordinates
for (i in seq(along=xyz_vector)) {
  pos_x <- c(pos_x, xyz_vector[i])
  xyz_vector <- xyz_vector[-i]
    pos_y <- c(pos_y, xyz_vector[i])
    xyz_vector <- xyz_vector[-i]
      pos_z <- c(pos_z, xyz_vector[i])
      print(i)
}

#delete redundant entries
pos_x <- pos_x[1:length(xyz_vector)]
pos_y <- pos_y[1:length(xyz_vector)]
pos_z <- pos_z[1:length(xyz_vector)]

#prepare other passing vectors for .gro vector
resi_numb <- insane$atom$resno
resi_name <- insane$atom$resid
atom_name <- insane$atom$elety
atom_numb <- insane$atom$eleno


#prepare .gro vector
gro_vec <- sprintf ("%5d%-5s%5s%5d%8.3f%8.3f%8.3f",

                      #for velocity fields add %8.4f%8.4f%8.4f to string and create 3 velocity vectors similar to pos_x etc.

                      resi_numb, resi_name, atom_name, atom_numb,
                      pos_x, pos_y, pos_z)

#transform gro_vec in matrix
gro_matrix <- as.matrix(gro_vec, byrow = TRUE)


#write output
write.fwf (gro_matrix, file = "yourfile.txt", sep = "")

请记住重命名.txt中的.gro文件。在文件的第一行写入systemname,第二行写入atom实体,在最后一行写入box矢量(如果可用)。 不是最美丽的代码,但我还是新的,它完成了工作 我们随时欢迎改进建议:)