Skip to content

Conversation

GeorgWa
Copy link
Collaborator

@GeorgWa GeorgWa commented Sep 25, 2025

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

from alphadia.transferlearning.train import FinetuneManager
from alphadia.workflow.config import Config

logger = logging.getLogger()
Copy link
Collaborator

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())
Copy link
Collaborator

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"
Copy link
Collaborator

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

Comment on lines +191 to +194
from alphadia.outputtransform.search_plan_output import (
LFQOutputConfig,
SearchPlanOutput,
)
Copy link
Collaborator

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")
Copy link
Collaborator

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")
Copy link
Collaborator

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
Copy link
Collaborator

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
Copy link
Collaborator

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]

Comment on lines +225 to +242


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
Copy link
Collaborator

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants