Skip to content

Commit

Permalink
dssp incompleate residues fix
Browse files Browse the repository at this point in the history
  • Loading branch information
pegerto-ck committed Oct 9, 2024
1 parent 71b41e4 commit 073a938
Show file tree
Hide file tree
Showing 3 changed files with 12,746 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/graphpro/util/dssp.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ def compute_dssp(atom_group: AtomGroup):
if iatom not in visited:
visited.append(iatom)
atoms.append(atom.position)
if atoms:
if atoms and len(atoms) >= 4: # not adding partial residue atoms
coords.append(np.array(atoms))

npcoords = np.array(coords)
Expand Down
17 changes: 15 additions & 2 deletions test/graphpro/annnotations/dssp_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,10 @@
os.path.realpath(__file__)) +
'/../../testdata/4aw0.pdb')

u3 = mda.Universe(
os.path.dirname(
os.path.realpath(__file__)) +
'/../../testdata/1w96.pdb')

def test_dssp():
G = md_analisys(u1).generate(ContactMap(cutoff=6), [DSSP()])
Expand All @@ -24,7 +28,16 @@ def test_dssp_multiple_occupancies():
G = md_analisys(u2).generate(ContactMap(cutoff=6), [DSSP()])
assert len(G.nodes()) == 283

def test_encode_enconde():
def test_dssp_incompleted_resiude():
G = md_analisys(u3).generate(ContactMap(cutoff=6), [DSSP()])
assert len(G.nodes()) == 554

def test_dssp_enconde():
G = md_analisys(u1).generate(ContactMap(cutoff=6), [DSSP()])
data = G.to_data(node_encoders=[DSSP()])
assert data.x.size() == (13,3)
assert data.x.size() == (13,3)

def test_dssp_encode_incompleted():
G = md_analisys(u3).generate(ContactMap(cutoff=6), [DSSP()])
data = G.to_data(node_encoders=[DSSP()])
assert data.x.size() == (554,3)
Loading

0 comments on commit 073a938

Please sign in to comment.