Skip to content

Commit

Permalink
Merge pull request #35 from starskyzheng/starskyzheng-patch-1
Browse files Browse the repository at this point in the history
Starskyzheng patch 1
  • Loading branch information
starskyzheng authored Apr 6, 2024
2 parents 3c4c396 + c3516cd commit 96ae42a
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 18 deletions.
1 change: 1 addition & 0 deletions scripts/realign_gen_mask.pl
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,7 @@ sub usage {
usage("in_vcf not defined") unless defined $infile;
usage("out_vcf not defined") unless defined $outfile;

$tmp_dir = $tmp_dir_def if $tmp_dir eq "Default";
our $config = read_config_yaml("$Bin/../config.yaml");
realign_alts::init();

Expand Down
29 changes: 20 additions & 9 deletions subworkflows/mergeSV3.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
threads: config['cores_realign']
log: "logs/3.02.{sample}.merge_vcf_same_pos.log"
resources:
mem_mb = 8000
mem_mb = 8000,
shell:
"""
perl {workflow.basedir}/scripts/merge_vcf_same_pos.pl --invcf {input.vcf} --outvcf {output.vcf} --ref {input.ref} --skip_mut_at_same_pos 2 --threads {threads} --ignore_dp >>{log} 2>&1
Expand All @@ -25,9 +25,11 @@
log: "logs/3.02.{sample}.gen_merge_mask.log"
resources:
mem_mb = 8000
params:
tmpdir = config['memory_tmp_dir'],
shell:
"""
perl {workflow.basedir}/scripts/realign_gen_mask.pl -i {input.vcf} -o {output.bed} >>{log} 2>&1
perl {workflow.basedir}/scripts/realign_gen_mask.pl -i {input.vcf} -o {output.bed} --tmpdir {params.tmpdir} >>{log} 2>&1
"""

rule realign1:
Expand All @@ -40,9 +42,11 @@
log: "logs/3.03.{sample}.realign1.log"
resources:
mem_mb = 40000
params:
tmpdir = config['memory_tmp_dir'],
shell:
"""
perl {workflow.basedir}/scripts/realign.pl --chr_tolerance --in_vcf {input.vcf} --out_vcf {output.vcf} --ref_fasta_file {input.ref} --threads {threads} --level 1 --skip_mut_at_same_pos 2 --ext_bp_min 100 --ext_bp_max 400 --first_merge >>{log} 2>&1
perl {workflow.basedir}/scripts/realign.pl --chr_tolerance --in_vcf {input.vcf} --out_vcf {output.vcf} --ref_fasta_file {input.ref} --threads {threads} --level 1 --skip_mut_at_same_pos 2 --ext_bp_min 100 --ext_bp_max 400 --first_merge --tmpdir {params.tmpdir} >>{log} 2>&1
"""

rule realign12:
Expand All @@ -55,12 +59,13 @@
log: "logs/3.03.{sample}.realign12.log"
resources:
mem_mb = 40000
params:
tmpdir = config['memory_tmp_dir'],
shell:
"""
perl {workflow.basedir}/scripts/realign.pl --chr_tolerance --in_vcf {input.vcf} --out_vcf {output.vcf} --ref_fasta_file {input.ref} --threads {threads} --level 6 --skip_mut_at_same_pos 2 >>{log} 2>&1
perl {workflow.basedir}/scripts/realign.pl --chr_tolerance --in_vcf {input.vcf} --out_vcf {output.vcf} --ref_fasta_file {input.ref} --threads {threads} --level 6 --skip_mut_at_same_pos 2 --tmpdir {params.tmpdir} >>{log} 2>&1
"""


rule thin11:
input:
vcf = "04_consensus_vcf/{sample}/03.realign2.sorted.vcf.gz",
Expand All @@ -73,9 +78,10 @@
params:
sv2pav_merge_diff_threshold = config['sv2pav_merge_diff_threshold'],
sv2pav_merge_identity_threshold = config['sv2pav_merge_identity_threshold'],
tmpdir = config['memory_tmp_dir'],
shell:
"""
perl {workflow.basedir}/scripts/merge_similar_allele.pl --invcf {input.vcf} --outvcf {output.vcf} --sv2pav_merge_diff_threshold {params.sv2pav_merge_diff_threshold} --sv2pav_merge_identity_threshold {params.sv2pav_merge_identity_threshold} --threads {threads} >>{log} 2>&1
perl {workflow.basedir}/scripts/merge_similar_allele.pl --invcf {input.vcf} --outvcf {output.vcf} --sv2pav_merge_diff_threshold {params.sv2pav_merge_diff_threshold} --sv2pav_merge_identity_threshold {params.sv2pav_merge_identity_threshold} --threads {threads} --tmpdir {params.tmpdir} >>{log} 2>&1
"""

# perl {workflow.basedir}/scripts/sv2pav.pl --invcf 7.thin1.vcf.gz --outvcf 7.thin2.vcf.gz --max_len_tomerge 5 --sv_min_dp 50
Expand Down Expand Up @@ -103,9 +109,11 @@
log: "logs/3.05.{sample}.realign2.log"
resources:
mem_mb = 20000
params:
tmpdir = config['memory_tmp_dir'],
shell:
"""
perl {workflow.basedir}/scripts/realign.pl --chr_tolerance --in_vcf {input.vcf} --out_vcf {output.vcf} --ref_fasta_file {input.ref} --threads {threads} --level 4 --skip_mut_at_same_pos 2 --ext_bp_min 100 --ext_bp_max 400 >>{log} 2>&1
perl {workflow.basedir}/scripts/realign.pl --chr_tolerance --in_vcf {input.vcf} --out_vcf {output.vcf} --ref_fasta_file {input.ref} --threads {threads} --level 4 --skip_mut_at_same_pos 2 --ext_bp_min 100 --ext_bp_max 400 --tmpdir {params.tmpdir} >>{log} 2>&1
"""

rule thin21:
Expand All @@ -118,11 +126,12 @@
params:
sv2pav_merge_diff_threshold = config['sv2pav_merge_diff_threshold'],
sv2pav_merge_identity_threshold = config['sv2pav_merge_identity_threshold'],
tmpdir = config['memory_tmp_dir'],
resources:
mem_mb = 10000
shell:
"""
perl {workflow.basedir}/scripts/merge_similar_allele.pl --invcf {input.vcf} --outvcf {output.vcf} --sv2pav_merge_identity_threshold {params.sv2pav_merge_identity_threshold} --sv2pav_merge_diff_threshold {params.sv2pav_merge_diff_threshold} --threads {threads} --sv2pav_merge_identity_threshold {params.sv2pav_merge_identity_threshold} --sv2pav_merge_diff_threshold {params.sv2pav_merge_diff_threshold} >>{log} 2>&1
perl {workflow.basedir}/scripts/merge_similar_allele.pl --invcf {input.vcf} --outvcf {output.vcf} --sv2pav_merge_identity_threshold {params.sv2pav_merge_identity_threshold} --sv2pav_merge_diff_threshold {params.sv2pav_merge_diff_threshold} --threads {threads} --sv2pav_merge_identity_threshold {params.sv2pav_merge_identity_threshold} --sv2pav_merge_diff_threshold {params.sv2pav_merge_diff_threshold} --tmpdir {params.tmpdir} >>{log} 2>&1
"""

rule thin22:
Expand Down Expand Up @@ -174,9 +183,11 @@ def get_min_support_caller(wildcards):
log: "logs/3.08.{sample}.realign3.log"
resources:
mem_mb = 4000
params:
tmpdir = config['memory_tmp_dir'],
shell:
"""
perl {workflow.basedir}/scripts/realign.pl --chr_tolerance --in_vcf {input.vcf} --out_vcf {output.vcf} --ref_fasta_file {input.ref} --threads {threads} --level 1 --skip_mut_at_same_pos 2 --ext_bp_min 1000 --ext_bp_max 1000 --mask_bed_file {input.mask_bed} --skip_snp 1 >>{log} 2>&1
perl {workflow.basedir}/scripts/realign.pl --chr_tolerance --in_vcf {input.vcf} --out_vcf {output.vcf} --ref_fasta_file {input.ref} --threads {threads} --level 1 --skip_mut_at_same_pos 2 --ext_bp_min 1000 --ext_bp_max 1000 --mask_bed_file {input.mask_bed} --skip_snp 1 --tmpdir {params.tmpdir} >>{log} 2>&1
"""

rule thin32:
Expand Down
25 changes: 16 additions & 9 deletions subworkflows/mergeSV3_pop.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,10 @@
params:
realign_extend_bp_max = 500,
realign_extend_bp_min = 50,
#tmpdir = config['memory_tmp_dir']
tmpdir = config['memory_tmp_dir']
shell:
"""
perl {workflow.basedir}/scripts/realign.pl --chr_tolerance --in_vcf {input.vcf} --out_vcf {output.vcf} --ref_fasta_file {input.ref_fasta_file} --threads {threads} --ext_bp_max {params.realign_extend_bp_max} --ext_bp_min {params.realign_extend_bp_min} --skip_mut_at_same_pos 2 --level 1 --first_merge >> {log} 2>&1
perl {workflow.basedir}/scripts/realign.pl --chr_tolerance --in_vcf {input.vcf} --out_vcf {output.vcf} --ref_fasta_file {input.ref_fasta_file} --threads {threads} --ext_bp_max {params.realign_extend_bp_max} --ext_bp_min {params.realign_extend_bp_min} --skip_mut_at_same_pos 2 --level 1 --first_merge --tmpdir {params.tmpdir} >> {log} 2>&1
"""

rule vcf2poss:
Expand Down Expand Up @@ -179,10 +179,10 @@
params:
realign_extend_bp_max = 500,
realign_extend_bp_min = 50,
#tmpdir = config['memory_tmp_dir']
tmpdir = config['memory_tmp_dir']
shell:
"""
perl {workflow.basedir}/scripts/realign.pl --chr_tolerance --in_vcf {input.vcf} --out_vcf {output.vcf} --ref_fasta_file {input.ref_fasta_file} --threads {threads} --ext_bp_max {params.realign_extend_bp_max} --ext_bp_min {params.realign_extend_bp_min} --skip_mut_at_same_pos 2 --level 1 --first_merge >> {log} 2>&1
perl {workflow.basedir}/scripts/realign.pl --chr_tolerance --in_vcf {input.vcf} --out_vcf {output.vcf} --ref_fasta_file {input.ref_fasta_file} --threads {threads} --ext_bp_max {params.realign_extend_bp_max} --ext_bp_min {params.realign_extend_bp_min} --skip_mut_at_same_pos 2 --level 1 --first_merge --tmpdir {params.tmpdir} >> {log} 2>&1
"""


Expand All @@ -196,12 +196,13 @@
params:
sv2pav_merge_identity_threshold = config['sv2pav_merge_identity_threshold'],
sv2pav_merge_diff_threshold = config['sv2pav_merge_diff_threshold'],
tmpdir = config['memory_tmp_dir'],
resources:
mem_mb = 10000
log: "logs/5.09.thin1.log"
shell:
"""
perl {workflow.basedir}/scripts/merge_similar_allele.pl --type 3 --invcf {input.vcf} --outvcf {output.vcf} --sv2pav_merge_identity_threshold {params.sv2pav_merge_identity_threshold} --sv2pav_merge_diff_threshold {params.sv2pav_merge_diff_threshold} --threads {threads} >>{log} 2>&1
perl {workflow.basedir}/scripts/merge_similar_allele.pl --type 3 --invcf {input.vcf} --outvcf {output.vcf} --sv2pav_merge_identity_threshold {params.sv2pav_merge_identity_threshold} --sv2pav_merge_diff_threshold {params.sv2pav_merge_diff_threshold} --threads {threads} --tmpdir {params.tmpdir} >>{log} 2>&1
"""

# perl {workflow.basedir}/scripts/sv2pav.pl --invcf 7.thin1.vcf.gz --outvcf 7.thin2.vcf.gz --max_len_tomerge 5 --sv_min_dp 50
Expand Down Expand Up @@ -230,9 +231,11 @@
log: "logs/5.11.realign2.log"
resources:
mem_mb = 20000
params:
tmpdir = config['memory_tmp_dir'],
shell:
"""
perl {workflow.basedir}/scripts/realign.pl --chr_tolerance --in_vcf {input.vcf} --out_vcf {output.vcf} --ref_fasta_file {input.ref} --threads {threads} --level 1 --skip_mut_at_same_pos 2 --ext_bp_min 100 --ext_bp_max 400 >>{log} 2>&1
perl {workflow.basedir}/scripts/realign.pl --chr_tolerance --in_vcf {input.vcf} --out_vcf {output.vcf} --ref_fasta_file {input.ref} --threads {threads} --level 1 --skip_mut_at_same_pos 2 --ext_bp_min 100 --ext_bp_max 400 --tmpdir {params.tmpdir} >>{log} 2>&1
"""

rule pop_thin21:
Expand All @@ -245,11 +248,12 @@
params:
sv2pav_merge_identity_threshold = config['sv2pav_merge_identity_threshold'],
sv2pav_merge_diff_threshold = config['sv2pav_merge_diff_threshold'],
tmpdir = config['memory_tmp_dir'],
resources:
mem_mb = 10000
shell:
"""
perl {workflow.basedir}/scripts/merge_similar_allele.pl --type 3 --invcf {input.vcf} --outvcf {output.vcf} --sv2pav_merge_identity_threshold {params.sv2pav_merge_identity_threshold} --sv2pav_merge_diff_threshold {params.sv2pav_merge_diff_threshold} --threads {threads} >>{log} 2>&1
perl {workflow.basedir}/scripts/merge_similar_allele.pl --type 3 --invcf {input.vcf} --outvcf {output.vcf} --sv2pav_merge_identity_threshold {params.sv2pav_merge_identity_threshold} --sv2pav_merge_diff_threshold {params.sv2pav_merge_diff_threshold} --threads {threads} --tmpdir {params.tmpdir} >>{log} 2>&1
"""

rule pop_thin22:
Expand All @@ -276,9 +280,11 @@
log: "logs/5.14.realign3.log"
resources:
mem_mb = 20000
params:
tmpdir = config['memory_tmp_dir'],
shell:
"""
perl {workflow.basedir}/scripts/realign.pl --chr_tolerance --in_vcf {input.vcf} --out_vcf {output.vcf} --ref_fasta_file {input.ref} --threads {threads} --level 4 --ext_bp_max 1 --ext_bp_min 1 --skip_mut_at_same_pos 2 --not_use_merge_alle_afterall 0 >>{log} 2>&1
perl {workflow.basedir}/scripts/realign.pl --chr_tolerance --in_vcf {input.vcf} --out_vcf {output.vcf} --ref_fasta_file {input.ref} --threads {threads} --level 4 --ext_bp_max 1 --ext_bp_min 1 --skip_mut_at_same_pos 2 --not_use_merge_alle_afterall 0 --tmpdir {params.tmpdir} >>{log} 2>&1
"""


Expand All @@ -292,11 +298,12 @@
params:
sv2pav_merge_identity_threshold = config['sv2pav_merge_identity_threshold'],
sv2pav_merge_diff_threshold = config['sv2pav_merge_diff_threshold'],
tmpdir = config['memory_tmp_dir'],
resources:
mem_mb = 4000
shell:
"""
perl {workflow.basedir}/scripts/merge_similar_allele.pl --type 3 --invcf {input.vcf} --outvcf {output.vcf} --sv2pav_merge_identity_threshold {params.sv2pav_merge_identity_threshold} --sv2pav_merge_diff_threshold {params.sv2pav_merge_diff_threshold} --threads {threads} >>{log} 2>&1
perl {workflow.basedir}/scripts/merge_similar_allele.pl --type 3 --invcf {input.vcf} --outvcf {output.vcf} --sv2pav_merge_identity_threshold {params.sv2pav_merge_identity_threshold} --sv2pav_merge_diff_threshold {params.sv2pav_merge_diff_threshold} --threads {threads} --tmpdir {params.tmpdir} >>{log} 2>&1
"""


Expand Down

0 comments on commit 96ae42a

Please sign in to comment.