Skip to content

Commit

Permalink
Merge pull request #481 from GavinHuttley/develop
Browse files Browse the repository at this point in the history
DOC: tidied some docstrings
  • Loading branch information
GavinHuttley committed Jan 10, 2020
2 parents 19e175b + 9e13ffc commit ab531d6
Showing 1 changed file with 13 additions and 18 deletions.
31 changes: 13 additions & 18 deletions src/cogent3/core/alignment.py
Original file line number Diff line number Diff line change
Expand Up @@ -2035,28 +2035,19 @@ def _get_moltype(self):

moltype = property(_get_moltype)

def copy(self, memo=None, _nil=None, constructor="ignored"):
def copy(self):
"""Returns a shallow copy of self
WARNING: cogent3.core.sequence.Sequence does NOT implement a copy method,
as such, the data member variable of the copied object will maintain
reference to the original object.
WARNING: cogent3.core.location.Map does NOT implement a copy method, as
such, the data member variable of the copied object will maintain
reference to the original object.
"""
_nil = _nil or []
return self.__class__(self.map, self.data)

def deepcopy(self, sliced=True):
"""
does a proper slice on the copied sequence when sliced is True and returns a deep copy of self
Parameters
-----------
sliced : bool
Slices underlying sequence with start/end of self coordinates. This has the effect of breaking the connection
to any longer parent sequence.
Slices underlying sequence with start/end of self coordinates. This
has the effect of breaking the connection to any longer parent sequence.
Returns
-------
a copy of self
Expand Down Expand Up @@ -2337,12 +2328,16 @@ def probs_per_pos(
)
return counts.to_freq_array()

def entropy_per_pos(self, motif_length=1, include_ambiguity=False, allow_gap=False, alert=False):
def entropy_per_pos(
self, motif_length=1, include_ambiguity=False, allow_gap=False, alert=False
):
"""returns shannon entropy per position"""
probs = self.probs_per_pos(motif_length=motif_length,
include_ambiguity=include_ambiguity,
allow_gap=allow_gap,
alert=alert)
probs = self.probs_per_pos(
motif_length=motif_length,
include_ambiguity=include_ambiguity,
allow_gap=allow_gap,
alert=alert,
)
return probs.entropy()

def probs_per_seq(
Expand Down

0 comments on commit ab531d6

Please sign in to comment.