-
Notifications
You must be signed in to change notification settings - Fork 5
Add intensity to precursor table #687
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
from alphadia.transferlearning.train import FinetuneManager | ||
from alphadia.workflow.config import Config | ||
|
||
logger = logging.getLogger() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In which way is this change breaking? because it adds new columns to the output tables?
} | ||
|
||
for config in quantlevel_configs: | ||
lfq_df = lfq_results.get(config.level_name, pd.DataFrame()) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lfq_df = lfq_results.get(config.level_name)
if lfq_df is None:
continue
continue | ||
|
||
intensity_column = intensity_column_mapping.get( | ||
config.level_name, f"{config.level_name}_intensity" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is the default required? you have e.g. "precursor": "precursor_intensity",
explicitly defined
from alphadia.outputtransform.search_plan_output import ( | ||
LFQOutputConfig, | ||
SearchPlanOutput, | ||
) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
import to top please
SearchPlanOutput, | ||
) | ||
|
||
spo = SearchPlanOutput({"general": {"save_figures": False}}, "/tmp") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
search_plan_output
.. less mental mapping >> less characters
SearchPlanOutput, | ||
) | ||
|
||
spo = SearchPlanOutput({"general": {"save_figures": False}}, "/tmp") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
/tmp
=> /some_output_path
|
||
result = spo._merge_quant_levels_to_psm(psm_df, lfq_results, configs) | ||
|
||
assert "precursor_intensity" in result.columns |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this assert is redundant
result = spo._merge_quant_levels_to_psm(psm_df, lfq_results, configs) | ||
|
||
assert "precursor_intensity" in result.columns | ||
assert result["precursor_intensity"].iloc[0] == 100.0 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
could be made stronger:
assert result["precursor_intensity"].values == [100.0]
|
||
|
||
def test_merge_quant_levels_to_psm_merges_protein_group_level(): | ||
"""Test that protein group level quantification is merged correctly.""" | ||
from alphadia.outputtransform.search_plan_output import ( | ||
LFQOutputConfig, | ||
SearchPlanOutput, | ||
) | ||
|
||
spo = SearchPlanOutput({"general": {"save_figures": False}}, "/tmp") | ||
psm_df = pd.DataFrame({"pg": ["PG1"], "run": ["run1"]}) | ||
lfq_results = {"pg": pd.DataFrame({"pg": ["PG1"], "run1": [700.0]})} | ||
configs = [LFQOutputConfig("pg", "pg")] | ||
|
||
result = spo._merge_quant_levels_to_psm(psm_df, lfq_results, configs) | ||
|
||
assert "intensity" in result.columns | ||
assert result["intensity"].iloc[0] == 700.0 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
are these tests really adding something? if it works for one level, it should work for all..
I would rather add a test with multiple runs, or some edge cases
For a long time, precursor and peptide information was missing from the precursor output table.
This breaking change adds in the LFQ intensities for pprecursor, peptide and proteins