示例#1
0
    def test_cmbuild_from_alignment(self):
        """cmbuild_from_alignment should work as expected.
        """
        #Test unaligned seqs and unaligned struct fail.
        #DataError should be raised with Alignment is constructed
        self.assertRaises(DataError,cmbuild_from_alignment,\
            self.seqs1_unaligned,self.struct1_unaligned_string)

        #Test aligned seqs and unaligned struct fail.
        self.assertRaises(ValueError,cmbuild_from_alignment,\
            self.seqs2_aligned,self.struct1_unaligned_string)

        #Test get cm back without alignment.
        cm_res = cmbuild_from_alignment(self.seqs2_aligned,\
            self.struct2_aligned_string)
        cm_lines = cm_res.split('\n')
        ALN1_CM_lines = ALN1_CM.split('\n')
        #Check that the same number of lines are in both CMs
        self.assertEqual(len(cm_lines),len(ALN1_CM_lines))

        #The first 13 lines are unique to the specific run.  The res of the
        # CM should be the same, since built from the same data.
        self.assertEqual(cm_lines[13:],ALN1_CM_lines[13:])

        #Make sure same alignment is returned if return_alignment=True
        cm_res, cm_aln = cmbuild_from_alignment(self.seqs2_aligned,\
            self.struct2_aligned_string,return_alignment=True)
        self.assertEqual(cm_aln,self.lines2)
示例#2
0
    def test_cmbuild_from_file(self):
        """cmbuild_from_file should work as expected.
        """
        cm_res = cmbuild_from_file(self.temp_dir+'/seqs1.sto')
        cm_lines = cm_res.split('\n')
        ALN1_CM_lines = ALN1_CM.split('\n')
        #Check that the same number of lines are in both CMs
        self.assertEqual(len(cm_lines),len(ALN1_CM_lines))

        #The first 13 lines are unique to the specific run.  The res of the
        # CM should be the same, since built from the same data.
        self.assertEqual(cm_lines[13:],ALN1_CM_lines[13:])

        #Make sure same alignment is returned if return_alignment=True
        cm_res, cm_aln = cmbuild_from_alignment(self.seqs2_aligned,\
            self.struct2_aligned_string,return_alignment=True)
        self.assertEqual(cm_aln,self.lines2)