Exemplo n.º 1
0
 def test_sequence_alignment_instantiation(self):
     test_align = biostructmap.SequenceAlignment(self.test_align)
     self.assertTrue(isinstance(test_align.alignment,
                                Bio.Align.MultipleSeqAlignment))
     for i, seq in enumerate(test_align):
         #Test iteration
         self.assertTrue(isinstance(seq, Bio.SeqRecord.SeqRecord))
         #test _getitem__ method work to return a model object
         self.assertTrue(isinstance(test_align[i], Bio.SeqRecord.SeqRecord))
Exemplo n.º 2
0
 def test_tajimas_d_on_sequence_alignment(self):
     test_align = biostructmap.SequenceAlignment('./tests/msa/MSA_test.fsa')
     #Test basic calculation of Tajima's D
     taj_d = test_align.tajimas_d()
     self.assertEqual(taj_d, -1.553110875316991)
     #Test for errors in input to the function
     with self.assertRaises(TypeError):
         test_align.tajimas_d(3.5,5)
     with self.assertRaises(TypeError):
         test_align.tajimas_d(3,5.5)
Exemplo n.º 3
0
 def test_tajimas_d_on_structure_with_subset_of_reference_residues(self):
     #test_sequence_alignment = AlignIO.read('./tests/msa/msa_test_86-104', 'fasta')
     test_sequence_alignment = {('A',): biostructmap.SequenceAlignment(
         './tests/msa/msa_test_86-104', 'fasta')}
     test_ref_dict = {('A', (' ', x+86, ' ')): ('A', (x*3 + 1, x*3 + 2, x*3 + 3)) for
                      x in range(18)}
     test_surrounding_residues = [('A', (' ', x, ' ')) for x in range(86, 96)]
     result = _tajimas_d(self.test_structure, test_sequence_alignment,
                         test_surrounding_residues, test_ref_dict)
     self.assertEqual(result, -0.709896167879475)
Exemplo n.º 4
0
 def test_tajimas_d_on_structure(self):
     #test_sequence_alignment = AlignIO.read('./tests/msa/msa_test_86-104', 'fasta')
     test_sequence_alignment = {('A',): biostructmap.SequenceAlignment(
         './tests/msa/msa_test_86-104', 'fasta')}
     test_ref_dict = {('A', (' ', x+86, ' ')): ('A', (x*3+1, x*3 + 2, x*3 + 3)) for
                      x in range(0, 18)}
     test_surrounding_residues = [('A', (' ', x, ' ')) for x in range(86, 104)]
     result = _tajimas_d(self.test_structure, test_sequence_alignment,
                         test_surrounding_residues, test_ref_dict)
     self.assertEqual(result, -0.7801229937910628)
Exemplo n.º 5
0
 def setUp(self):
     self.test_file = './tests/pdb/1zrl.pdb'
     self.structure = biostructmap.Structure(self.test_file)
     self.test_align = './tests/msa/protein_MSA_1zrl.fsa'
     self.msa = biostructmap.SequenceAlignment(self.test_align)
     ref_seq = ('MKCNISIYFFASFFVLYFAKARNEYDIKENEKFLDVYKEKFNELDKKKYGNVQKTDKKIFTFIENKLDILNNSKFNKRWK'
                'SYGTPDNIDKNMSLINKHNNEEMFNNNYQSFLSTSSLIKQNKYVPINAVRVSRILSFLDSRINNGRNTSSNNEVLSNCRE'
                'KRKGMKWDCKKKNDRSNYVCIPDRRIQLCIVNLSIIKTYTKETMKDHFIEASKKESQLLLKKNDNKYNSKFCNDLKNSFL'
                'DYGHLAMGNDMDFGGYSTKAENKIQEVFKGAHGEISEHKIKNFRKKWWNEFREKLWEAMLSEHKNNINNCKNIPQEELQI'
                'TQWIKEWHGEFLLERDNRSKLPKSKCKNNTLYEACEKECIDPCMKYRDWIIRSKFEWHTLSKEYETQKVPKENAENYLIK'
                'ISENKNDAKVSLLLNNCDAEYSKYCDCKHTTTLVKSVLNGNDNTIKEKREHIDLDDFSKFGCDKNSVDTNTKVWECKKPY'
                'KLSTKDVCVPPRRQELCLGNIDRIYDKNLLMIKEHILAIAIYESRILKRKYKNKDDKEVCKIINKTFADIRDIIGGTDYW'
                'NDLSNRKLVGKINTNSNYVHRNKQNDKLFRDEWWKVIKKDVWNVISWVFKDKTVCKEDDIENIPQFFRWFSEWGDDYCQD'
                'KTKMIETLKVECKEKPCEDDNCKRKCNSYKEWISKKKEEYNKQAKQYQEYQKGNNYKMYSEFKSIKPEVYLKKYSEKCSN'
                'LNFEDEFKEELHSDYKNKCTMCPEVKDVPISIIRNNEQTS')
     self.reference_seqs = {'A': ref_seq}
Exemplo n.º 6
0
 def test_tajimas_d_on_long_sequence(self):
     test_align = biostructmap.SequenceAlignment('./tests/msa/MSA_test_long.fsa')
     taj_d = test_align.tajimas_d()
     self.assertEqual(taj_d, 0.33458440732186856)
Exemplo n.º 7
0
 def setUp(self):
     self.test_file = './tests/msa/MSA_test.fsa'
     self.alignment = AlignIO.read(self.test_file, 'fasta')
     self.biostructmap_alignment = biostructmap.SequenceAlignment('./tests/msa/MSA_test.fsa')
     self.varsites = seqtools._var_site(self.alignment)