Search code examples
pythonbioinformaticsbiopythonpdb-files

Biopython PDB extract coordinate(x,y,z) and b value data if b value>10 && <50


from Bio import PDB
pdb1 = PDB.PDBList()
pdb1.retrieve_pdb_file("1CRK") #downloads the .pdb file from the internet
parser = PDB.PDBParser(PERMISSIVE=1)
structure = parser.get_structure("1CRK",r'C:\Users\Sam\AppData\Local\Enthought\Canopy\User\Lib\site-packages\Bio\cr\pdb1crk.ent')
print(structure)
print(dir(structure))   
for model in structure:
    for chain in model:
        for residue in chain:
            for atom in residue:                                  
                N = atom.get_name()
                I = atom.get_id()
                Y = atom.get_coord()                
                V = atom.get_vector()
                O = atom.get_occupancy()
                B = atom.get_bfactor()         

I am new to python and tried a go at the biopython module, What I want to do is to basically, print(Y,B) only for values that have B>10 and B<50. But I have no idea how to approach this. Any suggestions? :(this is where i got all the code from, this might help


Solution

  • if 10 < B < 50:
        print(Y, B)
    

    stuck in that last for loop