Beispiel #1
0
 def setUp(self):
     lysozyme = ("MKALIVLGLVLLSVTVQGKVFERCELARTLKRLGMDGYRGISLANWMCLAKWESGY"
                 "NTRATNYNAGDRSTDYGIFQINSRYWCNDGKTPGAVNACHLSCSALLQDNIADAVAC"
                 "AKRVVRDPQGIRAWVAWRNRCQNRDVRQYVQGCGV")
     self.lyz = oma.OrthologFinder(lysozyme)
     stragg = ('YYYYYYYYYYYVVVVVVVVVVVVBBBBBBBBBBBAAAAAAAAAAANNNNNNNNNNN'
               'MMMMMMMMMMMWWWWWWWWWWWWWCCCCCCCCCCSSSSSSSSSS')
     self.aggregate = oma.OrthologFinder(stragg)
Beispiel #2
0
 def test_empty_input_HOG(self):
     """Checks that the correct exception is raised when an empty sequence is entered"""
     fs = oma.OrthologFinder("")
     with self.assertRaises(oma.SequenceError) as cm:
         fs.get_HOGs()
     err = cm.exception
     self.assertEqual(str(err), 'Input sequence is empty!')
Beispiel #3
0
    def setUpClass(cls):
        cls.filepath = tools.testRoot() + "consScore"

        with open((cls.filepath + os.sep + 'CDC48Aseq.txt'), 'r') as file:
            arabidopsisCDC48A = file.read()
        cls.CDC48A = oma.OrthologFinder(arabidopsisCDC48A)

        with open((cls.filepath + os.sep + 'OMA_get_id.txt'), 'r') as file:
            OMA_id_response = file.read()
        cls.response = bytes(OMA_id_response, 'utf-8')

        with open((cls.filepath + os.sep + 'orhtolog_response.txt'),
                  'r') as file:
            ortho_response = file.read()
        cls.oresponse = bytes(ortho_response, 'utf-8')

        with open((cls.filepath + os.sep + 'fasta_response.txt'), 'r') as file:
            fasta_response = file.read()
        cls.fresponse = bytes(fasta_response, 'utf-8')

        with open((cls.filepath + os.sep + 'ATN1_HOGS.txt'), 'r') as file:
            HOG_response = file.read()
        cls.hresponse = bytes(HOG_response, 'utf-8')

        with open((cls.filepath + os.sep + 'hog_content.txt'), 'r') as file:
            level_response = file.read()
        cls.lvlresponse = bytes(level_response, 'utf-8')
Beispiel #4
0
 def call_orthologs(self):
     """
     Retrieves the HOGS of the input sequence. This is done by querying the OMA online database.
     """
     if os.path.isfile(self.input):
         with open(self.input, "r") as file:
             sequence = file.read()
         ortholog_call = oma.OrthologFinder(sequence)
     else:
         ortholog_call = oma.OrthologFinder(self.input)
     try:
         self.orthologs = ortholog_call.get_HOGs()
     except RequestException:
         self.orthologs = ortholog_call.get_orthologs()
     with open("%s.orth" % (self.name), "w") as o_file:
         o_file.write(self.orthologs)
     return os.getcwd() + os.sep + "%s.orth" % (self.name)
Beispiel #5
0
    def call_orthologs(self):
        """
        Retrieves the HOG or the orthologs of the entered sequence by querying the OMA database
        """
        ortholog_call = oma.OrthologFinder(self.sequence)
        try:
            self.orthologs = ortholog_call.get_HOGs()
        except exceptions.RequestException:
            self.orthologs = ortholog_call.get_orthologs()

        with open("%s.orth" % (self.name), 'w') as o_file:
            o_file.write(self.orthologs)

        return os.getcwd() + os.sep + '%s.orth' % (self.name)