Skip to content
Snippets Groups Projects
Commit 7957573b authored by Vermaat's avatar Vermaat
Browse files

Add chromosomal positions to getTranscriptsAndInfo webservice (#86)

git-svn-id: https://humgenprojects.lumc.nl/svn/mutalyzer/trunk@476 eb6bd6ab-9ccd-42b9-aceb-e2899b4a52f1
parent fbd397a5
No related branches found
No related tags found
No related merge requests found
......@@ -40,15 +40,18 @@ def main(genomic_reference, gene=None):
Locus tag: %s
Link method: %s
Translation:
Start: %s (c), %s (g)
End: %s (c), %s (g)
Start: %s (c), %s (g), %s (chrom)
End: %s (c), %s (g), %s (chrom)
Sortable end: %s
CDS:
Start: %s (c), %s (g)
End: %s (c), %s (g)""" % \
Start: %s (c), %s (g), %s (chrom)
End: %s (c), %s (g), %s (chrom)""" % \
(t.name, t.id, t.product, t.locusTag, t.linkMethod, t.cTransStart,
t.gTransStart, t.cTransEnd, t.gTransEnd, t.sortableTransEnd,
t.cCDSStart, t.gCDSStart, t.cCDSStop, t.gCDSStop)
t.gTransStart, t.chromTransStart if 'chromTransStart' in t else '-',
t.cTransEnd, t.gTransEnd, t.chromTransEnd if 'chromTransEnd' in t else '-',
t.sortableTransEnd, t.cCDSStart, t.gCDSStart,
t.chromCDSStart if 'chromCDSStart' in t else '-', t.cCDSStop, t.gCDSStop,
t.chromCDSStop if 'chromCDSStop' in t else '-')
if 'proteinTranscript' in t:
print """ Protein:
......@@ -61,8 +64,10 @@ def main(genomic_reference, gene=None):
if 'exons' in t:
print ' Exons:'
for e in t.exons.ExonInfo:
print ' %s - %s (c), %s - %s (g)' % \
(e.cStart, e.cStop, e.gStart, e.gStop)
print ' %s - %s (c), %s - %s (g), %s - %s (chrom)' % \
(e.cStart, e.cStop, e.gStart, e.gStop,
e.chromStart if 'chromStart' in e else '-',
e.chromStop if 'chromStop' in e else '-')
if __name__ == '__main__':
......
......@@ -351,6 +351,8 @@ class Record(object) :
@return: chromosomal g. position
@rtype: integer
"""
if not self.chromOffset:
return None
if self.orientation == 1 :
return self.chromOffset + i - 1
......
......@@ -147,8 +147,10 @@ class ExonInfo(ClassModel):
cStart = Mandatory.String
gStart = Mandatory.Integer
chromStart = Integer
cStop = Mandatory.String
gStop = Mandatory.Integer
chromStop = Integer
#ExonInfo
......@@ -168,9 +170,11 @@ class TranscriptInfo(ClassModel):
"""
Used in return type of SOAP method getTranscriptsAndInfo.
@todo: Decide on 'stop' versus 'end'. Web interface uses 'stop' for
both trans and CDS. Ivar asked for 'end'. Internally, we have
trans 'end' and CDS 'stop'.
@todo: Decide on 'stop' versus 'end'. Web interface uses 'stop' for both
trans and CDS. Ivar asked for 'end'. Internally, we have trans 'end'
and CDS 'stop'.
@todo: We should really also provide the chromosome (or its accession
number) next to the chromosomal positions, if available.
"""
__namespace__ = SOAP_NAMESPACE
......@@ -180,14 +184,18 @@ class TranscriptInfo(ClassModel):
cTransStart = Mandatory.String
gTransStart = Mandatory.Integer
chromTransStart = Integer
cTransEnd = Mandatory.String
gTransEnd = Mandatory.Integer
chromTransEnd = Integer
sortableTransEnd = Mandatory.Integer
cCDSStart = Mandatory.String
gCDSStart = Mandatory.Integer
chromCDSStart = Integer
cCDSStop = Mandatory.String
gCDSStop = Mandatory.Integer
chromCDSStop = Integer
locusTag = Mandatory.String
linkMethod = Mandatory.String
......
......@@ -501,7 +501,11 @@ class GBparser():
geneDict = {}
accInfo = biorecord.annotations['accessions']
if len(accInfo) >= 3 and accInfo[1] == "REGION:" :
if len(accInfo) >= 3 and accInfo[1] == "REGION:":
# Todo: This information is present in the genbank file if it is a
# UD sliced from a chromosome. We can get the same information
# for NM references from our mapping database and that way
# also provide chromosomal variant descriptions for those.
region = accInfo[2]
if "complement" in region :
record.orientation = -1
......
......@@ -787,20 +787,26 @@ class MutalyzerService(DefinitionBase):
- product
- cTransStart
- gTransStart
- chromTransStart
- cTransEnd
- gTransEnd
- chromTransEnd
- sortableTransEnd
- cCDSStart
- gCDSStart
- chromCDSStart
- cCDSStop
- gCDSStop
- chromCDSStop
- locusTag
- linkMethod
- exons: Array of ExonInfo objects with fields:
- cStart
- gStart
- chromStart
- cStop
- gStop
- chromStop
- proteinTranscript: ProteinTranscript object with fields:
- name
- id
......@@ -847,8 +853,10 @@ class MutalyzerService(DefinitionBase):
exon = ExonInfo()
exon.gStart = transcript.CM.getSpliceSite(i)
exon.cStart = transcript.CM.g2c(exon.gStart)
exon.chromStart = GenRecordInstance.record.toChromPos(exon.gStart)
exon.gStop = transcript.CM.getSpliceSite(i + 1)
exon.cStop = transcript.CM.g2c(exon.gStop)
exon.chromStop = GenRecordInstance.record.toChromPos(exon.gStop)
t.exons.append(exon)
# Beware that CM.info() gives a made-up value for trans_end,
......@@ -861,6 +869,7 @@ class MutalyzerService(DefinitionBase):
t.cTransEnd = str(t.exons[-1].cStop)
t.gTransEnd = t.exons[-1].gStop
t.chromTransEnd = GenRecordInstance.record.toChromPos(t.gTransEnd)
t.sortableTransEnd = sortable_trans_end
# Todo: If we have no CDS info, CM.info() gives trans_end as
......@@ -873,10 +882,13 @@ class MutalyzerService(DefinitionBase):
t.product = transcript.transcriptProduct
t.cTransStart = str(trans_start)
t.gTransStart = transcript.CM.x2g(trans_start, 0)
t.chromTransStart = GenRecordInstance.record.toChromPos(t.gTransStart)
t.cCDSStart = str(cds_start)
t.gCDSStart = transcript.CM.x2g(cds_start, 0)
t.chromCDSStart = GenRecordInstance.record.toChromPos(t.gCDSStart)
t.cCDSStop = str(cds_stop)
t.gCDSStop = transcript.CM.x2g(cds_stop, 0)
t.chromCDSStop = GenRecordInstance.record.toChromPos(t.gCDSStop)
t.locusTag = transcript.locusTag
t.linkMethod = transcript.linkMethod
......@@ -948,6 +960,10 @@ class MutalyzerService(DefinitionBase):
def sliceChromosome(self, chromAccNo, start, end, orientation) :
"""
Todo: documentation, error handling, argument checking, tests.
@arg orientation: Orientation of the slice. 1 for forward, 2 for
reverse complement.
@type orientation: integer
"""
O = Output(__file__)
D = Db.Cache()
......
......@@ -59,8 +59,8 @@ class TestWebservice():
@todo: Start the standalone server and stop it in self.tearDown
instead of depending on some running instance at a fixed address.
"""
self.client = Client(WSDL_URL, cache=None)
#self.client.options.cache.setduration(seconds=120)
self.client = Client(WSDL_URL) #, cache=None)
self.client.options.cache.setduration(seconds=120)
def test_checksyntax_valid(self):
"""
......@@ -400,3 +400,37 @@ class TestWebservice():
assert_equal(r.sourceVersion, '1')
assert_equal(r.sourceGi, '256574794')
assert_equal(r.molecule, 'g')
@skip
def test_gettranscriptsandinfo_slice(self):
"""
Running getTranscriptsAndInfo on a chromosomal slice should include
chromosomal positions.
slice: 48284000 - 48259456 (COL1A1 with 5001 and 2001 borders)
translation start: 48284000 - 5001 + 1 = 48279000
translation end: 48259456 + 2001 = 48261457
Todo: We cannot use UD references in unit tests, unless we implement
a way to create them inside the unit test.
"""
r = self.client.service.getTranscriptsAndInfo('UD_129646580028')
assert_equal(type(r.TranscriptInfo), list)
names = [t.name for t in r.TranscriptInfo]
assert 'COL1A1_v001' in names
for t in r.TranscriptInfo:
if t.name != 'COL1A1_v001':
continue
assert_equal(t.cTransStart, '-126')
assert_equal(t.gTransStart, 5001)
assert_equal(t.chromTransStart, 48279000)
assert_equal(t.cTransEnd, '*1406')
assert_equal(t.gTransEnd, 22544)
assert_equal(t.chromTransEnd, 48261457)
assert_equal(t.sortableTransEnd, 5801)
assert_equal(t.cCDSStart, '1')
assert_equal(t.gCDSStart, 5127)
assert_equal(t.chromCDSStart, 48278874)
assert_equal(t.cCDSStop, '4395')
assert_equal(t.gCDSStop, 21138)
assert_equal(t.chromCDSStop, 48262863)
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment