Skip to content

Commit

Permalink
Merge pull request #38 from aineniamh/prior-to-reversion
Browse files Browse the repository at this point in the history
aa merge in
  • Loading branch information
aineniamh authored Apr 12, 2024
2 parents 2b61123 + 28d5426 commit 191b225
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 4 deletions.
2 changes: 1 addition & 1 deletion snipit/command.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ def main(sysargs = sys.argv[1:]):
else:
args = parser.parse_args(sysargs)

num_seqs,ref_input,record_ids,length = sfunks.qc_alignment(args.alignment,args.reference,args.cds_mode,cwd)
num_seqs,ref_input,record_ids,length = sfunks.qc_alignment(args.alignment,args.reference,args.cds_mode,args.sequence_type,cwd)


if args.reference:
Expand Down
16 changes: 13 additions & 3 deletions snipit/scripts/snp_functions.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,10 @@
import math
from itertools import groupby, count
from collections import OrderedDict
from enum import Enum
import warnings
warnings.filterwarnings('ignore')


# imports from other modules
from Bio import SeqIO
Expand All @@ -19,6 +23,7 @@
import matplotlib.patches as patches
from matplotlib.patches import Polygon


colour_list = ["lightgrey","white"]
colour_cycle = cycle(colour_list)
END_FORMATTING = '\033[0m'
Expand Down Expand Up @@ -58,7 +63,7 @@ def check_ref(recombi_mode):
sys.exit(-1)


def qc_alignment(alignment,reference,cds_mode,cwd):
def qc_alignment(alignment,reference,cds_mode,sequence_type,cwd):
lengths = []
lengths_info = []
num_seqs = 0
Expand Down Expand Up @@ -102,6 +107,8 @@ def qc_alignment(alignment,reference,cds_mode,cwd):
sys.stderr.write(red("Error: CDS mode flag used but alignment length not a multiple of 3.\n"))
sys.exit(-1)

print(green(f"Note:") + f" assuming the alignment provided is of type {sequence_type}. If this is not the case, change input --sequence-type")

return num_seqs,ref_input,record_ids,lengths[0]

def reference_qc(reference, record_ids,cwd):
Expand Down Expand Up @@ -261,10 +268,13 @@ def find_snps(reference_seq,input_seqs,show_indels):

return snp_dict,record_snps,len(var_counter)

def find_ambiguities(alignment,snp_dict):


def find_ambiguities(alignment, snp_dict,sequence_type):

if sequence_type == "nt":
amb = NT_AMBIG
if sequence_type == "aa":
amb = AA_AMBIG


snp_sites = collections.defaultdict(list)
Expand Down

0 comments on commit 191b225

Please sign in to comment.