Advertisement
Guest User

Untitled

a guest
Feb 8th, 2018
163
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. with Rep as(
  2.     select a.*, ceil(L/10000)*10000+n*10000 key_
  3.       from repeats a,
  4.            generate_series(0, (ceil((R-L) / 10000)+1)::int) g(n)
  5.      where n<=(ceil((R-L) / 10000)+1) and R >= ceil(L/10000)*10000+n*10000
  6. ),
  7. Gen as (
  8.     select a.*, ceil(L/10000)*10000+n*10000 key_
  9.       from genes a,
  10.            generate_series(0, (ceil((R-L) / 10000)+1)::int) g(n)
  11.      where n<=(ceil((R-L) / 10000)+1) and R >= ceil(L/10000)*10000+n*10000
  12. )
  13. insert into result
  14. select t.L, t.R, t.cnt, G.name, R.name
  15.   from Rep R, Gen G, t47k t
  16.  where ceil(t.r/10000)*10000=R.key_ and t.r between R.l and R.r
  17.    and ceil(t.l/10000)*10000=G.key_ and t.l between G.l and G.r
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement