biotite-dev / biotite

A comprehensive library for computational molecular biology
https://www.biotite-python.org
BSD 3-Clause "New" or "Revised" License
581 stars 92 forks source link

get_structures not returning extra fields #595

Closed tjmier closed 2 weeks ago

tjmier commented 2 weeks ago

when using the get_structure function for either a cif, bcif, of pdb file, I am unable to get extra fields in the atoms array.

import biotite.structure.io.pdbx as pdbx

path = "protein_structures/6y7f.cif"

cif_file = pdbx.CIFFile.read(path)

cif_array = pdbx.get_structure(cif_file, model= 1, extra_fields=['b_factor'])

print(cif_array[1:10])
A      16  ASN CA     C        31.321   31.403   42.888
A      16  ASN C      C        30.054   31.660   42.069
A      16  ASN O      O        29.018   31.053   42.317
A      16  ASN CB     C        31.519   32.497   43.948
A      17  TRP N      N        30.151   32.533   41.076
A      17  TRP CA     C        29.049   32.880   40.178
A      17  TRP C      C        28.660   31.691   39.264
A      17  TRP O      O        27.480   31.506   38.957
A      17  TRP CB     C        29.469   34.100   39.351

I've tried using different structures, different field options, and different file types (cif, bcif, and pdb) but have been unable to get the extra fields to appear in the atom array. I know the structure has them as I can see them in the file text.

Inputting extra_fields=['test'] throws an error so it seems my extra_fields inputs are being recognized as valid but its not reflected in the atomarray.

padix-key commented 2 weeks ago

Hi, the structure contains B-factors but they are not displayed in the string representation. Showing every optional annotation there would make each row quite long. You can find the B-factors in cif_array.b_factor (like you would with chain_id, atom_name etc.).

If this does not solve your problem, feel free to reopen the issue.

tjmier commented 2 weeks ago

I see now. This solves my problem thank you. I am still trying to catch up on the fundamentals of the package.