污染添加17和160图

master
chaopower 2024-02-26 10:05:47 +08:00
parent 3f6e7b2dc0
commit 157fa94ef8
2 changed files with 29 additions and 0 deletions

View File

@ -46,9 +46,13 @@ def single_monitor(name, vcf_file, bed_file, freq_range, output_dir):
bed_regions = load_bed_regions(bed_file) bed_regions = load_bed_regions(bed_file)
vcf = pysam.VariantFile(vcf_file) vcf = pysam.VariantFile(vcf_file)
res_pos = list() res_pos = list()
count_normal = 0 count_normal = 0
count_exception = 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: for record in vcf:
contig = record.contig contig = record.contig
@ -79,7 +83,9 @@ def single_monitor(name, vcf_file, bed_file, freq_range, output_dir):
freq=freq, freq=freq,
res=res res=res
)) ))
vcf_out.write(str(record) + '\n')
break break
count_all = count_exception + count_normal count_all = count_exception + count_normal
if count_all == 0: if count_all == 0:
z_score = 0 z_score = 0

View File

@ -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 { workflow call_pollution {
Boolean run=true Boolean run=true
@ -114,6 +127,16 @@ workflow call_pollution {
probe=probe, probe=probe,
vcf=initial_vcf 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
}
} }
} }