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

Replace vawk by python code

parent a60719b5
No related branches found
No related tags found
No related merge requests found
......@@ -196,22 +196,19 @@ def get_genotypes(genotypes_file, true_vcf_file):
"""
genotypes = {}
gt_quality = {}
nb_inds = 0
# Genotypes:
genotypes_raw = os.popen("zcat " + genotypes_file + " " + true_vcf_file + " | " +
os.path.join(prg_path, "vawk") + " '{ print $3,S$*$GT}'").read().split("\n")
for gt in genotypes_raw:
if gt != "":
gt_l = gt.split("\t")
genotypes[gt_l[0]] = gt_l[1:]
nb_inds = len(gt_l[1:])
gt_quality_raw = os.popen("zcat " + genotypes_file + " | " +
os.path.join(prg_path, "vawk") + " '{ print $3,S$*$GQ}'").read().split("\n")
for gq in gt_quality_raw:
if gq != "":
gq_l = gq.split("\t")
gt_quality[gq_l[0]] = gq_l[1:]
# Real data:
reader_t = vcf.VCFReader(filename=true_vcf_file)
for rec_t in reader_t:
genotypes[rec_t.ID] = [x.data.GT for x in rec_t.samples]
nb_inds = len(list(genotypes.values())[0])
# Samples:
reader = vcf.VCFReader(filename=genotypes_file)
for rec in reader:
genotypes[rec.ID] = [x.data.GT for x in rec.samples]
gt_quality[rec.ID] = [x.data.GQ for x in rec.samples]
return genotypes, gt_quality, nb_inds
......@@ -738,7 +735,7 @@ def main():
if args.genotypes:
# Genotype (sheets 2&3):
cells_gt, cells_gq = fill_genotypes_data(i, 2 + ((nb_tools + 1) * nb_inds), cells_gt, cells_gq,
record["tools"][tool], my_genotypes, args.haploid)
record["tools"][tool], my_genotypes, args.haploid)
else:
sv_format = {}
......
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