Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 8 additions & 6 deletions VariantValidator/modules/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -485,7 +485,7 @@ def pro_delins_info(prot_ref_seq, prot_var_seq, in_frame=False):
return info


def translate(ed_seq, cds_start, modified_aa=None, tolerate_no_stop_cds=False, polyadenylate=False):
def translate(ed_seq, cds_start, modified_aa=None, tolerate_no_stop_cds=False):
"""
Translate c. reference sequences, including those that have been modified
must have the CDS in the specified position
Expand All @@ -512,10 +512,6 @@ def translate(ed_seq, cds_start, modified_aa=None, tolerate_no_stop_cds=False, p
use_dict = PROT_TRANSLATION_DICT
stops = ['TAA', 'TAG', 'TGA']

# Add Polyadenylation stop codon completing bases to relevant transcripts
if polyadenylate is True:
coding_sequence = f"{coding_sequence}A"

# Translate
if len(coding_sequence) % 3:
last_codon_end = int(len(coding_sequence)/3) * 3
Expand All @@ -529,7 +525,13 @@ def translate(ed_seq, cds_start, modified_aa=None, tolerate_no_stop_cds=False, p
break
if translation[-1] != '*':
if not tolerate_no_stop_cds:
raise IndexError('No stop CDS')
# Add Polyadenylation stop codon completing bases to relevant
# transcripts
spare_end = len(coding_sequence) % 3
if spare_end and coding_sequence[-spare_end:] in ['T','TA']:
translation.append('*')
else:
raise IndexError('No stop CDS')
translation.append('X')

return "".join(translation)
Expand Down
16 changes: 4 additions & 12 deletions VariantValidator/modules/vvMixinInit.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
import vvhgvs.normalizer
from vvhgvs.location import AAPosition, Interval
from vvhgvs.edit import AARefAlt, AAExt, Dup
from vvhgvs.utils import unusual_transcripts
from Bio.Seq import Seq

import re
Expand Down Expand Up @@ -460,23 +459,16 @@ def _remake_unc(prot,nucleotide_not_equal=False):
else:
modified_aa = None

# Add Polyadenylation stop codon completing bases to relevant transcripts
require_A = unusual_transcripts.polyadnylate()
if hgvs_transcript.ac in require_A:
polyadenylate = True
else:
polyadenylate = False

# Translate the reference and variant proteins
try:
prot_ref_seq = utils.translate(ref_seq, cds_start, modified_aa, polyadenylate=polyadenylate)
prot_ref_seq = utils.translate(ref_seq, cds_start, modified_aa)
except IndexError:
import traceback
traceback.print_exc()
hgvs_transcript_to_hgvs_protein['error'] = \
'ProteinTranslationError: Cannot generate a protein without an identifiable in-' +\
'frame Termination codon in the reference mRNA sequence, this transcript may be ' +\
'subject to non-sense mediated decay'
'subject to non-stop mediated decay'
hgvs_transcript_to_hgvs_protein['hgvs_protein'] = _tot_unc(associated_protein_accession)
return hgvs_transcript_to_hgvs_protein
except KeyError:
Expand All @@ -491,12 +483,12 @@ def _remake_unc(prot,nucleotide_not_equal=False):


try:
prot_var_seq = utils.translate(var_seq, cds_start, modified_aa, polyadenylate=polyadenylate)
prot_var_seq = utils.translate(var_seq, cds_start, modified_aa)
except IndexError:
hgvs_transcript_to_hgvs_protein['error'] = \
'ProteinTranslationError: Cannot generate a protein without an identifiable in-' +\
'frame Termination codon in the variant mRNA sequence, this transcript may be ' +\
'subject to nonstop decay'
'subject to non-stop decay'
hgvs_protein = _tot_unc(associated_protein_accession)
hgvs_transcript_to_hgvs_protein['hgvs_protein'] = hgvs_protein
return hgvs_transcript_to_hgvs_protein
Expand Down
4 changes: 4 additions & 0 deletions batch/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# Ignore all files and subdirectories
*
# But make an exception for just this .gitignore file
!.gitignore
35 changes: 0 additions & 35 deletions batch/input.txt

This file was deleted.

Loading