Skip to content
Snippets Groups Projects
Commit 54188c59 authored by Vermaat's avatar Vermaat
Browse files

Limit input sequence length for description extractor

This is hopefully a temporary measure. At the moment we cannot accurately
predict the running time of the extractor, so we have to aggressively
limit the input based on the worst-case expectation.

As a worst-case scenario, we currently use random input sequences, where
length 1000bp yields about 500ms of running time.

In the future we hope to either:

1. Predict the running time and abort if needed.
2. Keep track of the running time and abort if needed.
3. Run the extractor in a task scheduler with a running time limit.
parent ae2aa2c6
No related branches found
No related tags found
No related merge requests found
...@@ -1240,6 +1240,11 @@ class MutalyzerService(ServiceBase): ...@@ -1240,6 +1240,11 @@ class MutalyzerService(ServiceBase):
output.addMessage(__file__, -1, 'INFO', output.addMessage(__file__, -1, 'INFO',
'Received request descriptionExtract') 'Received request descriptionExtract')
if not settings.TESTING and (len(reference) > 1000 or
len(observed) > 1000):
raise Fault('EMAXSIZE',
'Input sequences are restricted to 1000bp.')
allele = extractor.describe_dna(reference, observed) allele = extractor.describe_dna(reference, observed)
result = Allele() result = Allele()
......
...@@ -5,7 +5,10 @@ ...@@ -5,7 +5,10 @@
{% block content %} {% block content %}
<p class="alert alert-warning">Note that this is an experimental service.</p> <p class="alert alert-warning">
Please note that this is an experimental service and we are currently limiting
input sequences to 1000bp.
</p>
<p> <p>
Extract the HGVS variant description from a reference sequence and an observed Extract the HGVS variant description from a reference sequence and an observed
...@@ -85,7 +88,7 @@ Please supply a reference sequence and an observed sequence. ...@@ -85,7 +88,7 @@ Please supply a reference sequence and an observed sequence.
<div class="form-group"> <div class="form-group">
<label for="reference_accession_number">Reference accession number</label> <label for="reference_accession_number">Reference accession number</label>
<input type="text" name="reference_accession_number" id="reference_accession_number" value="{{ reference_accession_number }}" class="form-control form-pre example-target" placeholder="Reference accession number"> <input type="text" name="reference_accession_number" id="reference_accession_number" value="{{ reference_accession_number }}" class="form-control form-pre example-target" placeholder="Reference accession number">
<p>Example: <code class="example-input" data-for="reference_accession_number">NM_004006.1</code></p> <p>Example: <code class="example-input" data-for="reference_accession_number">NM_198697.1</code></p>
</div> </div>
</div> </div>
</div> </div>
...@@ -140,7 +143,7 @@ Please supply a reference sequence and an observed sequence. ...@@ -140,7 +143,7 @@ Please supply a reference sequence and an observed sequence.
<div class="form-group"> <div class="form-group">
<label for="sample_accession_number">Sample accession number</label> <label for="sample_accession_number">Sample accession number</label>
<input type="text" name="sample_accession_number" id="sample_accession_number" value="{{ sample_accession_number }}" class="form-control form-pre example-target-2" placeholder="Sample accession number"> <input type="text" name="sample_accession_number" id="sample_accession_number" value="{{ sample_accession_number }}" class="form-control form-pre example-target-2" placeholder="Sample accession number">
<p>Example: <code class="example-input" data-for="sample_accession_number">NM_004006.2</code></p> <p>Example: <code class="example-input" data-for="sample_accession_number">NM_198697.2</code></p>
</div> </div>
</div> </div>
</div> </div>
......
...@@ -783,7 +783,11 @@ def description_extractor_submit(): ...@@ -783,7 +783,11 @@ def description_extractor_submit():
raw_vars = None raw_vars = None
if r and s: if r and s:
raw_vars = extractor.describe_dna(r, s) if not settings.TESTING and (len(r) > 1000 or len(s) > 1000):
output.addMessage(__file__, 3, 'EMAXSIZE',
'Input sequences are restricted to 1000bp.')
else:
raw_vars = extractor.describe_dna(r, s)
errors, warnings, summary = output.Summary() errors, warnings, summary = output.Summary()
messages = map(util.message_info, output.getMessages()) messages = map(util.message_info, output.getMessages())
......
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