def test_r2prof_default(self): """Tests that the default rate2site instantiation produces the right profile""" test = am.Rate4Site(self.filepath + os.sep + 'multiFasta.fasta') output = test.rate2profile(self.filepath + os.sep + 'multiFasta.res') self.assertTrue('Amino Acid' in output) self.assertTrue('Conservation Score' in output) self.assertEqual(2, len(output)) self.assertTrue(isinstance(output, biskit.ProfileCollection))
def test_r4s_close(self): """Tests to see that close deletes the correct files""" r4sobject = am.Rate4Site(self.filepath + os.sep + 'multiFasta.aln') r4sobject.run() self.assertTrue(os.path.isfile(os.getcwd() + os.sep + 'multiFasta.res')) r4sobject.close() self.assertFalse( os.path.isfile(os.getcwd() + os.sep + 'multiFasta.res')) self.assertFalse(os.path.isdir(os.getcwd() + os.sep + 'multiFasta'))
def test_r2prof(self): """tests that rate2profile correctly creates profile collections with the correct output""" test = am.Rate4Site(self.filepath + os.sep + 'multiFasta.fasta', qqint=True, std=True, gapped=True) output = test.rate2profile(self.filepath + os.sep + 'multiFasta.res') self.assertEqual(5, len(output)) self.assertTrue('Amino Acid' in output) self.assertTrue('Conservation Score' in output) self.assertTrue('Standard Deviation' in output) self.assertTrue('QQ interval' in output) self.assertTrue('Gapped' in output) self.assertTrue(isinstance(output, biskit.ProfileCollection))
def test_r2mat_g(self): """Tests that r2mat outputs the correct defaults for the dictionary""" test = am.Rate4Site(self.filepath + os.sep + 'multiFasta.fasta') output = test.rate2dict(self.filepath + os.sep + 'multiFasta.res') dictionary = { 0: ('A', 0.6979), 1: ('A', 0.6979), 2: ('C', 0.7026), 3: ('C', 0.7026), 4: ('G', 0.1769), 5: ('G', 0.1769), 6: ('T', -1.577), 7: ('T', -1.577) } self.assertDictEqual(dictionary, output)
def test_r2mat_multi(self): """Tests that the correct dictionary is output when some parameters are set""" test = am.Rate4Site(self.filepath + os.sep + 'multiFasta.fasta', score=True, qqint=True, gapped=True) output = test.rate2dict(self.filepath + os.sep + 'multiFasta.res') dictionary = { 0: ('A', 0.6979, (-1.946, 2.735), '3/3'), 1: ('A', 0.6979, (-1.946, 2.735), '3/3'), 2: ('C', 0.7026, (-1.946, 2.735), '3/3'), 3: ('C', 0.7026, (-1.946, 2.735), '3/3'), 4: ('G', 0.1769, (-2.332, 1.853), '3/3'), 5: ('G', 0.1769, (-2.332, 1.853), '3/3'), 6: ('T', -1.577, (-3.889, -0.7852), '3/3'), 7: ('T', -1.577, (-3.889, -0.7852), '3/3') } self.assertDictEqual(output, dictionary)
def test_r2mat_score(self): """Tests that correct dictionary is output when other parameters are set""" test = am.Rate4Site(self.filepath + os.sep + 'multiFasta.fasta', score=False, qqint=True, gapped=True, std=True) output = test.rate2dict(self.filepath + os.sep + 'multiFasta.res') dictionary = { 0: ('A', (-1.946, 2.735), 2.836, '3/3'), 1: ('A', (-1.946, 2.735), 2.836, '3/3'), 2: ('C', (-1.946, 2.735), 2.836, '3/3'), 3: ('C', (-1.946, 2.735), 2.836, '3/3'), 4: ('G', (-2.332, 1.853), 2.725, '3/3'), 5: ('G', (-2.332, 1.853), 2.725, '3/3'), 6: ('T', (-3.889, -0.7852), 2.309, '3/3'), 7: ('T', (-3.889, -0.7852), 2.309, '3/3') } self.assertDictEqual(output, dictionary)
def call_rate4site(self, msa): """ Calls Rate4Site to calculate various statistics of the amino acids in the input sequence Args: msa(str): The filepath to the file containing the msa Returns: The alpha parameter of the data """ conservation_score = aminoCons.Rate4Site(msa, profile=self.profile, cache=self.cache, identity=self.identity, score=self.score, qqint=self.qqint, gapped=self.gapped, std=self.std) self.scores = conservation_score.run() self.alpha = conservation_score.alpha conservation_score.close() return self.alpha