Beispiel #1
0
 def test_exe_mafft(self):
     """Tests that the Mafft executor module calls mafft"""
     extra_aln = am.MAFFT(self.filepath + os.sep + 'multiFasta.fasta')
     aln_path = extra_aln.run()
     self.assertTrue(os.path.exists(aln_path))
     am.clean_alignment(aln_path, cache=False)
     self.assertFalse(os.path.exists(aln_path))
Beispiel #2
0
    def pipe(self):
        """
        Queries the OMA database, Mafft and Rate4Site in sequence to get the
        Returns:
            A dictionary containing the various statistical scores mapped to each amino acid, depending
            on which inputs were selected.
        """
        old_dir = os.getcwd()
        directory = old_dir + os.sep + 'Sequence_Alignments'
        if not os.path.isdir(directory):
            os.makedirs(directory)
        os.chdir(directory)

        msa = directory + os.sep + '%s.aln' % (self.name)
        if os.path.isfile(msa):
            aln = msa
            self.call_rate4site(aln)
        else:
            orth = self.call_orthologs()
            aln = self.call_alignment(orth)
            self.call_rate4site(aln)
            os.remove(os.getcwd() + os.sep + "%s.orth" % (self.name))

        aminoCons.clean_alignment(aln, self.cache)
        os.chdir(old_dir)
        if not self.cache and not os.listdir(directory):
            os.rmdir(directory)
        return self.scores
Beispiel #3
0
 def test_clean_alignment(self):
     """Tests to see that alignment file and the folder created are deleted
     after calling clean argument"""
     extra_aln = am.build_alignment(self.filepath + os.sep +
                                    'multiFasta.fasta')
     self.assertTrue(os.path.exists(extra_aln))
     am.clean_alignment(extra_aln, cache=False)
     self.assertFalse(os.path.exists(extra_aln))
Beispiel #4
0
 def test_call_alignment(self, mock_aln):
     """tests that call_alignment calls the correct methods and generates the correct output"""
     mock_aln.return_value = self.filepath + os.sep + 'multiFasta.aln'
     tester = self.CDC48A.call_alignment(self.filepath + os.sep +
                                         'multiFasta.fasta')
     self.assertTrue(mock_aln.called)
     self.assertTrue(os.path.isfile(tester))
     self.assertTrue('multiFasta.aln' in tester)
     am.clean_alignment(tester, cache=False)
Beispiel #5
0
 def tearDownClass(cls):
     am.clean_alignment(os.getcwd() + os.sep + 'multiFasta.aln',
                        cache=False)