diff --git a/intact/intact.py b/intact/intact.py index 96bdbd8..bd515b5 100644 --- a/intact/intact.py +++ b/intact/intact.py @@ -30,7 +30,6 @@ SCRAMBLE_ERROR = "Scramble" NONHIV_ERROR = "NonHIV" INTERNALINVERSION_ERROR = "InternalInversion" -ALIGNMENT_FAILED = "AlignmentFailed" # Happens when mafft process fails UNKNOWN_NUCLEOTIDE = "UnknownNucleotide" # Happens when there is an invalid codon anywhere in a sequence FRAMESHIFTINORF_ERROR = "FrameshiftInOrf" @@ -879,15 +878,7 @@ def analyse_single_sequence(holistic, sequence, blast_rows): blast_it = blast_iterate_inf(subtype, input_file, working_dir) if check_internal_inversion or check_nonhiv or check_scramble or 1 < len(subtype_choices) else iterate_empty_lists() for (sequence, blast_rows) in with_blast_rows(blast_it, iterate_sequences(input_file)): holistic = HolisticInfo() - - try: - is_intact, hxb2_found_orfs, sequence_errors = analyse_single_sequence(holistic, sequence, blast_rows) - except wrappers.AlignmentFailure: - err = IntactnessError(sequence.id, ALIGNMENT_FAILED, "Alignment failed for this sequence. It probably contains invalid symbols.") - is_intact = False - hxb2_found_orfs = [] - sequence_errors = [err] - + is_intact, hxb2_found_orfs, sequence_errors = analyse_single_sequence(holistic, sequence, blast_rows) orfs = [x.__dict__ for x in hxb2_found_orfs] errors = [x.__dict__ for x in sequence_errors] holistic = holistic.__dict__ diff --git a/util/wrappers.py b/util/wrappers.py index 1000902..f31f4a7 100644 --- a/util/wrappers.py +++ b/util/wrappers.py @@ -6,9 +6,6 @@ from util.blastrow import BlastRow -class AlignmentFailure(Exception): - pass - def mafft(sequences): ''' Call mafft on a set of sequences and return the resulting alignment. @@ -22,12 +19,7 @@ def mafft(sequences): with tempfile.NamedTemporaryFile() as alignment_input, tempfile.NamedTemporaryFile() as alignment_output: SeqIO.write(sequences, alignment_input.name, "fasta") - - try: - subprocess.run(["mafft", "--quiet", alignment_input.name], shell=False, stdout=alignment_output, check=True) - except subprocess.CalledProcessError: - raise AlignmentFailure() - + subprocess.run(["mafft", "--quiet", alignment_input.name], shell=False, stdout=alignment_output, check=True) alignment = AlignIO.read(alignment_output.name, "fasta") return alignment