Skip to content

Commit

Permalink
Merge pull request #467 from GavinHuttley/develop
Browse files Browse the repository at this point in the history
API: PEP8 renaming of sequence attributes
  • Loading branch information
GavinHuttley committed Jan 6, 2020
2 parents 08c578f + ddd4633 commit 822b339
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions src/cogent3/core/sequence.py
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ class SequenceI(object):
# String methods delegated to self._seq -- remember to override if self._seq
# isn't a string in your base class, but it's probably better to make
# self._seq a property that contains the string.
LineWrap = None # used for formatting FASTA strings
line_wrap = None # used for formatting FASTA strings

def __str__(self):
"""__str__ returns self._seq unmodified."""
Expand Down Expand Up @@ -1330,7 +1330,7 @@ class ArraySequenceBase(object):
such as FASTA.
A sequence Class has an alphabet (which can be overridden in instances
where necessary), a delimiter used for string conversions, a LineWrap
where necessary), a delimiter used for string conversions, a line_wrap
for wrapping characters into lines for e.g. FASTA output.
Note that a ArraySequence _must_ have an Alphabet, not a MolType,
Expand All @@ -1340,8 +1340,8 @@ class ArraySequenceBase(object):

alphabet = None # REPLACE IN SUBCLASSES
moltype = None # REPLACE IN SUBCLASSES
Delimiter = "" # Used for string conversions
LineWrap = 80 # Wrap sequences at 80 characters by default.
delimiter = "" # Used for string conversions
line_wrap = 80 # Wrap sequences at 80 characters by default.

def __init__(self, data="", alphabet=None, name=None, info=None, check="ignored"):
"""Initializes sequence from data and alphabet.
Expand Down Expand Up @@ -1408,7 +1408,7 @@ def __str__(self):
if hasattr(self.alphabet, "to_string"):
return self.alphabet.to_string(self._data)
else:
return self.Delimiter.join(map(str, self.alphabet.from_indices(self._data)))
return self.delimiter.join(map(str, self.alphabet.from_indices(self._data)))

def __len__(self):
"""Returns length of data."""
Expand Down Expand Up @@ -1793,7 +1793,7 @@ class ArrayCodonSequence(ArraySequence):

def __str__(self):
"""Joins triplets together as string."""
return self.Delimiter.join(map("".join, self.alphabet.from_indices(self._data)))
return self.delimiter.join(map("".join, self.alphabet.from_indices(self._data)))

def _from_string(self, s):
"""Reads from a raw string, rather than a DnaSequence."""
Expand Down

0 comments on commit 822b339

Please sign in to comment.