Skip to content

Commit

Permalink
Implement Fasta.__len__ for #157
Browse files Browse the repository at this point in the history
  • Loading branch information
mdshw5 authored Jan 16, 2020
1 parent 43df193 commit a6bc9a8
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions pyfaidx/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -1020,6 +1020,10 @@ def __repr__(self):
def __iter__(self):
for rname in self.keys():
yield self[rname]

def __len__(self):
"""Return the cumulative length of all FastaRecords in self.records."""
return sum(len(record) for record in self)

def get_seq(self, name, start, end, rc=False):
"""Return a sequence by record name and interval [start, end).
Expand Down

0 comments on commit a6bc9a8

Please sign in to comment.