The array monkey patch leads to atom names being lost during processing.
In [1]: import atomworks
In [2]: from biotite import structure as struct
In [3]: atoms = [struct.Atom([1, 2, 3], atom_name="C"), struct.Atom([2, 3, 4], atom_name="CA")]
In [4]: struct.array(atoms)
Out[4]:
AtomArray([
Atom(np.array([1., 2., 3.], dtype=float32), chain_id="", res_id=0, ins_code="", res_name="", hetero=False, atom_name="C", element=""),
Atom(np.array([2., 3., 4.], dtype=float32), chain_id="", res_id=0, ins_code="", res_name="", hetero=False, atom_name="CA", element="")
])
In [5]: struct.array(list(struct.array(atoms)))
Out[5]:
AtomArray([
Atom(np.array([1., 2., 3.], dtype=float32), chain_id="", res_id=0, ins_code="", res_name="", hetero=False, atom_name="C", element=""),
Atom(np.array([2., 3., 4.], dtype=float32), chain_id="", res_id=0, ins_code="", res_name="", hetero=False, atom_name="C", element="")
])
The issue is here:
|
if hasattr(atoms[0]._annot[name], "dtype"): |
|
# (Preserve dtype if possible) |
|
dtype = atoms[0]._annot[name].dtype |
|
else: |
|
dtype = type(atoms[0]._annot[name]) |
The array monkey patch leads to atom names being lost during processing.
The issue is here:
atomworks/src/atomworks/biotite_patch.py
Lines 192 to 196 in 6bd5de0