vasilisNt commited on
Commit
ae9cb77
1 Parent(s): 714e1da

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +22 -1
app.py CHANGED
@@ -49,17 +49,38 @@ def plot_interactive(uniprot_id, show_clinvar=False):
49
  )
50
  if show_clinvar:
51
  iso_clinvar = clinvar[clinvar.LLR_file_id == uniprot_id]
 
 
 
52
  hwt_x=[]
53
  hwt_y=[]
54
  cust=[]
 
 
 
55
  for i in primaryLLR.columns:
56
  for j in list(primaryLLR.index):
57
  mut = i[0]+i[2:]+j
58
- if mut in iso_clinvar.variant.values:
59
  hwt_x+=[i]
60
  hwt_y+=[j]
61
  cust+=[primaryLLR.loc[j,i]]
 
 
 
 
62
 
 
 
 
 
 
 
 
 
 
 
 
63
  fig.add_trace(go.Scatter(
64
  x=hwt_x,
65
  y=hwt_y,
 
49
  )
50
  if show_clinvar:
51
  iso_clinvar = clinvar[clinvar.LLR_file_id == uniprot_id]
52
+ iso_clinvar = iso_clinvar[iso_clinvar.ClinicalSignificance.isin(['Benign','Pathogenic'])]
53
+ b_mut=set(iso_clinvar[iso_clinvar.ClinicalSignificance=='Benign'].variant.values)
54
+ p_mut=set(iso_clinvar[iso_clinvar.ClinicalSignificance=='Pathogenic'].variant.values)
55
  hwt_x=[]
56
  hwt_y=[]
57
  cust=[]
58
+ phwt_x=[]
59
+ phwt_y=[]
60
+ pcust=[]
61
  for i in primaryLLR.columns:
62
  for j in list(primaryLLR.index):
63
  mut = i[0]+i[2:]+j
64
+ if mut in b_mut:
65
  hwt_x+=[i]
66
  hwt_y+=[j]
67
  cust+=[primaryLLR.loc[j,i]]
68
+ elif mut in p_mut:
69
+ phwt_x+=[i]
70
+ phwt_y+=[j]
71
+ pcust+=[primaryLLR.loc[j,i]]
72
 
73
+ fig.add_trace(go.Scatter(
74
+ x=phwt_x,
75
+ y=phwt_y,
76
+ customdata=pcust,
77
+ mode='markers',
78
+ marker=dict(size=8),
79
+ hovertemplate="<br>".join([
80
+ "<b>%{x} %{y}</b>"+
81
+ " (%{customdata:.2f})",
82
+ ])+'<extra></extra>')
83
+ )
84
  fig.add_trace(go.Scatter(
85
  x=hwt_x,
86
  y=hwt_y,