コード例 #1
0
 def test_set_type_of_5_prime_tss(self):
     self.tss_gene_mapper.genes_and_5_prime_tss = {}
     self.tss_gene_mapper.tss_and_hit_genes = {}
     tss_primary = TSS("genomeX", 40, "+")
     tss_secondary = TSS("genomeX", 30, "+")
     gene = Gene("genomeX", "g", "g", 50, 100, "+")
     self.tss_gene_mapper.genes_and_5_prime_tss[gene] = [[10, tss_primary],
                                                         [
                                                             20,
                                                             tss_secondary
                                                         ]]
     self.tss_gene_mapper.tss_and_hit_genes[tss_primary] = {}
     self.tss_gene_mapper.tss_and_hit_genes[tss_secondary] = {}
     self.tss_gene_mapper.tss_and_hit_genes[tss_primary][gene] = {
         "location": tssgenemapper.loc_5_prime_str,
         "orientation": tssgenemapper.sense_str,
         "distance": 10,
         "tss_type": None
     }
     self.tss_gene_mapper.tss_and_hit_genes[tss_secondary][gene] = {
         "location": tssgenemapper.loc_5_prime_str,
         "orientation": tssgenemapper.sense_str,
         "distance": 20,
         "tss_type": None
     }
     self.tss_gene_mapper._set_type_of_5_prime_tss()
     self.assertEqual(
         self.tss_gene_mapper.tss_and_hit_genes[tss_primary][gene]
         ["tss_type"], tssgenemapper.primary_str)
     self.assertEqual(
         self.tss_gene_mapper.tss_and_hit_genes[tss_secondary][gene]
         ["tss_type"], tssgenemapper.secondary_str)
コード例 #2
0
 def create_tss_list(self):
     self.tss_list = []
     for row in csv.reader(self.tss_list_fh, delimiter="\t"):
         seq_id = None
         if len(row) == 3:
             seq_id == row[2]
         try:
             self.tss_list.append(TSS(seq_id, row[0], row[1]))
         except:
             sys.stderr.write("Skipping TSS table line: \"%s\"\n" %
                              ("\t".join(row)))
コード例 #3
0
 def test_has_5_prime_association_9(self):
     """True - In 5' region"""
     tss = TSS("genomeX", 105, "-")
     gene = Gene("genomeX", "g", "g", 10, 100, "-")
     self.assertEqual(
         self.tss_gene_mapper._has_5_prime_association(tss, gene), True)
コード例 #4
0
 def test_has_5_prime_association_8(self):
     """None - antisense"""
     tss = TSS("genomeX", 600, "+")
     gene = Gene("genomeX", "g", "g", 10, 100, "-")
     self.assertEqual(
         self.tss_gene_mapper._has_5_prime_association(tss, gene), None)
コード例 #5
0
 def test_has_5_prime_association_4(self):
     """None - in 5' but too far away """
     tss = TSS("genomeX", 10, "+")
     gene = Gene("genomeX", "g", "g", 1000, 1100, "+")
     self.assertEqual(
         self.tss_gene_mapper._has_5_prime_association(tss, gene), None)
コード例 #6
0
 def test_has_5_prime_association_3(self):
     """True - Leaderless TSS"""
     tss = TSS("genomeX", 10, "+")
     gene = Gene("genomeX", "g", "g", 10, 100, "+")
     self.assertEqual(
         self.tss_gene_mapper._has_5_prime_association(tss, gene), True)
コード例 #7
0
 def test_5_prime_dist_4(self):
     tss = TSS("genomeX", 120, "-")
     gene = Gene("genomeX", "g", "g", 10, 100, "-")
     self.assertEqual(self.tss_gene_mapper._5_prime_dist(tss, gene), 20)
コード例 #8
0
ファイル: test_tss.py プロジェクト: tiramisutes/kufpybio
 def test_init_without_extra(self):
     tss = TSS("plasmidX", "20", "-")
     self.assertEqual(tss.seq_id, "plasmidX")
     self.assertEqual(tss.pos, 20)
     self.assertEqual(tss.strand, "-")
     self.assertFalse(hasattr(tss, "extra"))
コード例 #9
0
 def test_has_internal_association_7(self):
     """True - on the last base """
     tss = TSS("genomeX", 10, "-")
     gene = Gene("genomeX", "g", "g", 10, 100, "-")
     self.assertEqual(
         self.tss_gene_mapper._has_internal_association(tss, gene), True)
コード例 #10
0
 def test_has_internal_association_3(self):
     """None - 3' region """
     tss = TSS("genomeX", 150, "+")
     gene = Gene("genomeX", "g", "g", 10, 100, "+")
     self.assertEqual(
         self.tss_gene_mapper._has_internal_association(tss, gene), None)
コード例 #11
0
 def test_has_internal_association_1(self):
     """True - internal"""
     tss = TSS("genomeX", 20, "+")
     gene = Gene("genomeX", "g", "g", 10, 100, "+")
     self.assertEqual(
         self.tss_gene_mapper._has_internal_association(tss, gene), True)
コード例 #12
0
 def test_has_antisense_association_10(self):
     """None - out of range"""
     tss = TSS("genomeX", 201, "-")
     gene = Gene("genomeX", "g", "g", 10, 100, "+")
     self.assertEqual(
         self.tss_gene_mapper._has_antisense_association(tss, gene), None)
コード例 #13
0
 def test_has_antisense_association_8(self):
     """True - antisense"""
     tss = TSS("genomeX", 200, "-")
     gene = Gene("genomeX", "g", "g", 10, 100, "+")
     self.assertEqual(
         self.tss_gene_mapper._has_antisense_association(tss, gene), True)
コード例 #14
0
 def test_has_antisense_association_7(self):
     """True - antisense and inside the range"""
     tss = TSS("genomeX", 900, "-")
     gene = Gene("genomeX", "g", "g", 1000, 1100, "+")
     self.assertEqual(
         self.tss_gene_mapper._has_antisense_association(tss, gene), True)
コード例 #15
0
 def test_has_5_prime_association_10(self):
     """None - in 3' region"""
     tss = TSS("genomeX", 5, "-")
     gene = Gene("genomeX", "g", "g", 10, 100, "-")
     self.assertEqual(
         self.tss_gene_mapper._has_5_prime_association(tss, gene), None)
コード例 #16
0
 def test_has_internal_association_8(self):
     """None - on the first base => 5' leaderless """
     tss = TSS("genomeX", 100, "-")
     gene = Gene("genomeX", "g", "g", 10, 100, "-")
     self.assertEqual(
         self.tss_gene_mapper._has_internal_association(tss, gene), None)
コード例 #17
0
ファイル: test_tss.py プロジェクト: tiramisutes/kufpybio
 def test_init_with_extra(self):
     tss = TSS("plasmidY", "30", "+", extra="weak")
     self.assertEqual(tss.seq_id, "plasmidY")
     self.assertEqual(tss.pos, 30)
     self.assertEqual(tss.strand, "+")
     self.assertEqual(tss.extra, "weak")