Skip to content

Commit

Permalink
wgs: Biopython 1.79 changed the dance to detect WGS master records wi…
Browse files Browse the repository at this point in the history
…thout sequence

Signed-off-by: Kai Blin <kblin@biosustain.dtu.dk>
  • Loading branch information
kblin committed Jul 16, 2021
1 parent 42de4b4 commit dcba66f
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
10 changes: 8 additions & 2 deletions ncbi_acc_download/wgs.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@

try:
from Bio import SeqIO
from Bio.Seq import UnknownSeq
from Bio.Seq import UndefinedSequenceError
HAVE_BIOPYTHON = True
except ImportError: # pragma: no cover
HAVE_BIOPYTHON = False
Expand Down Expand Up @@ -101,7 +101,13 @@ def download_wgs_parts(handle, config):
handle.seek(0)
records = list(SeqIO.parse(handle, config.format))
for record in records:
run_download = isinstance(record.seq, UnknownSeq)
# TODO: If Biopython ever provides a nice check for undefined sequences,
# replace the exception-based check here.
run_download = False
try:
bytes(record.seq)
except UndefinedSequenceError:
run_download = True
if run_download and ('wgs_scafld' in record.annotations or
'wgs' in record.annotations or
'tsa' in record.annotations):
Expand Down
4 changes: 2 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,10 @@ def read(fname):
]

recursive_require = [
'biopython',
'biopython >= 1.79',
]
validate_require = [
'biopython',
'biopython >= 1.79',
]


Expand Down

0 comments on commit dcba66f

Please sign in to comment.