Skip to content

Commit

Permalink
Merge pull request #389 from BradyAJohnston/388
Browse files Browse the repository at this point in the history
fix chain_id issue with CellPack models
  • Loading branch information
BradyAJohnston authored Jan 4, 2024
2 parents a768356 + c9c0a11 commit a8a0ce3
Show file tree
Hide file tree
Showing 7 changed files with 92 additions and 89 deletions.
Binary file modified molecularnodes/assets/MN_data_file.blend
Binary file not shown.
2 changes: 1 addition & 1 deletion molecularnodes/io/cellpack.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ def parse(file, name="NewModel", get_transforms=True, instance_nodes=True):

chain_names = np.unique(mol.chain_id)

obj_data['chain_id'] = chain_names
obj_data['chain_id_unique'] = chain_names

coll_cellpack = coll.cellpack(f"{name}")

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
['Cv0', 'Cv1', 'Cv10', 'Cv11', 'Cv12', 'Cv13', 'Cv2', 'Cv3', 'Cv4', 'Cv5', 'Cv6', 'Cv7', 'Cv8', 'Cv9', 'Ed0', 'Ed1', 'Ed2', 'Ed3', 'Ed4', 'Ed5', 'Ed6', 'Ed7', 'Ed8', 'Gb0', 'Gb1', 'Gb2', 'Gb3', 'Gg01', 'Gg02', 'Gg03', 'Gg04', 'Gg11', 'Gg12', 'Gg13', 'Gg14', 'Gh01', 'Gh02', 'Gh03', 'Gh04', 'Gi01', 'Gi02', 'Gi03', 'Gi04']
Original file line number Diff line number Diff line change
@@ -1,43 +1,43 @@
0000_Cv0.002
0001_Cv1.002
0002_Cv10.002
0003_Cv11.002
0004_Cv12.002
0005_Cv13.002
0006_Cv2.002
0007_Cv3.002
0008_Cv4.002
0009_Cv5.002
0010_Cv6.002
0011_Cv7.002
0012_Cv8.002
0013_Cv9.002
0014_Ed0.002
0015_Ed1.002
0016_Ed2.002
0017_Ed3.002
0018_Ed4.002
0019_Ed5.002
0020_Ed6.002
0021_Ed7.002
0022_Ed8.002
0023_Gb0.002
0024_Gb1.002
0025_Gb2.002
0026_Gb3.002
0027_Gg01.002
0028_Gg02.002
0029_Gg03.002
0030_Gg04.002
0031_Gg11.002
0032_Gg12.002
0033_Gg13.002
0034_Gg14.002
0035_Gh01.002
0036_Gh02.002
0037_Gh03.002
0038_Gh04.002
0039_Gi01.002
0040_Gi02.002
0041_Gi03.002
0042_Gi04.002
0000_Cv0
0001_Cv1
0002_Cv10
0003_Cv11
0004_Cv12
0005_Cv13
0006_Cv2
0007_Cv3
0008_Cv4
0009_Cv5
0010_Cv6
0011_Cv7
0012_Cv8
0013_Cv9
0014_Ed0
0015_Ed1
0016_Ed2
0017_Ed3
0018_Ed4
0019_Ed5
0020_Ed6
0021_Ed7
0022_Ed8
0023_Gb0
0024_Gb1
0025_Gb2
0026_Gb3
0027_Gg01
0028_Gg02
0029_Gg03
0030_Gg04
0031_Gg11
0032_Gg12
0033_Gg13
0034_Gg14
0035_Gh01
0036_Gh02
0037_Gh03
0038_Gh04
0039_Gi01
0040_Gi02
0041_Gi03
0042_Gi04
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
['Cv0', 'Cv1', 'Cv10', 'Cv11', 'Cv12', 'Cv13', 'Cv2', 'Cv3', 'Cv4', 'Cv5', 'Cv6', 'Cv7', 'Cv8', 'Cv9', 'Ed0', 'Ed1', 'Ed2', 'Ed3', 'Ed4', 'Ed5', 'Ed6', 'Ed7', 'Ed8', 'Gb0', 'Gb1', 'Gb2', 'Gb3', 'Gg01', 'Gg02', 'Gg03', 'Gg04', 'Gg11', 'Gg12', 'Gg13', 'Gg14', 'Gh01', 'Gh02', 'Gh03', 'Gh04', 'Gi01', 'Gi02', 'Gi03', 'Gi04']
Original file line number Diff line number Diff line change
@@ -1,43 +1,43 @@
0000_Cv0.003
0001_Cv1.003
0002_Cv10.003
0003_Cv11.003
0004_Cv12.003
0005_Cv13.003
0006_Cv2.003
0007_Cv3.003
0008_Cv4.003
0009_Cv5.003
0010_Cv6.003
0011_Cv7.003
0012_Cv8.003
0013_Cv9.003
0014_Ed0.003
0015_Ed1.003
0016_Ed2.003
0017_Ed3.003
0018_Ed4.003
0019_Ed5.003
0020_Ed6.003
0021_Ed7.003
0022_Ed8.003
0023_Gb0.003
0024_Gb1.003
0025_Gb2.003
0026_Gb3.003
0027_Gg01.003
0028_Gg02.003
0029_Gg03.003
0030_Gg04.003
0031_Gg11.003
0032_Gg12.003
0033_Gg13.003
0034_Gg14.003
0035_Gh01.003
0036_Gh02.003
0037_Gh03.003
0038_Gh04.003
0039_Gi01.003
0040_Gi02.003
0041_Gi03.003
0042_Gi04.003
0000_Cv0
0001_Cv1
0002_Cv10
0003_Cv11
0004_Cv12
0005_Cv13
0006_Cv2
0007_Cv3
0008_Cv4
0009_Cv5
0010_Cv6
0011_Cv7
0012_Cv8
0013_Cv9
0014_Ed0
0015_Ed1
0016_Ed2
0017_Ed3
0018_Ed4
0019_Ed5
0020_Ed6
0021_Ed7
0022_Ed8
0023_Gb0
0024_Gb1
0025_Gb2
0026_Gb3
0027_Gg01
0028_Gg02
0029_Gg03
0030_Gg04
0031_Gg11
0032_Gg12
0033_Gg13
0034_Gg14
0035_Gh01
0036_Gh02
0037_Gh03
0038_Gh04
0039_Gi01
0040_Gi02
0041_Gi03
0042_Gi04
5 changes: 3 additions & 2 deletions tests/test_cellpack.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ def test_cellpack_data(snapshot, file_format):

@pytest.mark.parametrize('file_format', ['bcif', 'cif'])
def test_load_cellpack(snapshot, file_format):
bpy.ops.wm.read_homefile(app_template="")
name = f"Cellpack_{file_format}"
ens = mn.io.cellpack.load(
test_data_directory / f"square1.{file_format}",
Expand All @@ -39,9 +40,9 @@ def test_load_cellpack(snapshot, file_format):
ens.modifiers['MolecularNodes'].node_group.nodes['MN_pack_instances'].inputs['As Points'].default_value = False
mn.blender.nodes.realize_instances(ens)
apply_mods(ens)

for attribute in ens.data.attributes.keys():
snapshot.assert_match(
sample_attribute_to_string(ens, attribute),
f"att_{attribute}_values.txt"
)
)
snapshot.assert_match(str(ens['chain_id_unique']), f"chain_id_unique.txt")

0 comments on commit a8a0ce3

Please sign in to comment.