From 157fa94ef886218af47d857b64f5a3625f365b0f Mon Sep 17 00:00:00 2001 From: chaopower Date: Mon, 26 Feb 2024 10:05:47 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B1=A1=E6=9F=93=E6=B7=BB=E5=8A=A017=E5=92=8C?= =?UTF-8?q?160=E5=9B=BE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- codes/pollution.py | 6 ++++++ wdl/pollution.wdl | 23 +++++++++++++++++++++++ 2 files changed, 29 insertions(+) diff --git a/codes/pollution.py b/codes/pollution.py index 1674529..69b58f5 100755 --- a/codes/pollution.py +++ b/codes/pollution.py @@ -46,9 +46,13 @@ def single_monitor(name, vcf_file, bed_file, freq_range, output_dir): bed_regions = load_bed_regions(bed_file) vcf = pysam.VariantFile(vcf_file) + res_pos = list() count_normal = 0 count_exception = 0 + vcf_out = open(os.path.join(output_dir, f'{name}_cnvkit_tumor.vcf'), 'w') + for line in str(vcf.header).strip().split('\n'): + vcf_out.write(line + '\n') for record in vcf: contig = record.contig @@ -79,7 +83,9 @@ def single_monitor(name, vcf_file, bed_file, freq_range, output_dir): freq=freq, res=res )) + vcf_out.write(str(record) + '\n') break + count_all = count_exception + count_normal if count_all == 0: z_score = 0 diff --git a/wdl/pollution.wdl b/wdl/pollution.wdl index 3f2e6bd..4c3a569 100755 --- a/wdl/pollution.wdl +++ b/wdl/pollution.wdl @@ -61,6 +61,19 @@ task run_generate_png { } } +task run_single_generate_png { + String name + String probe + String cnvkit_tumor_vcf + String cnv_cnr + String cnv_cns + String output_dir + + command { + cnvkit.py scatter ${cnv_cnr} -s ${cnv_cns} -v ${cnvkit_tumor_vcf} -o ${output_dir}/pollution/${name}_pollution_cnvkit_tumor.png + } +} + workflow call_pollution { Boolean run=true @@ -114,6 +127,16 @@ workflow call_pollution { probe=probe, vcf=initial_vcf } + call run_single_generate_png { + input: + name=tumor, + probe=probe, + cnvkit_tumor_vcf=run_pollution_paired.cnvkit_tumor_vcf, + cnv_cnr=cnv_cnr, + cnv_cns=cnv_cns, + output_dir=output_dir + + } } }