Commit c749ecfb authored by Mihai's avatar Mihai
Browse files

Make API more consistent between UDs and NCs

parent d2e09cce
......@@ -135,6 +135,12 @@ class Transcript(dbgb.Base):
#: inclusive).
cds_stop = Column(Integer, nullable=False, index=True)
#: The mRNA product.
transcript_product = Column(String)
#: The CDS product.
protein_product = Column(String)
#: The exon start positions of the transcript on the chromosome
#: (one-based, inclusive, in chromosomal orientation).
exons_start = Column(String)
......@@ -169,10 +175,11 @@ class Transcript(dbgb.Base):
def __init__(self, transcript_accession, transcript_version,
protein_accession, protein_version, gene, gene_synonym,
strand, transcript_start, transcript_stop,
cds_start, cds_stop, exons_start, exons_stop,
cds_start, cds_stop,
transcript_product, protein_product,
exons_start, exons_stop,
locus_tag, codon_start,
cds_db_xref_geneid, cds_db_xref_hgnc
):
cds_db_xref_geneid, cds_db_xref_hgnc):
self.transcript_accession = transcript_accession
self.transcript_version = transcript_version
self.protein_accession = protein_accession
......@@ -184,6 +191,8 @@ class Transcript(dbgb.Base):
self.transcript_stop = transcript_stop
self.cds_start = cds_start
self.cds_stop = cds_stop
self.transcript_product = transcript_product
self.protein_product = protein_product
self.exons_start = exons_start
self.exons_stop = exons_stop
self.locus_tag = locus_tag
......
......@@ -217,6 +217,9 @@ def _get_mutalyzer_record(reference, db_transcripts):
'transcript_stop': transcript.transcript_stop,
'cds_start': transcript.cds_start,
'cds_stop': transcript.cds_stop,
'transcript_product': transcript.transcript_product,
'protein_product': transcript.protein_product,
'cds_stop': transcript.cds_stop,
'exons': [],
'exons_start': transcript.exons_start,
'exons_stop': transcript.exons_stop,
......@@ -226,10 +229,6 @@ def _get_mutalyzer_record(reference, db_transcripts):
transcript.protein_version,
'linkMethod': 'ncbi'
}
# if transcript.exons_start:
# starts = transcript.exons_start.split(',')
# if transcripts.exons_stop:
# stops = transcript.exons_stopts.split(',')
starts = map(int, transcript.exons_start.split(',')) if transcript.exons_start else None
stops = map(int, transcript.exons_stop.split(',')) if transcript.exons_stop else None
if (starts and stops) and (len(starts) == len(stops)):
......@@ -237,11 +236,6 @@ def _get_mutalyzer_record(reference, db_transcripts):
exon = {'start': start,
'stop': stop}
my_transcript['exons'].append(exon)
# if transcript.exons and isinstance(transcript.exons, list):
# for exon in transcript.exons:
# exon = {'start': exon.start,
# 'stop': exon.stop}
# my_transcript['exons'].append(exon)
transcripts.append(my_transcript)
# Generating the actual record entries in the Mutalyzer format.
......@@ -283,6 +277,8 @@ def _get_mutalyzer_record(reference, db_transcripts):
my_transcript.transcriptID = transcript['transcriptID']
my_transcript.proteinID = transcript['proteinID']
my_transcript.transcriptProduct = transcript['transcript_product']
my_transcript.proteinProduct = transcript['protein_product']
my_transcript.linkMethod = 'ncbi'
my_transcript.transcribe = True
my_transcript.translate = True
......
......@@ -1359,9 +1359,11 @@ class MutalyzerService(ServiceBase):
"Received request getTranscriptsAndInfo(%s, %s)" % (
genomicReference, geneName))
# We try first to
nc = False
# We try first to find it in the NC database.
if 'NC' in genomicReference:
record = get_entire_nc_record(genomicReference, geneName=geneName)
nc = True
else:
record = None
......@@ -1413,6 +1415,10 @@ class MutalyzerService(ServiceBase):
exon.cStop = transcript.CM.g2c(exon.gStop)
exon.chromStop = GenRecordInstance.record.toChromPos(
exon.gStop)
# To make it behave similarly for UDs and NCs.
if nc:
exon.chromStart = exon.gStart
exon.chromStop = exon.gStop
t.exons.append(exon)
# Beware that CM.info() gives a made-up value for trans_end,
......@@ -1454,6 +1460,13 @@ class MutalyzerService(ServiceBase):
t.proteinTranscript = None
# To make it behave similarly for UDs and NCs.
if nc:
t.chromTransEnd = t.gTransEnd
t.chromTransStart = t.gTransStart
t.chromCDSStart = t.gCDSStart
t.chromCDSStop = t.gCDSStop
if transcript.translate:
p = ProteinTranscript()
p.name = '%s_i%s' % (gene.name, transcript.name)
......
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