Commit 51aaa4d8 authored by Alisa Muraveva's avatar Alisa Muraveva
Browse files

mRNA ID in LEGEND

git-svn-id: https://humgenprojects.lumc.nl/svn/mutalyzer/branches/mobile-2013@733 eb6bd6ab-9ccd-42b9-aceb-e2899b4a52f1
parent 9867966a
......@@ -179,6 +179,7 @@ class Gene(object) :
self.location = []
self.longName = ""
self.__locusTag = "000"
self.locus = None
#__init__
def newLocusTag(self) :
......
......@@ -261,7 +261,15 @@ class EMBLparser():
else :
setattr(locus, key, "")
#__tagByDict
def __transcript_id (self, locus):
if locus.qualifiers.has_key('note'):
for i in locus.qualifiers['note']:
if locus.qualifiers['note'][-1].split('=')[0] == "transcript_id":
key = locus.qualifiers['note'][-1].split('=')[1]
setattr(locus, 'transcript_id', key)
else:
setattr(locus, 'transcript_id', " ")
def __tagLocus(self, locusList):
"""
Enrich a list of locus objects (mRNA or CDS) with information used
......@@ -278,7 +286,7 @@ class EMBLparser():
for i in locusList :
# Transfer some variables from the dictionary to the locus object.
self.__tagByDict(i, "locus_tag")
self.__tagByDict(i, "transcript_id")
self.__transcript_id(i)
self.__tagByDict(i, "protein_id")
self.__tagByDict(i, "gene")
self.__tagByDict(i, "product")
......@@ -292,9 +300,9 @@ class EMBLparser():
if i.protein_id : # Tag a CDS with the protein id.
i.proteinLink = i.protein_id.split('.')[0]
#if
else : # Tag an mRNA with the protein id too.
i.proteinLink = \
self.__transcriptToProtein(i.transcript_id.split('.')[0])
#else : # Tag an mRNA with the protein id too.
# i.proteinLink = \
# self.__transcriptToProtein(i.transcript_id.split('.')[0])
i.positionList = self.__locationList2posList(i)
i.location = self.__location2pos(i.location) #FIXME
#if not i.positionList : # FIXME ???
......@@ -563,6 +571,7 @@ class EMBLparser():
myGene = Gene(geneName)
record.geneList.append(myGene)
record.locusDict[i.qualifiers["locus_tag"][0]] = geneName
myGene.locus = i.qualifiers["locus_tag"][0]
if i.strand :
myGene.orientation = i.strand
myGene.location = self.__location2pos(i.location)
......
......@@ -1484,7 +1484,7 @@ def process_variant(mutator, description, record, output):
# NG_012772.1).
output.addMessage(__file__, 4, "ENOTRANSCRIPT",
"Multiple transcripts found for gene %s. Please " \
"choose from: %s" %(gene.name,
"choose from: %s" %(gene.locus,
", ".join(gene.listLoci())))
else:
# No transcript id given.
......@@ -1494,7 +1494,7 @@ def process_variant(mutator, description, record, output):
else:
output.addMessage(__file__, 4, "ENOTRANSCRIPT",
"No transcript given for gene %s. Please " \
"choose from: %s" %(gene.name,
"choose from: %s" %(gene.locus,
", ".join(gene.listLoci())))
else:
......@@ -1538,7 +1538,7 @@ def process_variant(mutator, description, record, output):
# NG_012772.1).
output.addMessage(__file__, 4, "ENOTRANSCRIPT",
"Multiple transcripts found for gene %s. Please " \
"choose from: %s" %(gene.name,
"choose from: %s" %(gene.locus,
", ".join(gene.listLoci())))
# Add selected gene symbol to output
......@@ -1745,13 +1745,13 @@ def check_variant(description, output):
if not transcript.name:
continue
output.addOutput('legends',
['%s_v%s' % (gene.name, transcript.name),
['%s_v%s' % (gene.locus, transcript.name),
transcript.transcriptID, transcript.locusTag,
transcript.transcriptProduct,
transcript.linkMethod])
if transcript.translate:
output.addOutput('legends',
['%s_i%s' % (gene.name, transcript.name),
['%s_i%s' % (gene.locus, transcript.name),
transcript.proteinID, transcript.locusTag,
transcript.proteinProduct,
transcript.linkMethod])
......@@ -1900,7 +1900,7 @@ def check_variant(description, output):
output.addOutput('descriptions', gene.name)
else:
full_description = '%s(%s_v%s):%c.%s' % \
(reference, gene.name, transcript.name,
(reference, gene.locus, transcript.name,
transcript.molType,
generated_description)
output.addOutput('descriptions', full_description)
......@@ -1914,7 +1914,7 @@ def check_variant(description, output):
protein_description)
else:
full_protein_description = '%s(%s_i%s):%s' % \
(reference, gene.name,
(reference, gene.locus,
transcript.name,
protein_description)
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment