def test_cmsearch_from_file(self): """cmsearch_from_file should work as expected """ exp_search_res = [['a', 5, 23, 1, 19, 12.85, '-', 37],\ ['b', 1, 19, 1, 19, 14.359999999999999, '-', 47]] search_res = cmsearch_from_file(cm_file_path=self.cmfile,\ seqs=self.seqs2_unaligned,moltype=RNA) self.assertEqual(search_res,exp_search_res)
def test_cmsearch_from_file(self): """cmsearch_from_file should work as expected """ exp_search_res = [['a', 5, 23, 1, 19, 12.85, '-', 37],\ ['b', 1, 19, 1, 19, 14.359999999999999, '-', 47]] search_res = cmsearch_from_file(cm_file_path=self.cmfile,\ seqs=self.seqs2_unaligned,moltype=RNA) self.assertEqual(search_res, exp_search_res)
def test_cmsearch_from_file_no_hits(self): """cmsearch_from_file should work as expected """ search_res = cmsearch_from_file(cm_file_path=self.cmfile,\ seqs=self.seqs1_unaligned,moltype=RNA) self.assertEqual(search_res,[])
if __name__ == "__main__": from cogent.app.infernal import cmsearch_from_file from cogent import LoadSeqs, RNA from math import log from os import mkdir from os.path import isdir for i in range(1,4): print "making folder structural/Construct" + str(i) if not isdir("structural/Construct" + str(i)): mkdir("structural/Construct" + str(i)) for j in range(1,8): print "Loading R"+ str(j) + "_CleanedStrippedUnique.fas" seqs = LoadSeqs("R" + str(j) + "_CleanedStrippedUnique.fas", \ moltype=RNA, aligned=False, format='fasta', label_to_name=lambda x: x.split()[0]) print "Running Infernal for structural/Construct" + str(i) + "/R" + str(j) + "_tabfile.txt" cmsearch_result = cmsearch_from_file("structural/Construct" + str(i) + ".cm", seqs, RNA, \ params={"--tabfile": "structural/Construct" + str(i) + "/R" + str(j) + "_tabfile.txt"}) print "result: " + str(cmsearch_result) #cutoff=log(len(seqs),2) ??