Skip to content

Commit

Permalink
catch codon error in main
Browse files Browse the repository at this point in the history
  • Loading branch information
Donaim committed Sep 22, 2023
1 parent 7a7e5a0 commit 3f90930
Showing 1 changed file with 30 additions and 23 deletions.
53 changes: 30 additions & 23 deletions intact/intact.py
Original file line number Diff line number Diff line change
Expand Up @@ -756,29 +756,36 @@ def intact( working_dir,

alignment = aligned_sequence.get_alignment()

sequence_orfs, orf_errors = has_reading_frames(
aligned_sequence, False,
forward_orfs, error_bar)
sequence_errors.extend(orf_errors)

sequence_small_orfs, small_orf_errors = has_reading_frames(
aligned_sequence, True,
small_orfs, error_bar, reverse = False)
if include_small_orfs:
sequence_errors.extend(small_orf_errors)

hxb2_found_orfs = [FoundORF(
o.name,
o.start,
o.end,
o.subtype_start,
o.subtype_end,
o.orientation,
o.distance,
str(o.protein),
str(o.aminoacids),
str(sequence[o.start:o.end].seq),
) for o in sorted(sequence_orfs + sequence_small_orfs, key=lambda o: o.start)]
try:
sequence_orfs, orf_errors = has_reading_frames(
aligned_sequence, False,
forward_orfs, error_bar)
sequence_errors.extend(orf_errors)

sequence_small_orfs, small_orf_errors = has_reading_frames(
aligned_sequence, True,
small_orfs, error_bar, reverse = False)
if include_small_orfs:
sequence_errors.extend(small_orf_errors)

hxb2_found_orfs = [FoundORF(
o.name,
o.start,
o.end,
o.subtype_start,
o.subtype_end,
o.orientation,
o.distance,
str(o.protein),
str(o.aminoacids),
str(sequence[o.start:o.end].seq),
) for o in sorted(sequence_orfs + sequence_small_orfs, key=lambda o: o.start)]

except Bio.Data.CodonTable.TranslationError as e:
log.error(e)
err = IntactnessError(sequence.id, INVALID_CODON, e.args[0])
sequence_errors.append(err)
hxb2_found_orfs = []

if include_packaging_signal:
missing_psi_locus = has_packaging_signal(alignment,
Expand Down

0 comments on commit 3f90930

Please sign in to comment.