Skip to content

Commit

Permalink
Fix case for trimmed property when no positions to trim
Browse files Browse the repository at this point in the history
  • Loading branch information
TJBIII committed Sep 24, 2023
1 parent 8442f43 commit 905e560
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion clipkit/msa.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,8 @@ def _to_bio_msa(self, sites) -> MultipleSeqAlignment:

@property
def trimmed(self):
if len(self._site_positions_to_trim) == 0:
return self.seq_records
return np.delete(self.seq_records, self._site_positions_to_trim, axis=1)

@property
Expand Down Expand Up @@ -84,9 +86,10 @@ def stats(self) -> TrimmingStats:

def is_any_entry_sequence_only_gaps(self) -> tuple[bool, Union[str, None]]:
for idx, row in enumerate(self.trimmed):
print(f"idx: {idx}, row: {row}")
if (
np.all(row == row[0]) # all values the same
and row[0] in self.gap_chars
and (row[0] in self.gap_chars)
):
return True, self.header_info[idx].get("id")
return False, None
Expand Down

0 comments on commit 905e560

Please sign in to comment.