-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added chr to increase parallelism level (#39)
* Added chr to increase parallelism level * Change data source to PGSQL
- Loading branch information
Showing
3 changed files
with
74 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
/*run from zsi-bio-spark-shell*/ | ||
|
||
val createTableString="""CREATE TABLE IF NOT EXISTS pgsql.coverage_target | ||
USING org.apache.spark.sql.jdbc | ||
OPTIONS ( | ||
url "jdbc:postgresql://cdh00.ii.pw.edu.pl:15432/cnv-opt", | ||
dbtable "public.coverage_target", | ||
user 'cnv-opt', | ||
password 'zsibio321' | ||
)""" | ||
|
||
spark.sqlContext.sql(createTableString) | ||
|
||
val insertString="""INSERT INTO pgsql.coverage_target SELECT | ||
chr, | ||
sample_name, | ||
target_id, | ||
pos_min, | ||
pos_max, | ||
cov_avg | ||
FROM cnv.coverage_target | ||
""" | ||
spark.sqlContext.sql(insertString) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
--create backup | ||
create table test_params_bck as select * from test_parameters; | ||
|
||
--generate | ||
drop table if exists test_parameters_chr; | ||
create table test_parameters_chr as | ||
select cast(row_number() over () as integer ) as id, | ||
caller , | ||
cast('public.coverage_target' as text) as cov_table, | ||
mapp_thresh , | ||
cov_thresh_from , | ||
cov_thresh_to , | ||
length_thresh_from , | ||
length_thresh_to , | ||
gc_thresh_from , | ||
gc_thresh_to , | ||
k_from , | ||
k_to , | ||
lmax, | ||
chr | ||
from test_params_bck par, (select cast (generate_series(1,22) as text ) as chr | ||
union | ||
select 'X' | ||
union | ||
select 'Y') chr; | ||
|
||
--delete from test_parameters_chr where chr<>'Y' | ||
|
||
---create coverage table in postgres | ||
CREATE TABLE coverage_target( | ||
chr text, | ||
sample_name , | ||
target_id int, | ||
pos_min int, | ||
pos_max int, | ||
cov_avg numeric); | ||
|
||
ALTER TABLE public.coverage_target OWNER TO "cnv-opt"; | ||
CREATE INDEX coveage_targe_idx1 ON coverage_target(chr); | ||
|
||
|
||
|