Example #1
0
import re, regex
import logging
import GeneaPy.useful as useful
import get_AB1_file

# draw a map or mind map which visually shows how all this works. Perhaps read the OOP book to ensure best practices are adhered to.

# Perhaps have a function within this file which takes much of the actual basecalling out of the get_seq script (lines 187-214). life_saver()

# PLAYING WITH ACTUAL STRING: match_with_seq_file(), check_if_insertion(), check_if_deletion()

# HET CALLS: the rest

file_path = useful.cwd_file_path(__file__)

UIPAC = {"A":"A", "C":"C", "G":"G", "T":"T",
         "R":"A/G", "Y":"C/T", "S":"G/C",
         "W":"A/T", "K":"G/T", "M":"A/C",
         "B":"C/G/T", "D":"A/G/T", "H":"A/C/T",
         "V":"A/C/G", "N":"N"}

non_singular_bases = ["Y", "R", "W", "S", "K", "M"]



class CompareSeqs(object):
    ''' A collection of methods used to compare a reference sequence 
        with a sanger sequence contained within a .seq file
    '''
    def __init__(self, upstream, downstream, ref_base=None,  alt_answer=None,
                 mut_type=None, path_to_seq_file=None, seq_dir=None, 
Example #2
0
from GeneaPy.check_sanger import *
from GeneaPy import useful
import unittest, warnings


test_dir = useful.cwd_file_path(__file__) + "test_files/"


class TestCheckSanger(unittest.TestCase):
    def test_get_matching_seq_file(self):
        """ Ensure the query matches the expected file in he selected dir
        """
        self.assertEqual(
            CompareSeqs.get_matching_seq_file("24HC1541-WYN1", test_dir)[0], test_dir + "F07_24HC1541_WYN1_011.ab1"
        )

    def test_compare_nucleotides(self):
        """ Test both conditional outputs of the compare_nucleotides method
        """
        self.assertEqual(CompareSeqs.compare_nucleotides("A", "G"), ("the nucleotides given are DIFFERENT", 2))
        self.assertEqual(CompareSeqs.compare_nucleotides("C", "C"), ("the nucleotides given are the SAME", 1))

    def test_get_start_end_indexes_postseq(self):
        """ Test that the preseq returns the expected index numbers 
        """
        warnings.filterwarnings("ignore")
        self.assertEqual(
            CompareSeqs.get_start_end_indexes(
                "TTCCTCCTTCAAACTTCGCA",
                CompareSeqs.handle_seq_file(test_dir + "F01_LX18_SP_UKB2_LX18_F_011.ab1", test_dir),
            ),