Skip to content

Commit

Permalink
DEV: disallow alignments/seqcols with no sequences
Browse files Browse the repository at this point in the history
  • Loading branch information
rmcar17 committed May 2, 2024
1 parent fc0c729 commit 535bb6f
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/cogent3/core/alignment.py
Original file line number Diff line number Diff line change
Expand Up @@ -564,6 +564,11 @@ def __init__(
if isinstance(data, (typing.Generator, typing.Iterator)):
data = tuple(data)

if len(data) == 0:
raise ValueError(
f"{self.__class__.__name__} must take at least one sequence."
)

if moltype is None:
moltype = _moltype_from_data(data)
moltype = cogent3.get_moltype(moltype or self.moltype)
Expand Down Expand Up @@ -2157,9 +2162,6 @@ def distance_matrix(self, calc="pdist"):
return dist_calc_app(self)

def __repr__(self):
if len(self.names) == 0:
return f"0x () {self.moltype.get_type()} seqcollection"

seqs = []
limit = 10
delimiter = ""
Expand Down

0 comments on commit 535bb6f

Please sign in to comment.