Skip to content

Commit

Permalink
Final 0.3 changes
Browse files Browse the repository at this point in the history
  • Loading branch information
samirelanduk committed Aug 11, 2017
1 parent 5c4e133 commit 71ac64a
Show file tree
Hide file tree
Showing 5 changed files with 40 additions and 12 deletions.
10 changes: 10 additions & 0 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,16 @@ The ``Xyz`` object itself can also be saved:
Changelog
---------

Release 0.3.0
~~~~~~~~~~~~~

`11 August 2017`

* Added classes for Molecules, Chains, Residues, and their interfaces.
* Added charges to atoms and structures.
* Add ability to create AtomicStructures from AtomicStructures.


Release 0.2.0
~~~~~~~~~~~~~

Expand Down
23 changes: 12 additions & 11 deletions atomium/structures/chains.py
Original file line number Diff line number Diff line change
Expand Up @@ -92,17 +92,18 @@ def verify(sequence):
residues = set()
for atom in sequence.atoms():
residues.add(atom.residue())
seq = [list(residues)[0]]
while seq[-1].next() is not None and seq[-1].next() in residues:
seq.append(seq[-1].next())
while seq[-1].previous() is not None and seq[-1].previous() in residues:
seq.append(seq[-1].previous())
if set(seq) != residues:
raise SequenceConnectivityError(
"{} missing from sequence {} - check connections".format(
residues, residues - set(seq)
)
)
if residues:
seq = [list(residues)[0]]
while seq[-1].next() is not None and seq[-1].next() in residues:
seq.append(seq[-1].next())
while seq[-1].previous() is not None and seq[-1].previous() in residues:
seq.append(seq[-1].previous())
if set(seq) != residues:
raise SequenceConnectivityError(
"{} missing from sequence {} - check connections".format(
residues, residues - set(seq)
)
)
return True


Expand Down
4 changes: 3 additions & 1 deletion atomium/structures/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,9 @@ def molecules(self, molecule_id=None, name=None, generic=False):
lambda m: not isinstance(m, (Residue, Chain)), molecules
))
if molecule_id:
molecules = set(filter(lambda m: m.molecule_id() == molecule_id, molecules))
molecules = set(filter(
lambda m: m.molecule_id() == molecule_id, molecules
))
if name:
molecules = set(filter(lambda m: m.name() == name, molecules))
return molecules
Expand Down
10 changes: 10 additions & 0 deletions docs/source/changelog.rst
Original file line number Diff line number Diff line change
@@ -1,6 +1,16 @@
Changelog
---------

Release 0.3.0
~~~~~~~~~~~~~

`11 August 2017`

* Added classes for Molecules, Chains, Residues, and their interfaces.
* Added charges to atoms and structures.
* Add ability to create AtomicStructures from AtomicStructures.


Release 0.2.0
~~~~~~~~~~~~~

Expand Down
5 changes: 5 additions & 0 deletions tests/structure_tests/test_residue_sequences.py
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,11 @@ def test_can_reject_unconnected_residues(self):
ResidueSequence.verify(self.sequence)


def test_empty_sequences_pass(self):
self.sequence.atoms = lambda: set()
self.assertTrue(ResidueSequence.verify(self.sequence))



class ResidueSequenceLengthTests(ResidueSequenceTest):

Expand Down

0 comments on commit 71ac64a

Please sign in to comment.