Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CG_caller update #2

Merged
merged 2 commits into from
Aug 11, 2014
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
43 changes: 43 additions & 0 deletions tools/cgCaller.py
Original file line number Diff line number Diff line change
Expand Up @@ -105,3 +105,46 @@
allele_indices.append(2)
print("{chrom}\t{pos}\t.\t{ref_a}\t{alt_a}\t.\tPASS\t.\tGT\t{gen1}/{gen2}".format(chrom=args.chr,
pos=begin+1, ref_a=allele_ref, alt_a=",".join(alt_alleles), gen1=allele_indices[0], gen2=allele_indices[1]))

if var_type == "sub":
if zygosity in ["hom", "het-ref", "het-alt"]:
allele_ref = fields[7]
allele_1 = fields[8]
allele_2 = fields[9]
allele1_qual = fields[14]
allele2_qual = fields[15]
if allele1_qual == "VQHIGH" and allele2_qual == "VQHIGH" and len(allele_ref)==len(allele_1) and len(allele_ref)==len(allele_2):
for i in range(0,len(allele_1)):
mask_generator.addCalledPosition(begin + 1)
allele_indices = []
alt_alleles = []
if allele_1[i] != allele_ref[i]:
alt_alleles.append(allele_1[i])
allele_indices.append(1)
elif allele_1[i] == allele_ref[i]:
allele_indices.append(0)
if allele_2[i] == allele_ref[i]:
allele_indices.append(0)
elif allele_2[i] == allele_1[i]:
allele_indices.append(1)
else:
if len(alt_alleles)==0:
alt_alleles.append(allele_2[i])
allele_indices.append(1)
else:
alt_alleles.append(allele_2[i])
allele_indices.append(2)
if allele_indices[0]==0 and allele_indices[1]==0:
if sites_parser is not None:
while not sites_parser.end and sites_parser.pos < begin+i+1:
sites_parser.tick()
if sites_parser.pos == begin+i+1:
assert allele_ref[i] == sites_parser.ref_a
print("{chrom}\t{pos}\t.\t{ref_a}\t{alt_a}\t.\tPASS\t.\tGT\t0/0".format(chrom=args.chr, pos=begin+i+1,ref_a=sites_parser.ref_a,alt_a=sites_parser.alt_a))
else:
if sites_parser is not None:
while not sites_parser.end and sites_parser.pos < begin+i+1:
sites_parser.tick()
if sites_parser.pos == begin+i+1:
assert allele_ref[i] == sites_parser.ref_a
print("{chrom}\t{pos}\t.\t{ref_a}\t{alt_a}\t.\tPASS\t.\tGT\t{gen1}/{gen2}".format(chrom=args.chr, pos=begin+i+1, ref_a=allele_ref[i], alt_a=",".join(alt_alleles), gen1=allele_indices[0], gen2=allele_indices[1]))