Skip to content

Commit

Permalink
fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
mathiasbio committed Nov 21, 2024
1 parent 870820b commit 0bf6a27
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 6 deletions.
6 changes: 1 addition & 5 deletions BALSAMIC/assets/scripts/merge_snv_variantcallers.py
Original file line number Diff line number Diff line change
Expand Up @@ -252,11 +252,7 @@ def write_merged_vcf(output_file, header, merged_variants):
"""
Writes the merged variants along with the header to the output VCF file.
"""
with (
gzip.open(output_file, "wt")
if output_file.endswith(".gz")
else open(output_file, "w")
) as f:
with open(output_file, "w") as f:
# Write the header
for line in header:
f.write(line + "\n")
Expand Down
5 changes: 4 additions & 1 deletion BALSAMIC/snakemake_rules/variant_calling/merge_snv_vcfs.rule
Original file line number Diff line number Diff line change
Expand Up @@ -35,12 +35,15 @@ rule merge_snv_vcfs:
Path(singularity_image, config["bioinfo_tools"].get("bcftools") + ".sif").as_posix()
params:
modify_tnscope_infofield = get_script_path("merge_snv_variantcallers.py"),
tmpdir = tempfile.mkdtemp(prefix=tmp_dir),
threads:
get_threads(cluster_config, "bcftools_concatenate_vcfs")
message:
"Merging VCFs with custom python script using vcfpy"
shell:
"""
python {params.modify_tnscope_infofield} {input.vcfs} {output.vcf_merged} ;
python {params.modify_tnscope_infofield} {input.vcfs} {params.tmpdir}/merged.vcf ;
bgzip {params.tmpdir}/merged.vcf ;
mv {params.tmpdir}/merged.vcf {output.vcf_merged} ;
tabix -p vcf -f {output.vcf_merged} ;
"""

0 comments on commit 0bf6a27

Please sign in to comment.