def test_save_multiple_phasePlot2(self): rseq2 = sequenceParameters.SequenceParameters( testTools.generate_random_sequence(minLen=20, maxLen=500)) plots.save_multiple_phasePlot2( [self.rseq, rseq2], 'tmpfiles/mult_PP', ['a', 'b'], 'TEST TITLE') plots.save_multiple_phasePlot2( [self.rseq, rseq2], 'tmpfiles/mult_PP_NO_LEGEND', ['a', 'b'], 'TEST TITLE', False) plots.save_multiple_phasePlot2([self.rseq, rseq2], 'tmpfiles/mult_PP_NO_LEGEND_xLim1.png', ['a', 'b'], title='TEST TITLE', legendOn=False, xLim=1) plots.save_multiple_phasePlot2([self.rseq, rseq2], 'tmpfiles/mult_PP_NO_LEGEND_xlim2.png', ['a', 'b'], title='TEST TITLE', legendOn=False, xLim=2) plots.save_multiple_phasePlot2([self.rseq, rseq2], 'tmpfiles/mult_PP_NO_LEGEND_xlim2_ylim2.png', ['a', 'b'], title='TEST TITLE', legendOn=False, xLim=2, yLim=2) plots.save_multiple_phasePlot2([self.rseq, rseq2], 'tmpfiles/mult_PP_NO_LEGEND_xlim2_ylim2_fs_20.png', ['a', 'b'], title='TEST TITLE', legendOn=False, xLim=2, yLim=2, fontSize=20) plots.save_multiple_phasePlot2([self.rseq, rseq2], 'tmpfiles/mult_PP_NO_LEGEND_xlim2_ylim2_fs_20.pdf', ['a', 'b'], title='TEST TITLE', legendOn=False, xLim=2, yLim=2, fontSize=20, saveFormat='pdf')
def test_save_multiple_phasePlot(self): rseq2 = sequenceParameters.SequenceParameters(testTools.generate_random_sequence(minLen=20, maxLen=500)) fp1 = self.rseq.get_fraction_positive() fn1 = self.rseq.get_fraction_negative() fp2 = rseq2.get_fraction_positive() fn2 = rseq2.get_fraction_negative() plots.save_multiple_phasePlot([fp1, fp2], [fn1, fn2], "tmpfiles/mult_PP", ["a", "b"], "TEST TITLE") plots.save_multiple_phasePlot( [fp1, fp2], [fn1, fn2], "tmpfiles/mult_PP_NO_LEGEND", ["a", "b"], title="TEST TITLE", legendOn=False ) plots.save_multiple_phasePlot( [fp1, fp2], [fn1, fn2], "tmpfiles/mult_PP_NO_LEGEND_xLim1", ["a", "b"], title="TEST TITLE", legendOn=False, xLim=1, ) plots.save_multiple_phasePlot( [fp1, fp2], [fn1, fn2], "tmpfiles/mult_PP_NO_LEGEND_xlim2", ["a", "b"], title="TEST TITLE", legendOn=False, xLim=2, ) plots.save_multiple_phasePlot( [fp1, fp2], [fn1, fn2], "tmpfiles/mult_PP_NO_LEGEND_xlim2_ylim2", ["a", "b"], title="TEST TITLE", legendOn=False, xLim=2, yLim=2, ) plots.save_multiple_phasePlot( [fp1, fp2], [fn1, fn2], "tmpfiles/mult_PP_NO_LEGEND_xlim2_ylim2_fs_20", ["a", "b"], title="TEST TITLE", legendOn=False, xLim=2, yLim=2, fontSize=20, )
def test_save_multiple_uverskyPlot(self): rseq2 = sequenceParameters.SequenceParameters(testTools.generate_random_sequence(minLen=20, maxLen=500)) hy1 = self.rseq.get_uversky_hydropathy() mnc1 = self.rseq.get_mean_net_charge() hy2 = rseq2.get_uversky_hydropathy() mnc2 = rseq2.get_mean_net_charge() plots.save_multiple_uverskyPlot([hy1, hy2], [mnc1, mnc2], "tmpfiles/mult_UV", ["a", "b"], "TEST TITLE") plots.save_multiple_uverskyPlot( [hy1, hy2], [mnc1, mnc2], "tmpfiles/mult_UV_NO_LEGEND", ["a", "b"], title="TEST TITLE", legendOn=False ) plots.save_multiple_uverskyPlot( [hy1, hy2], [mnc1, mnc2], "tmpfiles/mult_UV_NO_LEGEND_xLim1", ["a", "b"], title="TEST TITLE", legendOn=False, xLim=1, ) plots.save_multiple_uverskyPlot( [hy1, hy2], [mnc1, mnc2], "tmpfiles/mult_UV_NO_LEGEND_xlim2", ["a", "b"], title="TEST TITLE", legendOn=False, xLim=2, ) plots.save_multiple_uverskyPlot( [hy1, hy2], [mnc1, mnc2], "tmpfiles/mult_UV_NO_LEGEND_xlim2_ylim2", ["a", "b"], title="TEST TITLE", legendOn=False, xLim=2, yLim=2, ) plots.save_multiple_uverskyPlot( [hy1, hy2], [mnc1, mnc2], "tmpfiles/mult_UV_NO_LEGEND_xlim2_ylim2_fs_20", ["a", "b"], title="TEST TITLE", legendOn=False, xLim=2, yLim=2, fontSize=20, )
def test_get_reduced_alphabet_sequence_predefined_alphabets(self): for i in [2,3,4,5,6,8,10,11, 12,15,18,20]: # checks that a sequence with all 20 amino acids returns a reduced-alphabet sequence # made up of i-residues which contains exactly i residues! self.assertEqual(len(set(self.SP_60.get_reduced_alphabet_sequence(i)[0])),i) random_seqs = testTools.generate_random_sequence(10) for j in random_seqs: # build obj SP = SequenceParameters(j) # check reduced alphabet sequence length matches self.assertEqual(len(SP.get_reduced_alphabet_sequence(i)[0]), len(j))
def test_get_reduced_alphabet_sequence_predefined_alphabets(self): for i in [2, 3, 4, 5, 6, 8, 10, 11, 12, 15, 18, 20]: # checks that a sequence with all 20 amino acids returns a reduced-alphabet sequence # made up of i-residues which contains exactly i residues! self.assertEqual( len(set(self.SP_60.get_reduced_alphabet_sequence(i)[0])), i) random_seqs = testTools.generate_random_sequence(10) for j in random_seqs: # build obj SP = SequenceParameters(j) # check reduced alphabet sequence length matches self.assertEqual(len(SP.get_reduced_alphabet_sequence(i)[0]), len(j))
def test_save_multiple_phasePlot2(self): rseq2 = sequenceParameters.SequenceParameters(testTools.generate_random_sequence(minLen=20, maxLen=500)) plots.save_multiple_phasePlot2([self.rseq, rseq2], "tmpfiles/mult_PP", ["a", "b"], "TEST TITLE") plots.save_multiple_phasePlot2( [self.rseq, rseq2], "tmpfiles/mult_PP_NO_LEGEND", ["a", "b"], "TEST TITLE", False ) plots.save_multiple_phasePlot2( [self.rseq, rseq2], "tmpfiles/mult_PP_NO_LEGEND_xLim1", ["a", "b"], title="TEST TITLE", legendOn=False, xLim=1, ) plots.save_multiple_phasePlot2( [self.rseq, rseq2], "tmpfiles/mult_PP_NO_LEGEND_xlim2", ["a", "b"], title="TEST TITLE", legendOn=False, xLim=2, ) plots.save_multiple_phasePlot2( [self.rseq, rseq2], "tmpfiles/mult_PP_NO_LEGEND_xlim2_ylim2", ["a", "b"], title="TEST TITLE", legendOn=False, xLim=2, yLim=2, ) plots.save_multiple_phasePlot2( [self.rseq, rseq2], "tmpfiles/mult_PP_NO_LEGEND_xlim2_ylim2_fs_20", ["a", "b"], title="TEST TITLE", legendOn=False, xLim=2, yLim=2, fontSize=20, )
def setUp(self): self.rseq = sequenceParameters.SequenceParameters(testTools.generate_random_sequence(minLen=20, maxLen=500))
def test_save_multiple_phasePlot(self): rseq2 = sequenceParameters.SequenceParameters( testTools.generate_random_sequence(minLen=20, maxLen=500)) fp1 = self.rseq.get_fraction_positive() fn1 = self.rseq.get_fraction_negative() fp2 = rseq2.get_fraction_positive() fn2 = rseq2.get_fraction_negative() plots.save_multiple_phasePlot( [fp1, fp2], [fn1, fn2], 'tmpfiles/mult_PP', ['a', 'b'], 'TEST TITLE') plots.save_multiple_phasePlot([fp1, fp2], [fn1, fn2], 'tmpfiles/mult_PP_NO_LEGEND.png', ['a', 'b'], title='TEST TITLE', legendOn=False) plots.save_multiple_phasePlot([fp1, fp2], [fn1, fn2], 'tmpfiles/mult_PP_NO_LEGEND_xLim1.png', ['a', 'b'], title='TEST TITLE', legendOn=False, xLim=1) plots.save_multiple_phasePlot([fp1, fp2], [fn1, fn2], 'tmpfiles/mult_PP_NO_LEGEND_xlim2.png', ['a', 'b'], title='TEST TITLE', legendOn=False, xLim=2) plots.save_multiple_phasePlot([fp1, fp2], [fn1, fn2], 'tmpfiles/mult_PP_NO_LEGEND_xlim2_ylim2.png', ['a', 'b'], title='TEST TITLE', legendOn=False, xLim=2, yLim=2) plots.save_multiple_phasePlot([fp1, fp2], [fn1, fn2], 'tmpfiles/mult_PP_NO_LEGEND_xlim2_ylim2_fs_20.png', ['a', 'b'], title='TEST TITLE', legendOn=False, xLim=2, yLim=2, fontSize=20) plots.save_multiple_phasePlot([fp1, fp2], [fn1, fn2], 'tmpfiles/mult_PP_NO_LEGEND_xlim2_ylim2_fs_20.pdf', ['a', 'b'], title='TEST TITLE', legendOn=False, xLim=2, yLim=2, fontSize=20, saveFormat='pdf')
def setUp(self): self.rseq = sequenceParameters.SequenceParameters( testTools.generate_random_sequence(minLen=20, maxLen=500))
def test_save_multiple_uverskyPlot2(self): rseq2 = sequenceParameters.SequenceParameters( testTools.generate_random_sequence(minLen=20, maxLen=500)) hy1 = self.rseq.get_uversky_hydropathy() mnc1 = self.rseq.get_mean_net_charge() hy2 = rseq2.get_uversky_hydropathy() mnc2 = rseq2.get_mean_net_charge() plots.save_multiple_uverskyPlot2( [self.rseq, rseq2], 'tmpfiles/mult_UV.png', ['a', 'b'], 'TEST TITLE') plots.save_multiple_uverskyPlot2([self.rseq, rseq2], 'tmpfiles/mult_UV2_NO_LEGEND.png', ['a', 'b'], title='TEST TITLE', legendOn=False) plots.save_multiple_uverskyPlot2([self.rseq, rseq2], 'tmpfiles/mult_UV2_NO_LEGEND_xLim1.png', ['a', 'b'], title='TEST TITLE', legendOn=False, xLim=1) plots.save_multiple_uverskyPlot2([self.rseq, rseq2], 'tmpfiles/mult_UV2_NO_LEGEND_xlim2.png', ['a', 'b'], title='TEST TITLE', legendOn=False, xLim=2) plots.save_multiple_uverskyPlot2([self.rseq, rseq2], 'tmpfiles/mult_UV2_NO_LEGEND_xlim2_ylim2.png', ['a', 'b'], title='TEST TITLE', legendOn=False, xLim=2, yLim=2) plots.save_multiple_uverskyPlot2([self.rseq, rseq2], 'tmpfiles/mult_UV2_NO_LEGEND_xlim2_ylim2_fs_20.png', ['a', 'b'], title='TEST TITLE', legendOn=False, xLim=2, yLim=2, fontSize=20) plots.save_multiple_uverskyPlot2([self.rseq, rseq2], 'tmpfiles/mult_UV2_NO_LEGEND_xlim2_ylim2_fs_20.pdf', ['a', 'b'], title='TEST TITLE', legendOn=False, xLim=2, yLim=2, fontSize=20, saveFormat='pdf')