maom commited on
Commit
9752475
·
verified ·
1 Parent(s): 44662fb

add expression to the chart data to have it make sense in the downloaded output

Browse files
Files changed (1) hide show
  1. app.py +8 -4
app.py CHANGED
@@ -87,8 +87,12 @@ except:
87
  st.error(f"Unable to locate cnag_id for Gene ID 2: {gene_id_2}, it should be of the form 'CNAG_######'")
88
 
89
  chart_data = pd.DataFrame({
90
- "expression_1": np.log10(estimated_expression.loc[h99_transcript_annotations["gene_id"] == gene_id_1].to_numpy()[0] + 1),
91
- "expression_2": np.log10(estimated_expression.loc[h99_transcript_annotations["gene_id"] == gene_id_2].to_numpy()[0] + 1),
 
 
 
 
92
  "run_accession": estimated_expression.columns})
93
  chart_data = chart_data.merge(
94
  right = estimated_expression_meta,
@@ -122,8 +126,8 @@ chart = (
122
  height = 750)
123
  .mark_circle()
124
  .encode(
125
- x=alt.X("expression_1", title=f"{gene_id_1} Expression"),
126
- y=alt.Y("expression_2", title=f"{gene_id_2} Expression"),
127
  color=alt.Color("study_accession", title="Study Accession"),
128
  tooltip=["run_accession", "study_accession"]))
129
 
 
87
  st.error(f"Unable to locate cnag_id for Gene ID 2: {gene_id_2}, it should be of the form 'CNAG_######'")
88
 
89
  chart_data = pd.DataFrame({
90
+ "gene_id_1": gene_id_1,
91
+ "gene_id_2": gene_id_2,
92
+ "expression_1": estimated_expression.loc[h99_transcript_annotations["gene_id"] == gene_id_1].to_numpy()[0],
93
+ "expression_2": estimated_expression.loc[h99_transcript_annotations["gene_id"] == gene_id_2].to_numpy()[0]
94
+ "log_expression_1": np.log10(estimated_expression.loc[h99_transcript_annotations["gene_id"] == gene_id_1].to_numpy()[0] + 1),
95
+ "log_expression_2": np.log10(estimated_expression.loc[h99_transcript_annotations["gene_id"] == gene_id_2].to_numpy()[0] + 1),
96
  "run_accession": estimated_expression.columns})
97
  chart_data = chart_data.merge(
98
  right = estimated_expression_meta,
 
126
  height = 750)
127
  .mark_circle()
128
  .encode(
129
+ x=alt.X("log_expression_1", title=f"Log10[{gene_id_1}+1] Expression"),
130
+ y=alt.Y("log_expression_2", title=f"Log10[{gene_id_2}+1] Expression"),
131
  color=alt.Color("study_accession", title="Study Accession"),
132
  tooltip=["run_accession", "study_accession"]))
133