예제 #1
0
파일: bacteriocin.py 프로젝트: mortonjt/Boa
 def test_filter_bacteriocins_2(self):
     bacteriocins = [blast.XMLRecord(description="",
                                     expected_value=0.00001,
                                     score = 0,
                                     query_id = "bacteriocin1",
                                     query="ACGTACGTTT",
                                     query_start = 1,
                                     query_end   = 10,
                                     sbjct_id = "NC_12345",
                                     sbjct="ACGTACGTTT",
                                     sbjct_start = 100,
                                     sbjct_end   = 110,
                                     strand = "-"),
                     blast.XMLRecord(description="",
                                     expected_value=0.00001,
                                     score = 0,
                                     query_id = "bacteriocin2",
                                     query="ACGTACGTTT",
                                     query_start = 1,
                                     query_end   = 10,
                                     sbjct_id = "NC_12345",
                                     sbjct="ACGTACGTTT",
                                     sbjct_start = 1000,
                                     sbjct_end   = 1010,
                                     strand = "-"),
                     blast.XMLRecord(description="",
                                     expected_value=0.00001,
                                     score = 0,
                                     query_id = "bacteriocin3",
                                     query="ACGTACGTTT",
                                     query_start = 1,
                                     query_end   = 10,
                                 sbjct_id = "NC_12346",
                                     sbjct="ACGTACGTTT",
                                     sbjct_start = 100,
                                     sbjct_end   = 110,
                                     strand = "-")]
     genes = [blast.XMLRecord(description="",
                              expected_value=0.00001,
                              score = 0,
                              query_id = "gene1",
                              query="AAAAAAAAAA",
                              query_start = 1,
                              query_end   = 10,
                              sbjct_id = "NC_12345",
                              sbjct="AAAAAAAAAA",
                              sbjct_start = 150,
                              sbjct_end   = 160,
                              strand = "-"),
              blast.XMLRecord(description="",
                              expected_value=0.00001,
                              score = 0,
                              query_id = "gene2",
                              query="AAAAAAAAAA",
                              query_start = 1,
                              query_end   = 10,
                              sbjct_id = "NC_12346",
                              sbjct="AAAAAAAAAA",
                              sbjct_start = 1050,
                              sbjct_end   = 1060,
                              strand = "-")]
     radius = 10000
     filtered,hoods = interval_filter.bacteriocins(bacteriocins,genes,radius)
     #print '\n'.join(map(str,filtered))
     #print '\n'.join(map(str,hoods))
     self.assertEquals(3,len(filtered))
     self.assertEquals(3,len(hoods))
     self.assertTrue(bacteriocins[0] in filtered)
예제 #2
0
파일: bacteriocin.py 프로젝트: mortonjt/Boa
 def test_filter_bacteriocins_1(self):
     bacteriocins = [blast.XMLRecord(description="",
                                     expected_value=0.00001,
                                     score = 0,
                                     query_id = "bacteriocin1",
                                     query="ACGTACGTTT",
                                     query_start = 1,
                                     query_end   = 10,
                                     sbjct_id = "NC_12345",
                                     sbjct="ACGTACGTTT",
                                     sbjct_start = 100,
                                     sbjct_end   = 110,
                                     strand = "-"),
                     blast.XMLRecord(description="",
                                     expected_value=0.00001,
                                     score = 0,
                                     query_id = "bacteriocin2",
                                     query="ACGTACGTTT",
                                     query_start = 1,
                                     query_end   = 10,
                                     sbjct_id = "NC_12345",
                                     sbjct="ACGTACGTTT",
                                     sbjct_start = 1000,
                                     sbjct_end   = 1010,
                                     strand = "-"),
                     blast.XMLRecord(description="",
                                     expected_value=0.00001,
                                     score = 0,
                                     query_id = "bacteriocin3",
                                     query="ACGTACGTTT",
                                     query_start = 1,
                                     query_end   = 10,
                                 sbjct_id = "NC_12346",
                                     sbjct="ACGTACGTTT",
                                     sbjct_start = 100,
                                     sbjct_end   = 110,
                                     strand = "-")]
     genes = [blast.XMLRecord(description="",
                              expected_value=0.00001,
                              score = 0,
                              query_id = "gene1",
                              query="AAAAAAAAAA",
                              query_start = 1,
                              query_end   = 10,
                              sbjct_id = "NC_12345",
                              sbjct="AAAAAAAAAA",
                              sbjct_start = 150,
                              sbjct_end   = 160,
                              strand = "-"),
              blast.XMLRecord(description="",
                              expected_value=0.00001,
                              score = 0,
                              query_id = "gene2",
                              query="AAAAAAAAAA",
                              query_start = 1,
                              query_end   = 10,
                              sbjct_id = "org2",
                              sbjct="AAAAAAAAAA",
                              sbjct_start = 1050,
                              sbjct_end   = 1060,
                              strand = "-")]
     radius = 100
     filtered,hoods = interval_filter.bacteriocins(bacteriocins,genes,radius)
     self.assertEquals(1,len(filtered))
     self.assertEquals(1,len(hoods))
     self.assertTrue(bacteriocins[0] in filtered)
     record = hoods[0]
     start,end,refid,gene = record.sbjct_start,record.sbjct_end,record.query_id,record.strand
     
     self.assertEquals(start,150)
     self.assertEquals(end,160)
     self.assertEquals(refid,"gene1")