Skip to content

Commit

Permalink
Merge pull request #173 from FRED-2/develop
Browse files Browse the repository at this point in the history
[INTERNAL] MutationSyntax annotates GeneID
  • Loading branch information
b-schubert authored Jul 7, 2016
2 parents c4220b6 + f9ef1f9 commit b0466a7
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
4 changes: 2 additions & 2 deletions Fred2/Core/Variant.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,10 @@ class MutationSyntax():
:param str cds: The complete cds_mutation_syntax string
:param str aas: The complete protein_mutation_syntax string
"""
def __init__(self, transID, transPos, protPos, cds, aas):
def __init__(self, transID, transPos, protPos, cds, aas, geneID=None):
#TODO: is protPos always given? what about synonymous variants?
self.transID = transID
self.geneID = geneID
self.tranPos = transPos
self.protPos = protPos
self.cdsMutationSyntax = cds #c. ...
Expand Down Expand Up @@ -79,7 +80,6 @@ def __init__(self, id, type, chrom, genomePos, ref, obs, coding,
self.genomePos = genomePos
self.ref = ref.upper()
self.obs = obs.upper()
self.gene = None
self.isHomozygous = isHomozygous
self.isSynonymous = isSynonymous
self.coding = coding # dict transcript_id:MutationSyntax
Expand Down
9 changes: 5 additions & 4 deletions Fred2/IO/FileReader.py
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ def read_annovar_exonic(annovar_file, gene_filter=None, experimentalDesig=None):
#fgd3:nm_001083536:exon6:c.g823a:p.v275i,fgd3:nm_001286993:exon6:c.g823a:p.v275i,fgd3:nm_033086:exon6:c.g823a:p.v275i
#RE = re.compile("\w+:(\w+):exon\d+:c.(\D*)(\d+)_*(\d*)(\D\w*):p.\w+:\D*->\D*:(\D).*?,")
#RE = re.compile("\w+:(\w+):exon\d+:c.(\D*)(\d+)_*(\d*)(\D\w*):p.(\D*)(\d+)_*(\d*)(\D\w*):(\D).*?,")
RE = re.compile("((\w+):exon\d+:c.\D*(\d+)\D\w*:p.\D*(\d+)\D\w*)")
RE = re.compile("((\w+):(\w+):exon\d+:c.\D*(\d+)\D\w*:p.\D*(\d+)\D\w*)")
type_mapper = {('synonymous', 'snv'): VariationType.SNP,
('nonsynonymous', 'snv'): VariationType.SNP,
('stoploss', 'snv'): VariationType.SNP,
Expand Down Expand Up @@ -157,13 +157,14 @@ def read_annovar_exonic(annovar_file, gene_filter=None, experimentalDesig=None):
#print "Debug ", line, RE.findall(line), type, zygos
coding = {}
for nm_id_pos in RE.findall(line):
mutation_string, nm_id, trans_pos, prot_start = nm_id_pos
mutation_string, geneID, nm_id, trans_pos, prot_start = nm_id_pos
#print "Debug ",nm_id_pos

nm_id = nm_id.upper()
_, _, trans_coding, prot_coding = mutation_string.split(":")
_,_, _, trans_coding, prot_coding = mutation_string.split(":")
#internal transcript and protein position start at 0!
coding[nm_id] = MutationSyntax(nm_id, int(trans_pos)-1, int(prot_start)-1, trans_coding, prot_coding)
coding[nm_id] = MutationSyntax(nm_id, int(trans_pos)-1, int(prot_start)-1, trans_coding, prot_coding,
geneID=geneID.upper())

ty = tuple(mut_type.split())

Expand Down

0 comments on commit b0466a7

Please sign in to comment.