Hi MEBOCOST developers,
I noticed that _blood_correct_test_() exposes a commu_score_col argument, and the official multisample demo calls it with commu_score_col='Norm_Commu_Score', but the current implementation appears to ignore this argument and always uses Commu_Score for the regression and correction.
Where
In src/mebocost/mebocost.py:
https://github.com/kaifuchenlab/MEBOCOST/blob/main/src/mebocost/mebocost.py#L1149-L1172
The argument is defined here:
commu_score_col = 'Commu_Score'
but the function body later hard-codes Commu_Score here:
r1, p1 = pearsonr(commu_res['blood_level'], commu_res['Commu_Score'])
sr1, sp1 = spearmanr(commu_res['blood_level'], commu_res['Commu_Score'])
model.fit(commu_res[['blood_level']], commu_res['Commu_Score'])
commu_res['Corrected_Commu_Score'] = commu_res['Commu_Score'] - commu_res['pred']
The plotting code also hard-codes Commu_Score:
sns.regplot(data=commu_res, x='blood_level', y='Commu_Score', ...)
Why this is confusing
The official multisample demo calls:
https://github.com/kaifuchenlab/MEBOCOST/blob/main/Demo_Multisample_mCCC_analysis.ipynb#L995-L999
corrected_commu_res = mebo_obj._blood_correct_test_(
met_cont_file='data/mebocost_db/common/hmdb_blood_metabolite_concentration.tsv',
commu_score_col='Norm_Commu_Score',
...
)
Based on this call, users would expect:
Corrected_Commu_Score = Norm_Commu_Score - predicted_blood_component
But the current function actually computes:
Corrected_Commu_Score = Commu_Score - predicted_blood_component
even when commu_score_col='Norm_Commu_Score' is passed.
Suggested fix
Use commu_score_col consistently inside _blood_correct_test_().
For example:
if commu_score_col not in commu_res.columns:
raise KeyError(f"{commu_score_col} is not found in commu_res columns")
r1, p1 = pearsonr(commu_res['blood_level'], commu_res[commu_score_col])
sr1, sp1 = spearmanr(commu_res['blood_level'], commu_res[commu_score_col])
model = LinearRegression(fit_intercept=True)
model.fit(commu_res[['blood_level']], commu_res[commu_score_col])
commu_res['pred'] = model.predict(commu_res[['blood_level']])
commu_res['Corrected_Commu_Score'] = commu_res[commu_score_col] - commu_res['pred']
And for the first regression plot:
sns.regplot(
data=commu_res,
x='blood_level',
y=commu_score_col,
ci=False,
ax=ax[0],
scatter_kws={'alpha': .5}
)
Optionally, the y-axis label could also reflect the score column being corrected.
Expected behavior
When users pass:
commu_score_col='Norm_Commu_Score'
the returned Corrected_Commu_Score should be based on Norm_Commu_Score, not Commu_Score.
This would make the implementation consistent with the official demo and with the function argument.
Hi MEBOCOST developers,
I noticed that
_blood_correct_test_()exposes acommu_score_colargument, and the official multisample demo calls it withcommu_score_col='Norm_Commu_Score', but the current implementation appears to ignore this argument and always usesCommu_Scorefor the regression and correction.Where
In
src/mebocost/mebocost.py:https://github.com/kaifuchenlab/MEBOCOST/blob/main/src/mebocost/mebocost.py#L1149-L1172
The argument is defined here:
but the function body later hard-codes
Commu_Scorehere:The plotting code also hard-codes
Commu_Score:Why this is confusing
The official multisample demo calls:
https://github.com/kaifuchenlab/MEBOCOST/blob/main/Demo_Multisample_mCCC_analysis.ipynb#L995-L999
Based on this call, users would expect:
But the current function actually computes:
even when
commu_score_col='Norm_Commu_Score'is passed.Suggested fix
Use
commu_score_colconsistently inside_blood_correct_test_().For example:
And for the first regression plot:
Optionally, the y-axis label could also reflect the score column being corrected.
Expected behavior
When users pass:
the returned
Corrected_Commu_Scoreshould be based onNorm_Commu_Score, notCommu_Score.This would make the implementation consistent with the official demo and with the function argument.