Skip to content

Commit

Permalink
Merge pull request #3 from peterk87/patch/fix-snpeff-parsing
Browse files Browse the repository at this point in the history
Fix snpeff parsing
  • Loading branch information
peterk87 authored Mar 30, 2021
2 parents aeed190 + 9585133 commit ec5ec4f
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 8 deletions.
2 changes: 1 addition & 1 deletion setup.cfg
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[bumpversion]
current_version = 0.2.1
current_version = 0.2.2
commit = True
tag = True

Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,6 @@
test_suite='tests',
tests_require=test_requirements,
url='https://github.com/peterk87/xlavir',
version='0.2.1',
version='0.2.2',
zip_safe=False,
)
2 changes: 1 addition & 1 deletion xlavir/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@

__author__ = """Peter Kruczkiewicz"""
__email__ = 'peter.kruczkiewicz@gmail.com'
__version__ = '0.2.1'
__version__ = '0.2.2'
15 changes: 10 additions & 5 deletions xlavir/tools/variants.py
Original file line number Diff line number Diff line change
Expand Up @@ -194,21 +194,26 @@ def parse_aa(gene: str,

if effect == 'stop_lost':
alt_aa = get_aa(alt_aa.replace('ext', ''))
return f'{ref}{nt_pos}{alt}({gene}:{ref_aa}{aa_pos}{alt_aa}[stop_lost])'
return f'{ref}{nt_pos}{alt}({gene}:{ref_aa}{aa_pos_str}{alt_aa}[stop_lost])'
if effect == 'frameshift_variant':
return f'{ref}{nt_pos}{alt}({gene}:{ref_aa}{aa_pos}[FRAMESHIFT])'
return f'{ref}{nt_pos}{alt}({gene}:{ref_aa}{aa_pos_str}[FRAMESHIFT])'
if effect == 'conservative_inframe_deletion':
return f'{ref}{nt_pos}{alt}({gene}:{ref_aa}{aa_pos}{alt_aa})'
return f'{ref}{nt_pos}{alt}({gene}:{ref_aa}{aa_pos_str}{alt_aa})'
if effect == 'disruptive_inframe_deletion':
return f'{ref}{nt_pos}{alt}({gene}:{ref_aa}{aa_pos_str}{alt_aa}[disruptive_inframe_deletion])'

alt_aa = get_aa(alt_aa)
return f'{ref}{nt_pos}{alt}({gene}:{ref_aa}{aa_pos}{alt_aa})'
return f'{ref}{nt_pos}{alt}({gene}:{ref_aa}{aa_pos_str}{alt_aa})'


def get_aa(s: str) -> str:
out = ''
for i in range(0, len(s), 3):
aa = s[i: i + 3]
aa_code = aa_codes[aa.upper()]
try:
aa_code = aa_codes[aa.upper()]
except KeyError:
aa_code = aa
out += aa_code
return out

Expand Down

0 comments on commit ec5ec4f

Please sign in to comment.