Skip to content

Commit

Permalink
add polarity case for unk residues
Browse files Browse the repository at this point in the history
  • Loading branch information
pegerto-ck committed Jun 4, 2024
1 parent 32ac386 commit 0818070
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
7 changes: 5 additions & 2 deletions src/graphpro/util/polarity.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
a: apolar
nc: negative charged
pc: positive charged
unk: unknown
"""
POLARITY = {
'CYS': 'p',
Expand All @@ -26,8 +27,10 @@
'ASP': 'nc',
'LYS': 'nc',
'ARG': 'pc',
'HSD': 'pc'}
'HSD': 'pc',
'': 'unk' }

def residue_polarity(resname):
return POLARITY[resname]
return POLARITY.get(resname, 'unk')

POLARITY_CLASSES = list(set(POLARITY.values()))
2 changes: 1 addition & 1 deletion test/graphpro/annotations_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ def test_polarity_encoding():
G = md_analisys(u1).generate(ContactMap(cutoff=6), [Polarity()])
data = G.to_data(node_encoders=[Polarity()])

assert data.x.size() == (214, 4)
assert data.x.size() == (214, 5)

def test_encode_multiple_attributes():
G = md_analisys(u1).generate(ContactMap(cutoff=6), [ResidueType(), SASAResArea(chain_id='')])
Expand Down

0 comments on commit 0818070

Please sign in to comment.