Skip to content

Commit

Permalink
Adding --subset WT AA sequence
Browse files Browse the repository at this point in the history
  • Loading branch information
skchronicles committed Aug 9, 2021
1 parent dc96727 commit 73876e1
Showing 1 changed file with 22 additions and 18 deletions.
40 changes: 22 additions & 18 deletions aasap
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ import sys, os, subprocess
import argparse, textwrap

__author__ = 'Skyler Kuhn'
__version__ = 'v1.1.0'
__version__ = 'v1.2.0'
__email__ = '[email protected]'


Expand Down Expand Up @@ -160,7 +160,7 @@ def run(sub_args):
err('Writing output file {}'.format(output_file))
with open(output_file, 'w') as ofh:
# Write header to output file
ofh.write("{}\t{}\t{}\t{}\t{}\t{}\t{}\t{}\t{}\t{}\n".format(
ofh.write("{}\t{}\t{}\t{}\t{}\t{}\t{}\t{}\t{}\t{}\t{}\n".format(
"Variant_Classification",
"Hugo_Symbol",
"Transcript_ID",
Expand All @@ -170,6 +170,7 @@ def run(sub_args):
"Mutated_Transcript_Sequence",
"WT_AA_Sequence",
"Mutated_AA_Sequence",
"WT_Subset_AA_Sequence",
"Mutated_Subset_AA_Sequence"))

# Mutate each recorded variant in the input file.
Expand Down Expand Up @@ -227,24 +228,27 @@ def run(sub_args):
# amino acid coordinate system.
aa_variant_position = convert_aa_cooridate(variant_position)
if variant_class.lower().startswith('frame_shift'):
# In the Subset_AA_sequence representation of
# the mutated amino acid seuqnce, the downstream
# portion of frameshift mutations are reported
# until one of the following conditions are met:
# the end of the mutated, coding AA sequence is
# reached, OR until the first terminating stop
# codon is reached.
truncated_aa = truncate(mutated_amino_acid, aa_variant_position, subset)
# In the Subset_AA_sequence representation of
# the mutated and wt amino acid sequence, the
# downstream portion of frameshift mutations
# are reported until one of the following
# conditions are met: the end of the coding
# sequence is reached, OR until the first
# terminating stop codon is reached.
truncated_wt_aa = truncate(wt_amino_acid, aa_variant_position, subset)
truncated_mutated_aa = truncate(mutated_amino_acid, aa_variant_position, subset)
else:
# In the Subset_AA_sequence representation of
# the mutated amino acid seuqnce, the upstream and
# downstream portion of non-frame shift mutations are
# +/- N amino acids of the mutation start site. This
# vairable is adjustable via the --subset cli option.
truncated_aa = truncate(mutated_amino_acid, aa_variant_position, subset, subset)
# In the Subset_AA_sequence representation of
# the wt and mutated amino acid sequence, the
# upstream and downstream portion of non-frame
# shift mutations are +/- N amino acids of the
# mutation start site. This vairable is adjustable
# via the --subset cli option.
truncated_wt_aa = truncate(wt_amino_acid, aa_variant_position, subset, subset)
truncated_mutated_aa = truncate(mutated_amino_acid, aa_variant_position, subset, subset)
# Write results to output file
ofh.write("{}\t{}\t{}\t{}\t{}\t{}\t{}\t{}\t{}\t{}\n".format(variant_class, hugo, transcript, hgvs, variant_position,
sequence, mutated_dna, wt_amino_acid, mutated_amino_acid, truncated_aa))
ofh.write("{}\t{}\t{}\t{}\t{}\t{}\t{}\t{}\t{}\t{}\t{}\n".format(variant_class, hugo, transcript, hgvs, variant_position,
sequence, mutated_dna, wt_amino_acid, mutated_amino_acid, truncated_wt_aa, truncated_mutated_aa))
except NonCodingVariantError as e:
err("WARNING: Skipping over non-coding DNA HGVS variant '{}' reported in {}!".format(hgvs, transcript))
except UnsupportedVariantTypeError as e:
Expand Down

0 comments on commit 73876e1

Please sign in to comment.