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

Specify chromosome by name in reference file loader (#92)

git-svn-id: https://humgenprojects.lumc.nl/svn/mutalyzer/trunk@526 eb6bd6ab-9ccd-42b9-aceb-e2899b4a52f1
parent 160d3d0b
No related branches found
No related tags found
No related merge requests found
......@@ -3,21 +3,25 @@ function updateVisibility() {
document.getElementById('url_label').style.display = "none";
document.getElementById('gene_label').style.display = "none";
document.getElementById('range_label').style.display = "none";
document.getElementById('chrname_label').style.display = "none";
for (i = 0; i < document.invoer.invoermethode.length; i++) {
if (document.invoer.invoermethode[i].checked) {
if (document.invoer.invoermethode[i].value == 'file') {
file_label.style.display = "";
document.getElementById('file_label').style.display = "";
}
else if (document.invoer.invoermethode[i].value == 'url') {
url_label.style.display = "";
document.getElementById('url_label').style.display = "";
}
else if (document.invoer.invoermethode[i].value == 'gene') {
gene_label.style.display = "";
document.getElementById('gene_label').style.display = "";
}
else if (document.invoer.invoermethode[i].value == 'chr') {
range_label.style.display = "";
}
document.getElementById('range_label').style.display = "";
}
else if (document.invoer.invoermethode[i].value == 'chrname') {
document.getElementById('chrname_label').style.display = "";
}
}//if
}//for
}//updateVisibility
......@@ -52,7 +56,7 @@ function onloadBatch() {
function getHTTPObject(){
if (window.ActiveXObject)
return new ActiveXObject("Microsoft.XMLHTTP");
else if (window.XMLHttpRequest)
else if (window.XMLHttpRequest)
return new XMLHttpRequest();
else {
alert("Your browser does not support AJAX.");
......
......@@ -36,7 +36,10 @@
Retrieve part of the reference genome for a (HGNC) gene symbol<br>
<input type="radio" name="invoermethode" value='chr'
onClick="updateVisibility();">
Retrieve a range of a chromosome<br>
Retrieve a range of a chromosome by accession number<br>
<input type="radio" name="invoermethode" value='chrname'
onClick="updateVisibility();">
Retrieve a range of a chromosome by name<br>
</td>
</tr>
<tr height="20px"></tr>
......@@ -80,21 +83,59 @@
and specify the range</i><br>
<table>
<tr>
<td>Chromosome Accession Number</td>
<td>Chromosome accession number</td>
<td><input type='text' name="chracc"></td>
</tr>
<tr>
<td>Start Position</td>
<td>Start position</td>
<td><input type='text' name="start"></td>
</tr>
<tr>
<td>Stop Position</td>
<td>Stop position</td>
<td><input type='text' name="stop"></td>
</tr>
<tr>
<td>Orientation</td>
<td>
<select name = "orientation">
<select name="orientation">
<option value="1">Forward</option>
<option value="2">Reverse</option>
</select>
</td>
</tr>
</table>
</span>
<span id="chrname_label">
<i>Please enter the name of the chromosome
and specify the range</i><br>
<table>
<tr>
<td>Assembly</td>
<td>
<select name="chrnameassembly">
<option tal:repeat = "i available_assemblies"
tal:content = "i"
tal:attributes = "value i">
</option>
</select>
</td>
</tr>
<tr>
<td>Chromosome name</td>
<td><input type='text' name="chrname"></td>
</tr>
<tr>
<td>Start position</td>
<td><input type='text' name="chrnamestart"></td>
</tr>
<tr>
<td>Stop position</td>
<td><input type='text' name="chrnamestop"></td>
</tr>
<tr>
<td>Orientation</td>
<td>
<select name="chrnameorientation">
<option value="1">Forward</option>
<option value="2">Reverse</option>
</select>
......
......@@ -19,7 +19,7 @@
<script
type="text/javascript"
language="javascript"
src="base/js/interface.js">
src="base/js/interface.js?20120511">
</script>
<script
type="text/javascript"
......
......@@ -571,6 +571,7 @@ class PositionConverter:
'Received request positionConverter(%s, %s) from %s' % (
build, variant, IP))
# Todo: check for correct build.
converter = Converter(build, output)
#Convert chr accNo to NC number
......@@ -1246,11 +1247,13 @@ class Uploader:
Render reference sequence uploader form.
"""
maxUploadSize = config.get('maxDldSize')
available_assemblies = config.get('dbNames')[::-1]
UD, errors = "", []
args = {
"UD" : UD,
"maxSize" : float(maxUploadSize) / 1048576,
"errors" : errors
'UD' : UD,
'available_assemblies' : available_assemblies,
'maxSize' : float(maxUploadSize) / 1048576,
'errors' : errors
}
return render.gbupload(args)
#GET
......@@ -1264,10 +1267,12 @@ class Uploader:
1. The reference sequence file is a local file.
2. The reference sequence file can be found at the following URL.
3. Retrieve part of the reference genome for a (HGNC) gene symbol.
4. Retrieve a range of a chromosome.
4. Retrieve a range of a chromosome by accession number.
5. Retrieve a range of a chromosome by name.
Parameters:
- invoermethode: Input method. One of 'file', 'url', 'gene', 'chr'.
- invoermethode: Input method. One of 'file', 'url', 'gene', 'chr',
'chrname'.
Depending on the input method, additional parameters are expected.
......@@ -1288,8 +1293,16 @@ class Uploader:
- start: Start position.
- stop: Stop position.
- orientation: Orientation.
Parameters (method 'chrname'):
- chrnameassembly: Genome assembly (probably 'hg18' or 'hg19').
- chrname: Chromosome name.
- chrnamestart: Start position.
- chrnamestop: Stop position.
- chrnameorientation: Orientation.
"""
maxUploadSize = config.get('maxDldSize')
available_assemblies = config.get('dbNames')[::-1]
O = Output(__file__)
IP = web.ctx["ip"]
......@@ -1300,13 +1313,16 @@ class Uploader:
i = web.input(invoermethode='', bestandsveld={}, urlveld='',
genesymbol='', organism='', fiveutr='', threeutr='',
chracc='', start='', stop='', orientation='')
chracc='', start='', stop='', orientation='',
chrnameassembly='', chrname='', chrnamestart='',
chrnamestop='', chrnameorientation='')
O.addMessage(__file__, -1, 'INFO',
'Received request'
' upload(%s, %s, %s, %s, %s, %s, %s, %s, %s, %s) from %s' % (
' upload(%s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s) from %s' % (
i.invoermethode, i.urlveld, i.genesymbol, i.organism, i.fiveutr,
i.threeutr, i.chracc, i.start, i.stop, i.orientation, IP))
i.threeutr, i.chracc, i.start, i.stop, i.orientation, i.chrnameassembly,
i.chrname, i.chrnamestart, i.chrnamestop, i.chrnameorientation, IP))
try:
if i.invoermethode == "file":
......@@ -1347,6 +1363,27 @@ class Uploader:
stop = _checkInt(i.stop, "Stop position")
orientation = int(i.orientation)
UD = R.retrieveslice(accNo, start, stop, orientation)
elif i.invoermethode == "chrname":
build = i.chrnameassembly
name = i.chrname
start = _checkInt(i.chrnamestart, "Start position")
stop = _checkInt(i.chrnamestop, "Stop position")
orientation = int(i.chrnameorientation)
if build not in available_assemblies:
raise InputException('Assembly not available: %s' % build)
if not name.startswith('chr'):
name = 'chr%s' % name
database = Db.Mapping(build)
accession = database.chromAcc(name)
if not accession:
raise InputException('Chromosome not available for build %s: %s' %
(build, name))
UD = R.retrieveslice(accession, start, stop, orientation)
else:
#unknown "invoermethode"
raise InputException("Wrong method selected")
......@@ -1361,15 +1398,17 @@ class Uploader:
errors.extend(map(lambda m: str(m), O.getMessages()))
args = {
"UD" : UD,
"maxSize" : float(maxUploadSize) / 1048576,
"errors" : errors
"UD" : UD,
'available_assemblies' : available_assemblies,
"maxSize" : float(maxUploadSize) / 1048576,
"errors" : errors
}
O.addMessage(__file__, -1, 'INFO',
'Finished request upload(%s, %s, %s, %s, %s, %s, %s, %s, %s, %s)' \
'Finished request upload(%s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s)' \
% (i.invoermethode, i.urlveld, i.genesymbol, i.organism,
i.fiveutr, i.threeutr, i.chracc, i.start, i.stop, i.orientation))
i.fiveutr, i.threeutr, i.chracc, i.start, i.stop, i.orientation,
i.chrnameassembly, i.chrname, i.chrnamestart, i.chrnamestop, i.chrnameorientation))
return render.gbupload(args)
#POST
......
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