Skip to content

Commit

Permalink
Add segment information for each atom (#10)
Browse files Browse the repository at this point in the history
* add segment information

* add segment information

---------

Co-authored-by: pegerto-fernandez-ck <[email protected]>
  • Loading branch information
pegerto and pegerto-ck authored Nov 21, 2023
1 parent f7e31a8 commit 7a576a7
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 3 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@ The rules for this file:
* accompany each entry with github issue/PR number (Issue #xyz)
-->

## Next
* [New] Include segmentid for freesasa calculation.

## 0.1.2
* [Fix] Clean area calculation

Expand Down
4 changes: 2 additions & 2 deletions mdakit_sasa/analysis/sasaanalysis.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,10 +78,10 @@ def _single_frame(self):
"""Calculate data from a single frame of trajectory"""

structure = freesasa.Structure()
# FreeSasa structure accepts PDBS if not available requires to reconstruct the structure using `adAtom`
# FreeSasa structure accepts PDBS if not available requires to reconstruct the structure using `addAtom`
for a in self.atomgroup:
x,y,z = a.position
structure.addAtom(a.name, a.resname, a.resnum.item(), "", x, y, z)
structure.addAtom(a.name, a.resname, a.resnum.item(), a.segid, x, y, z)

# Define 1 cpu for windows avoid freesasa code to calculate it.
parametes = freesasa.Parameters()
Expand Down
3 changes: 2 additions & 1 deletion mdakit_sasa/tests/analysis/test_sasaanalysis.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

from mdakit_sasa.analysis.sasaanalysis import SASAAnalysis
from mdakit_sasa.tests.utils import make_Universe
from MDAnalysis.core.topologyattrs import Atomnames, Resnames, Resids, Resnums
from MDAnalysis.core.topologyattrs import Atomnames, Resnames, Resids, Resnums, Segids

class TestSASAAnalysis:

Expand All @@ -24,6 +24,7 @@ def universe(self):
u.add_TopologyAttr(Resnames(["GLY"] * len(u.residues)))
u.add_TopologyAttr(Resids(list(range(0, len(u.residues)))))
u.add_TopologyAttr(Resnums(list(range(0, len(u.residues)))))
u.add_TopologyAttr(Segids(["A"] * len(u.segments)))
return u

@pytest.fixture
Expand Down

0 comments on commit 7a576a7

Please sign in to comment.