diff --git a/intact/intact.py b/intact/intact.py index 98b954d..a103f26 100644 --- a/intact/intact.py +++ b/intact/intact.py @@ -45,9 +45,9 @@ def __init__(self, name, start, end, deletion_tolerence): self.end = end self.deletion_tolerence = deletion_tolerence - def subtyped(working_dir, subtype, name, start, end, deletion_tolerence): - start_s = st.convert_from_hxb2_to_subtype(working_dir, start, subtype) - end_s = st.convert_from_hxb2_to_subtype(working_dir, end, subtype) + def subtyped(subtype, name, start, end, deletion_tolerence): + start_s = st.convert_from_hxb2_to_subtype(start, subtype) + end_s = st.convert_from_hxb2_to_subtype(end, subtype) return ExpectedORF(name, start_s, end_s, deletion_tolerence) class ReceivedORF: @@ -618,15 +618,15 @@ def intact( working_dir, # convert ORF positions to appropriate subtype forward_orfs, reverse_orfs, small_orfs = [ [ - ExpectedORF.subtyped(working_dir, subtype, n, s, e, delta) \ + ExpectedORF.subtyped(subtype, n, s, e, delta) \ for (n, s, e, delta) in orfs ] \ for orfs in [hxb2_forward_orfs, hxb2_reverse_orfs, hxb2_small_orfs] ] # convert PSI locus and RRE locus to appropriate subtype - psi_locus = [st.convert_from_hxb2_to_subtype(working_dir, x, subtype) for x in hxb2_psi_locus] - rre_locus = [st.convert_from_hxb2_to_subtype(working_dir, x, subtype) for x in hxb2_rre_locus] + psi_locus = [st.convert_from_hxb2_to_subtype(x, subtype) for x in hxb2_psi_locus] + rre_locus = [st.convert_from_hxb2_to_subtype(x, subtype) for x in hxb2_rre_locus] reference = st.subtype_sequence(subtype) @@ -641,8 +641,8 @@ def intact( working_dir, ) - alignment = wrappers.mafft(working_dir, [reference, sequence]) - reverse_alignment = wrappers.mafft(working_dir, [reference, reverse_sequence]) + alignment = wrappers.mafft([reference, sequence]) + reverse_alignment = wrappers.mafft([reference, reverse_sequence]) forward_score = alignment_score(alignment) reverse_score = alignment_score(reverse_alignment) @@ -666,8 +666,8 @@ def intact( working_dir, hxb2_found_orfs = [ORF( o.orientation, - st.convert_from_subtype_to_hxb2(working_dir, o.start, o.orientation, subtype), - st.convert_from_subtype_to_hxb2(working_dir, o.end, o.orientation, subtype) + st.convert_from_subtype_to_hxb2(o.start, o.orientation, subtype), + st.convert_from_subtype_to_hxb2(o.end, o.orientation, subtype) ) for o in sequence_orfs] if include_packaging_signal: @@ -687,8 +687,8 @@ def intact( working_dir, if check_major_splice_donor_site: mutated_splice_donor_site = has_mutated_major_splice_donor_site(alignment, - st.convert_from_hxb2_to_subtype(working_dir, hxb2_msd_site_locus, subtype), - st.convert_from_hxb2_to_subtype(working_dir, hxb2_msd_site_locus + 1, subtype), + st.convert_from_hxb2_to_subtype(hxb2_msd_site_locus, subtype), + st.convert_from_hxb2_to_subtype(hxb2_msd_site_locus + 1, subtype), const.DEFAULT_MSD_SEQUENCE) if mutated_splice_donor_site is not None: sequence_errors.append(mutated_splice_donor_site) diff --git a/util/subtypes.py b/util/subtypes.py index 41ed487..b900717 100644 --- a/util/subtypes.py +++ b/util/subtypes.py @@ -42,19 +42,18 @@ def subtype_sequence(subtype): name = alignment[0].name ) -def convert_from_hxb2_to_subtype(working_dir, position, subtype): +def convert_from_hxb2_to_subtype(position, subtype): """ Convert a position number in HXB2 to the equivalent in another subtype. Args: - working_dir: working folder in which to place temporary files position: hxb2 coordinate position to convert subtype: subtype position to convert to """ sequences = [HXB2(), subtype_sequence(subtype)] - alignment = wrappers.mafft(working_dir, sequences) + alignment = wrappers.mafft(sequences) hxb2_pos = 0 subtype_pos = 0 @@ -66,12 +65,11 @@ def convert_from_hxb2_to_subtype(working_dir, position, subtype): if alignment[1][i] != "-": subtype_pos += 1 -def convert_from_subtype_to_hxb2(working_dir, position, orientation, subtype): +def convert_from_subtype_to_hxb2(position, orientation, subtype): """ Convert a position number in HXB2 to the equivalent in another subtype. Args: - working_dir: working folder in which to place temporary files position: hxb2 coordinate position to convert subtype: subtype position to convert to """ @@ -81,7 +79,7 @@ def convert_from_subtype_to_hxb2(working_dir, position, orientation, subtype): sequences = [SeqRecord.SeqRecord(Seq.reverse_complement(s.seq), id = s.id, name = s.name) for s in sequences] - alignment = wrappers.mafft(working_dir, sequences) + alignment = wrappers.mafft(sequences) hxb2_pos = 0 subtype_pos = 0 diff --git a/util/wrappers.py b/util/wrappers.py index 22fdc11..60def56 100644 --- a/util/wrappers.py +++ b/util/wrappers.py @@ -5,7 +5,7 @@ from Bio import SeqIO, AlignIO -def mafft(working_dir, sequences): +def mafft(sequences): ''' Call mafft on a set of sequences and return the resulting alignment.