Commit 87f1434f authored by Mathieu Courcelles's avatar Mathieu Courcelles

Merge branch 'dev' into 'master'

Dev

See merge request !22
parents c3329b72 29a518a2
Pipeline #15351239 passed with stages
in 1 minute and 14 seconds
......@@ -133,7 +133,8 @@ class quantificationForm(forms.Form):
COLOR_CHOICES = (
('default', 'default'),
('score', 'Peptide score'),
('quant', 'Peptide fold change')
('quant', 'Peptide fold change'),
('validation', 'Validation')
)
color_scheme = forms.ChoiceField(choices=COLOR_CHOICES)
......
......@@ -522,7 +522,8 @@ class CLPeptide(AdminURLMixin, models.Model):
self.link_type = 'Linear peptide'
deadend_keywords = ['bs3', 'bs2g', 'adh_oh']
deadend_keywords = ['bs3', 'bs2g', 'adh_oh',
'[156.08]']
pepseq = self.peptide1
pepseq = re.sub('Cm', 'C', pepseq)
......
......@@ -11,11 +11,11 @@ $(function () {
$('#container').width(Math.floor($('body').innerWidth()/3));
$('#container').highcharts({
$('#container_histo').width(Math.floor($('body').innerWidth()/3));
$('#container_histo').highcharts({
chart: {
renderTo: 'container',
renderTo: 'container_histo',
type: 'column',
zoomType: 'x',
events: {
......@@ -117,7 +117,7 @@ $(function () {
<div id="container" style="width:500px;height:250px;">
<div id="container_histo" style="width:500px;height:250px;">
<font size=2>
<img src="{% static "img/ajax-loader.gif" %}" style="visibility:hidden; width:0px;height:0px;"/>
<br /><img src="{% static "img/ajax-loader.gif" %}" /> Generating chart...please wait...
......
......@@ -175,6 +175,18 @@
else if(scale_type == 'score') {
color_command = 'color measure [x' + scale(position['score']).substring(1) + ']; '
}
else if(scale_type == 'validation') {
status = validation[position['pk']];
colors = {};
colors['G'] = '00a65a';
colors['Y'] = 'f39c12';
colors['R'] = 'dd4b39';
colors[''] = '999999';
color_command = 'color measure [x' + colors[status] + ']; '
}
else {
color_command = 'color measure [x999999]; '
}
......@@ -206,6 +218,14 @@
{% endfor %}
};
validation = {
{% for clpep in validation_list %}
{{clpep.pk}}: '{{clpep.validated}}',
{% endfor %}
};
var coloredLabeled = {};
......@@ -444,7 +464,7 @@
<br /><br />
{% endfor %}
<strong>Show/hide chain: </strong`>
<strong>Show/hide chain: </strong>
{% for chain in chain_list %}
{% if chain != "," and chain != " " %}
{{chain|upper}}
......@@ -458,7 +478,7 @@
<br /><br /><br />
{% include 'histogram.html' %}
</td><td valign="top">
<table border=1 id="cl_table">
......
......@@ -214,6 +214,12 @@ quant = {
{% for quant_clpep in quant_set %}
{{quant_clpep.clpeptide.pk}}: {{quant_clpep.fold_change}},
{% endfor %}
};
validation = {
{% for clpep in clpeptide_set %}
{{clpep.pk}}: '{{clpep.validated}}',
{% endfor %}
};
// synchFilters();
......
......@@ -57,16 +57,30 @@ def alive(request):
return HttpResponse(status=204)
def format_peptide_seq_with_mod(peptide):
def format_peptide_seq_with_mod(peptide, _15n=False):
"""
Formats peptide sequence string with modification for spectrum viewer.
:param peptide: Peptide object
:param _15n: Peptide is 15N labelled
:return: Peptide sequence string with modification symbols.
"""
for modification, symbol in modification_name_symbol.items():
peptide = peptide.replace(modification, symbol)
if _15n:
tmp = list()
for char in peptide:
tmp += char
if char == char.upper():
tmp += '15'
peptide = ''.join(tmp)
return peptide
......@@ -110,11 +124,20 @@ def clpeptide_msms(request, pk):
if clpeptide.validated == '':
clpeptide.validated = None
pep1_15n = False
pep2_15n = False
if clpeptide.display_protein1.startswith('15N_'):
pep1_15n = True
if clpeptide.display_protein2.startswith('15N_'):
pep2_15n = True
context = {
'myTolerance': 10,
'myPrecursorZ': clpeptide.precursor_charge,
'myPeptide': format_peptide_seq_with_mod(clpeptide.peptide1),
'myPeptide2': format_peptide_seq_with_mod(clpeptide.peptide2),
'myPeptide': format_peptide_seq_with_mod(clpeptide.peptide1, _15n=pep1_15n),
'myPeptide2': format_peptide_seq_with_mod(clpeptide.peptide2, _15n=pep2_15n),
'myPeaklist': peak_list,
'clpeptide': clpeptide,
'validation_disabled': validation_disabled,
......@@ -168,10 +191,10 @@ def xiNET_view(request, clpeptide_set, form):
for quant in quant_set:
absoluate_value = abs(quant.fold_change)
absolute_value = abs(quant.fold_change)
if absoluate_value > limit:
limit = absoluate_value
if absolute_value > limit:
limit = absolute_value
else:
limit = form.cleaned_data['fold_change_limit']
......@@ -208,6 +231,7 @@ def jsmol_view(request, clpeptide_set, form=None):
return HttpResponse('<h1>%s</h1>' % e)
cross_links = []
validation_list = list()
cl_count = len(clpeptide_set)
mapped_cl_count = 0
......@@ -278,6 +302,8 @@ def jsmol_view(request, clpeptide_set, form=None):
cldistance.identity_2,
))
validation_list.append(clpep)
if min_distance != 1000000000000:
min_distance_list.append(min_distance)
......@@ -390,7 +416,9 @@ def jsmol_view(request, clpeptide_set, form=None):
'draw_count': draw_count,
'p_value': p_value_str,
'min_score': form.cleaned_data['min_score'],
'max_score': form.cleaned_data['max_score']
'max_score': form.cleaned_data['max_score'],
'validation_list': validation_list
}
return render(request, 'jsmol.html', c)
......@@ -351,6 +351,45 @@ ResidueLink.prototype.check = function(filter) {
this.line.setAttribute("stroke", scale(sum/count));
}
}
// Recolor link based on validation status
if(scale_type == 'validation') {
status = ''
for(i = 0; i < filteredMatches.length; i++) {
if(validation[filteredMatches[i]['id']]) {
value = validation[filteredMatches[i]['id']];
if(status == '' && value != '') {
status = value;
}
else if (status == 'G') {
}
else if (status == 'Y' && value == 'G') {
status = value;
}
else if (status == 'R' && (value == 'G' || value == 'Y')) {
status = value;
}
}
}
if(status == 'G') {
this.line.setAttribute("stroke", '#00a65a');
}
else if(status == 'Y') {
this.line.setAttribute("stroke", '#f39c12');
}
else if(status == 'R') {
this.line.setAttribute("stroke", '#dd4b39');
}
else {
this.line.setAttribute("stroke", 'gray');
}
}
......
......@@ -860,7 +860,7 @@ AA.prototype.vfragmentxlinkpeptide2 = function(pep_a_seq, pep_b_seq, a_link_pos,
allfrags = iparents;
if(! is2ndpep)
allfrags = [iparents[0]];
for(var i=0; i< frag1list.length; i++){
allfrags.push(frag1list[i]);
if(params.fragrounds == 2){
......@@ -921,7 +921,7 @@ AA.prototype.vfragmentxlinkpeptide2 = function(pep_a_seq, pep_b_seq, a_link_pos,
// name them!
allfrags[i] = {"type":type,"frag":frag[1],"name": frag[1], "seq": frag[0], "tok":[], "mask":[], "lost":[], "lostform":[]};
}
// calculate the loss combinations for each fragment... we might try to limit this to 2!
/*
losses table format:
......
......@@ -414,7 +414,26 @@ Z {{ linked_formula }}
dss C8H12O3
me CH2
dme C2H4
G15 15NH2CH2COOH -H2 -O
A15 15NCH3CHH2COOH -H2 -O
S15 15NHOCH2CHH2COOH -H2 -O
P15 15NHCH2CH2CH2CHCOOH -H2 -O
V15 15NCH3CH3CHCHH2COOH -H2 -O
T15 15NCH3CHOHCHH2COOH -H2 -O
C15 15NHSCH2CHH2COOH -H2 -O
I15 15NCH3CH2CHCH3CHH2COOH -H2 -O
L15 15NCH3CH3CHCH2CHH2COOH -H2 -O
N15 15N2H2COCH2CHH2COOH -H2 -O
D15 15NHOOCCH2CHH2COOH -H2 -O
Q15 15N2H2COCH2CH2CHH2COOH -H2 -O
K15 15N2H2CH2CH2CH2CH2CHH2COOH -H2 -O
E15 15NHOOCCH2CH2CHH2COOH -H2 -O
M15 15NCH3SCH2CH2CHH2COOH -H2 -O
H15 15N3HCHCHCCH2CHH2COOH -H2 -O
F15 15NC6H5CH2CHH2COOH -H2 -O
R15 15N4HCH2HCH2CH2CH2CHH2COOH -H2 -O
Y15 15NHOC6H4CH2CHH2COOH -H2 -O
W15 15N2C6H5HCHCCH2CHH2COOH -H2 -O
</textarea></div>
......
Markdown is supported
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