Skip to content

Commit

Permalink
fixed properties model missing the last atom, changed is_sidechain to…
Browse files Browse the repository at this point in the history
… is_ca
  • Loading branch information
BradyAJohnston committed May 25, 2022
1 parent 6c2d81d commit 04bb366
Showing 1 changed file with 23 additions and 2 deletions.
25 changes: 23 additions & 2 deletions src/import_structure.py
Original file line number Diff line number Diff line change
Expand Up @@ -450,7 +450,7 @@ def get_value(vec, x):
create_model(
name=name,
collection=collection,
locations=list(map(lambda x: [get_value(prop_x, x), get_value(prop_y, x), get_value(prop_z, x)], range(len(first_model.atoms()) - 1))))
locations=list(map(lambda x: [get_value(prop_x, x), get_value(prop_y, x), get_value(prop_z, x)], range(len(first_model.atoms())))))


def get_bond_list(model, connect_cutoff=0.35, search_distance=2):
Expand Down Expand Up @@ -618,6 +618,27 @@ def try_is_backbone(atom):
return atom_is_backbone


def get_model_is_ca(model):
"""
Returns numpy array of True / False if atom name is equal to CA.
"""

all_atoms = model.atoms()
try:
atom_id = list(map(lambda x: x.id, all_atoms))
atom_is_CA = list(map(lambda x: x.name == "CA", all_atoms))

atom_id = np.array(atom_id)
inds = atom_id.argsort()
atom_is_CA = np.array(atom_is_CA)[inds]

except:
atom_is_CA = []
for i in len(all_atoms):
atom_is_CA.append(False)

return atom_is_CA

# See if there is a collection called "Molecular Nodes", if so, set it to be the parent
# collection, otherwise create one and link it to the scene collection.
try:
Expand Down Expand Up @@ -678,7 +699,7 @@ def try_is_backbone(atom):
collection=col_properties,
prop_x=get_frame_bvalue(first_model),
prop_y=get_model_is_backbone(first_model),
prop_z=get_model_is_sidechain(first_model)
prop_z=get_model_is_ca(first_model)
)

# hide the created properties collection
Expand Down

0 comments on commit 04bb366

Please sign in to comment.