This is a test version of Biostars. For the public version, visit https://www.biostars.org.
Extract all the residues of chain A between the z coordinate (-14.000 to 14.000)

Hello !! I want to process several pdb files.I am using pdb file from OPM database.It has the orientation of proteins in the membrane.The membrane region in pdb file is marked with dummy atom 'DUM'.I want to extract all the protein Atoms of chain A in the membrane region.Along with the dummy atoms.I am stuck in doing both.I would appreciate if i get a guidance and help.

lines = open('1fx8.pdb').readlines()

outlines = ''

for line in lines:

  if line.startswith('ATOM') and line[22] == 'A' and (line[47:54] >= -14.800 or line[47:54] <= 14.800):
    outlines += line

outfile = open('ChainA_1fx8.pdb', 'w')

outfile.write(outlines)

outfile.close()

sequence pdb file

1 answer

An approach could use distances: any atom close enough to any atom in the DUM section should be selected and then you filter them by the only those in CHAIN A or in DUM region.

Log in to answer this question.