Skip to content

Commit

Permalink
fix remaining snpEff ANN parsing bugs
Browse files Browse the repository at this point in the history
  • Loading branch information
dpark01 committed Mar 12, 2015
1 parent 72f37ce commit 3f83a45
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 7 deletions.
15 changes: 11 additions & 4 deletions intrahost.py
Expand Up @@ -678,6 +678,12 @@ def parse_ann(ann_field, alleles, transcript_blacklist=set(('GP.2','GP.3'))):
ziplong = itertools.zip_longest if 'zip_longest' in dir(itertools) else itertools.izip_longest
outalleles = []
for a in alleles[1:]:
if len(a)==len(alleles[0]):
out_a = []
for ref, alt in reversed(list(zip(alleles[0], a))):
if ref!=alt or out_a:
out_a.append(alt)
a = ''.join(reversed(out_a))
out_a = []
for ref, alt in ziplong(alleles[0], a, fillvalue=''):
if ref!=alt or out_a:
Expand All @@ -698,12 +704,13 @@ def parse_ann(ann_field, alleles, transcript_blacklist=set(('GP.2','GP.3'))):
if not effs:
return {}
if len(effs) != len(effs_dict):
raise Exception()
if len(effs) != len(set(alleles)):
raise Exception()
raise Exception("ANN field has non-unique alleles")
for a in alleles:
if a not in effs_dict:
raise Exception("missing allele: " + a)
raise Exception("ANN field is missing ALT allele: " + a)
if len(effs) != len(set(alleles)):
raise Exception("ANN field has %s entries, but ALT field has %s unique alleles: %s" % (
len(effs), len(set(alleles)), ','.join(alleles)))

out = {}
for k in ('eff_type', 'eff_codon_dna', 'eff_aa', 'eff_aa_pos', 'eff_prot_len', 'eff_gene', 'eff_protein'):
Expand Down
6 changes: 3 additions & 3 deletions pipes/rules/intrahost.rules
Expand Up @@ -35,8 +35,8 @@ rule isnvs_vcf:
sample=read_samples_file(config["samples_assembly"]))
output:
config["dataDir"]+'/'+config["subdirs"]["intrahost"] +'/isnvs.vcf.gz',
config["dataDir"]+'/'+config["subdirs"]["intrahost"] +'/isnvs.annot.vcf.gz'
#config["dataDir"]+'/'+config["subdirs"]["intrahost"] +'/isnvs.annot.txt.gz'
config["dataDir"]+'/'+config["subdirs"]["intrahost"] +'/isnvs.annot.vcf.gz',
config["dataDir"]+'/'+config["subdirs"]["intrahost"] +'/isnvs.annot.txt.gz'
resources: mem=4
params: LSF=config.get('LSF_queues', {}).get('short', '-W 4:00'),
logid="all",
Expand All @@ -51,5 +51,5 @@ rule isnvs_vcf:
+ " --strip_chr_version"
)
shell("{config[binDir]}/interhost.py snpEff {output[0]} {params.snpEff_ref} {output[1]}")
#shell("{config[binDir]}/intrahost.py iSNV_table {output[1]} {output[2]}")
shell("{config[binDir]}/intrahost.py iSNV_table {output[1]} {output[2]}")

0 comments on commit 3f83a45

Please sign in to comment.