Valmbd commited on
Commit
53af87a
·
verified ·
1 Parent(s): 1746b3f

Add disp_profile sampling for sparklines

Browse files
Files changed (1) hide show
  1. app/utils/data_loader.py +4 -1
app/utils/data_loader.py CHANGED
@@ -91,6 +91,7 @@ def load_prediction_index(pred_dir: str) -> pd.DataFrame:
91
  "mean_disp_m0": v.get("mean_disp", 0.0),
92
  "max_disp_m0": v.get("max_disp", 0.0),
93
  "top_residue": -1,
 
94
  })
95
  else:
96
  # No index.json or empty — scan zip for _mode_0.txt files
@@ -109,6 +110,7 @@ def load_prediction_index(pred_dir: str) -> pd.DataFrame:
109
  "mean_disp_m0": float(mag.mean()),
110
  "max_disp_m0": float(mag.max()),
111
  "top_residue": int(np.argmax(mag)) + 1,
 
112
  })
113
  except Exception:
114
  continue
@@ -136,12 +138,13 @@ def load_prediction_index(pred_dir: str) -> pd.DataFrame:
136
  "mean_disp_m0": float(mag.mean()),
137
  "max_disp_m0": float(mag.max()),
138
  "top_residue": int(np.argmax(mag)) + 1,
 
139
  })
140
  except Exception:
141
  continue
142
 
143
  if not rows:
144
- return pd.DataFrame(columns=["name", "seq_len", "n_modes", "mean_disp_m0", "max_disp_m0", "top_residue"])
145
  return pd.DataFrame(rows).sort_values("name").reset_index(drop=True)
146
 
147
 
 
91
  "mean_disp_m0": v.get("mean_disp", 0.0),
92
  "max_disp_m0": v.get("max_disp", 0.0),
93
  "top_residue": -1,
94
+ "disp_profile": v.get("disp_profile", []),
95
  })
96
  else:
97
  # No index.json or empty — scan zip for _mode_0.txt files
 
110
  "mean_disp_m0": float(mag.mean()),
111
  "max_disp_m0": float(mag.max()),
112
  "top_residue": int(np.argmax(mag)) + 1,
113
+ "disp_profile": mag[::max(1, len(mag)//20)].tolist(),
114
  })
115
  except Exception:
116
  continue
 
138
  "mean_disp_m0": float(mag.mean()),
139
  "max_disp_m0": float(mag.max()),
140
  "top_residue": int(np.argmax(mag)) + 1,
141
+ "disp_profile": mag[::max(1, len(mag)//20)].tolist(),
142
  })
143
  except Exception:
144
  continue
145
 
146
  if not rows:
147
+ return pd.DataFrame(columns=["name", "seq_len", "n_modes", "mean_disp_m0", "max_disp_m0", "top_residue", "disp_profile"])
148
  return pd.DataFrame(rows).sort_values("name").reset_index(drop=True)
149
 
150