Example #1
0
 def test_site_move(self):
     dummy_counter = fn.Intersecter.Counter()
     sites = [{'chr': 'X', 'pos': 10, 'strand': '+'}] + self.sites
     intersecter = fn.Intersecter(sites, self.regions, dummy_counter)
     intersecter.intersect()
     results = dummy_counter.get_results()
     self.assertEquals(1, len(results))
Example #2
0
 def test_2matches(self):
     dummy_counter = fn.Intersecter.Counter()
     sites = self.sites + [{'chr': 'X', 'pos': 1010, 'strand': '+'}]
     intersecter = fn.Intersecter(sites, self.regions, dummy_counter)
     intersecter.intersect()
     results = dummy_counter.get_results()
     self.assertEquals(2, len(results))
Example #3
0
 def test_strand(self):
     dummy_counter = fn.Intersecter.Counter()
     sites = [{'chr': 'X', 'pos': 1000, 'strand': '-'}]
     intersecter = fn.Intersecter(sites, self.regions, dummy_counter)
     intersecter.intersect()
     results = dummy_counter.get_results()
     self.assertEquals(0, len(results))
Example #4
0
 def test_region_move(self):
     dummy_counter = fn.Intersecter.Counter()
     regions = [{
         'chr': 'X',
         'start': 90,
         'stop': 100,
         'strand': '+',
         'trans': 'trans1'
     }] + self.regions
     intersecter = fn.Intersecter(self.sites, regions, dummy_counter)
     intersecter.intersect()
     results = dummy_counter.get_results()
     self.assertEquals(1, len(results))
Example #5
0
msg('getting sequences')
trans_seqs = genome_parser.get_trans_seqs(trans_exons)

msg('getting foldings')
trans_folds = rnafold_handler.trans_plfolds(trans_seqs, wind_size=80)
trans_seqs = None

msg('converting coordinates to numpy')
exons_trans = genes_parser.trans_exon2np(trans_exon=trans_exons)

msg('getting wt clip sites')
dels_wt = del_parser_wt.get_first()

msg('intersecting wt')
counter = fn.Intersecter.FoldsCounter(trans_folds, trans_exons, span=200)
inter = fn.Intersecter(dels_wt, exons_trans, counter, strand=False)
inter.intersect()
results_wt = counter.get_results()

with open(out_wt, 'w') as fout:
    for site in results_wt:
        fout.write(' '.join([str(x) for x in [site[1]] + site[0]]) + '\n')

msg('getting wt clip sites')
dels_mut = del_parser_mut.get_first()

msg('intersecting wt')
counter.restart()
inter = fn.Intersecter(dels_mut, exons_trans, counter, strand=False)
inter.intersect()
results_wt = counter.get_results()
Example #6
0
 def test_match(self):
     dummy_counter = fn.Intersecter.Counter()
     intersecter = fn.Intersecter(self.sites, self.regions, dummy_counter)
     intersecter.intersect()
     results = dummy_counter.get_results()
     self.assertEquals(1, len(results))