Commit 70e37e1b authored by Nijveen, Harm's avatar Nijveen, Harm
Browse files

added simple search option to cistrans plot

parent f0750b0b
......@@ -27,11 +27,8 @@
<li><a href="/AraQTL/?mode=correlation">Correlation</a></li>
<li><a href="/AraQTL/?mode=coregulation">Marker</a></li>
<form class="navbar-form navbar-left" action="/AraQTL/cistrans/" id="top_form" method="get">
<input title="LOD score threshold (numeric, one decimal)" id="thld"
pattern="[0-9]+([.][0-9])?"
name="thld" type="text"
size="3" class="form-control"
value="{% if thld %}{{ thld|floatformat:-1}}{% else %}{{ lodthld|floatformat:-1 }}{% endif %}">
<input title="Type your query here" id="query" name="query" type="text" class="form-control"
placeholder="Search...">
<select title="Select an experiment" class="form-control" id="experiment_selector" name="experiment_name">
{% for experiment in experiments %}
<option value="{{ experiment.experiment_name }}" {% if experiment.experiment_name == experiment_name %} selected {% endif %}>
......@@ -39,6 +36,11 @@
</option>
{% endfor %}
</select>
LOD:<input title="LOD score threshold (numeric, one decimal)" id="thld"
pattern="[0-9]+([.][0-9])?"
name="thld" type="text"
size="3" class="form-control"
value="{% if thld %}{{ thld|floatformat:-1}}{% else %}{{ lodthld|floatformat:-1 }}{% endif %}">
</form>
<li class="dropdown">
<a class="dropdown-toggle" data-toggle="dropdown" href="#">Help
......@@ -257,7 +259,7 @@
//############################### add Y-axis name upper left ##################################
xloc = left[0] - pad.left * 0.65; // xloc and yloc together locate the title lable in the middle of y axis.
yloc = (top[0] + bottom[0]) / 2;
axislabels.append("text").text("probe position (bp)").attr("x", xloc).attr("y", yloc).attr("transform", "rotate(270," + xloc + "," + yloc + ")").style("text-anchor", "middle").attr("fill", titlecolor);
axislabels.append("text").text("Gene position (bp)").attr("x", xloc).attr("y", yloc).attr("transform", "rotate(270," + xloc + "," + yloc + ")").style("text-anchor", "middle").attr("fill", titlecolor);
//############################### add Y-axis name lower #######################################
xloc = left[1] - pad.left * 0.65;
yloc = (top[1] + bottom[1]) / 2;
......@@ -533,10 +535,39 @@
});
$('input#thld').keypress(function(e) {
$('input#thld').keypress(function(e) {
if(e.which == 13) {
$('form#top_form').submit();
}
});
selectedProbe = "";
attrR = 0
attrFill = "";
attrStroke = "";
attrStroke_width = 0;
attrOpacity = 0;
$('input#query').keypress(function(e) {
if(e.which == 13) {
spot = $('input#query').val()
probe = "circle.probe_" + spot;
if (selectedProbe.length > 0) {
d3.selectAll(selectedProbe).attr("r", attrR).attr("fill", attrFill).attr("stroke", attrStroke).attr("stroke-width", attrStroke_width).attr("opacity", attrOpacity);
selectedProbe = "";
}
if(!d3.select(probe).empty()) {
selectedProbe = probe;
d3Probe = d3.selectAll(probe);
attrR = d3Probe.attr("r");
attrFill = d3Probe.attr("fill");
attrStroke = d3Probe.attr("stroke");
attrStroke_width = d3Probe.attr("stroke-width");
attrOpacity = d3Probe.attr("opacity");
d3Probe.attr("r", 5).attr("fill", "hotpink").attr("stroke", "darkslateblue").attr("stroke-width", 1).attr("opacity", 1);
d3.json("../media/data/{{ experiment_name }}/probe/" + spot + ".json", draw_plot);
}
}
});
</script>
{% endblock %}
......@@ -5,7 +5,7 @@ from django.shortcuts import render, render_to_response
from django.conf import settings
from main.models import ArraySpot, Experiment, Marker, Chromosome, GeneInfo
from main.parser import outputJSON
#from main.parser import outputJSON
# Create your views here.
......@@ -184,6 +184,9 @@ def outputJson(experiment_name, qtl_file, thld, output):
for line in lines:
j += 1
col = line.rstrip().split('\t')
#check if the transcript/gene id exists in the database
if col[0].upper() not in output_dic['spot']:
continue
# assign LOD value to 0 if null
lod_list = [float(lod) if lod != '' else 0.0 for lod in col[1:]]
k = 0 # splice index
......@@ -279,4 +282,4 @@ def outputJson(experiment_name, qtl_file, thld, output):
with open(out_path, 'w') as fo:
json.dump(output_dic, fo, indent=4)
print i, j
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