Skip to content

Commit

Permalink
Add must_open() (#708)
Browse files Browse the repository at this point in the history
  • Loading branch information
tanghaibao authored Oct 4, 2024
1 parent eeb327b commit 195832f
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions jcvi/formats/fasta.py
Original file line number Diff line number Diff line change
Expand Up @@ -1223,7 +1223,7 @@ def summary(args):
p.add_argument(
"--suffix", default="Mb", help="make the base pair counts human readable"
)
p.add_argument("--ids", help="write the ids that have >= 50% N's")
p.add_argument("--ids", help="write the ids that have >= 50%% N's")
p.set_outfile()

opts, args = p.parse_args(args)
Expand All @@ -1239,7 +1239,7 @@ def summary(args):

data = []
for fastafile in args:
for rec in SeqIO.parse(fastafile, "fasta"):
for rec in SeqIO.parse(must_open(fastafile), "fasta"):
seqlen = len(rec)
nns = rec.seq.count("n") + rec.seq.count("N")
reals = seqlen - nns
Expand Down Expand Up @@ -2183,7 +2183,7 @@ def _uniq_rec(fastafile, seq=False):
Returns unique records
"""
seen = set()
for rec in SeqIO.parse(fastafile, "fasta"):
for rec in SeqIO.parse(must_open(fastafile), "fasta"):
name = str(rec.seq) if seq else rec.id
if name in seen:
logger.debug("ignore {0}".format(rec.id))
Expand Down

0 comments on commit 195832f

Please sign in to comment.