Skip to content
Snippets Groups Projects
Commit 2e9b9abb authored by Floreal Cabanettes's avatar Floreal Cabanettes
Browse files

Bgzip+tabix genotypes simulated vcf file

parent cbc36628
No related branches found
No related tags found
No related merge requests found
......@@ -112,7 +112,8 @@ with open(os.path.join(prg_path, "template.vcf"), "r") as template:
with open(os.path.join(tmp_dir, "reference-sv.bed"), "r") as bed:
vcf_reader = vcf.Reader(filename=os.path.join(tmp_dir, 'template.vcf'))
vcf_writer = vcf.Writer(open(os.path.join(output_dir, "genotypes.vcf"), "w"), vcf_reader)
output_vcf = os.path.join(output_dir, "genotypes.vcf")
vcf_writer = vcf.Writer(open(output_vcf, "w"), vcf_reader)
for line in bed:
parts = line.replace("\n", "").split("\t")
freq = float(parts[4])
......@@ -136,6 +137,13 @@ with open(os.path.join(tmp_dir, "reference-sv.bed"), "r") as bed:
vcf_writer.write_record(vcf_record)
vcf_writer.close()
# Bgzip + tabix:
os.system("bgzip -c " + output_vcf + " > " + output_vcf + ".gz")
os.unlink(output_vcf)
output_vcf += ".gz"
os.system("tabix -p vcf " + output_vcf)
###############################################
# Build fasta chromosomes for each individual #
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment