Skip to content

Commit 04b8213

Browse files
committed
FEAT add missing columns to output
1 parent 0753cef commit 04b8213

File tree

1 file changed

+16
-1
lines changed

1 file changed

+16
-1
lines changed

alphadia/plexscoring.py

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -738,6 +738,9 @@ def process(
738738
psm_proto_df.fragment_mass_error[
739739
self.output_idx, : len(mass_error)
740740
] = mass_error
741+
psm_proto_df.fragment_position[
742+
self.output_idx, : len(fragments.position)
743+
] = fragments.position
741744
psm_proto_df.fragment_number[
742745
self.output_idx, : len(fragments.number)
743746
] = fragments.number
@@ -1270,6 +1273,7 @@ class OuptutPsmDF:
12701273
fragment_mass_error: nb.float32[:, ::1]
12711274
fragment_correlation: nb.float32[:, ::1]
12721275

1276+
fragment_position: nb.uint8[:, ::1]
12731277
fragment_number: nb.uint8[:, ::1]
12741278
fragment_type: nb.uint8[:, ::1]
12751279
fragment_charge: nb.uint8[:, ::1]
@@ -1296,6 +1300,7 @@ def __init__(self, n_psm, top_k_fragments):
12961300
self.fragment_mass_error = np.zeros((n_psm, top_k_fragments), dtype=np.float32)
12971301
self.fragment_correlation = np.zeros((n_psm, top_k_fragments), dtype=np.float32)
12981302

1303+
self.fragment_position = np.zeros((n_psm, top_k_fragments), dtype=np.uint8)
12991304
self.fragment_number = np.zeros((n_psm, top_k_fragments), dtype=np.uint8)
13001305
self.fragment_type = np.zeros((n_psm, top_k_fragments), dtype=np.uint8)
13011306
self.fragment_charge = np.zeros((n_psm, top_k_fragments), dtype=np.uint8)
@@ -1313,6 +1318,8 @@ def to_fragment_df(self):
13131318
self.fragment_intensity.flatten()[mask],
13141319
self.fragment_mass_error.flatten()[mask],
13151320
self.fragment_correlation.flatten()[mask],
1321+
1322+
self.fragment_position.flatten()[mask],
13161323
self.fragment_number.flatten()[mask],
13171324
self.fragment_type.flatten()[mask],
13181325
self.fragment_charge.flatten()[mask],
@@ -1727,13 +1734,20 @@ def collect_candidates(
17271734
] + utils.get_isotope_column_names(self.precursors_flat_df.columns)
17281735

17291736
precursor_df_columns += (
1730-
[self.rt_column] if self.rt_column not in precursor_df_columns else []
1737+
[self.rt_column]
1738+
if self.rt_column not in precursor_df_columns
1739+
else []
17311740
)
17321741
precursor_df_columns += (
17331742
[self.mobility_column]
17341743
if self.mobility_column not in precursor_df_columns
17351744
else []
17361745
)
1746+
precursor_df_columns += (
1747+
[self.precursor_mz_column]
1748+
if self.precursor_mz_column not in precursor_df_columns
1749+
else []
1750+
)
17371751

17381752
df = utils.merge_missing_columns(
17391753
df,
@@ -1789,6 +1803,7 @@ def collect_fragments(
17891803
"intensity",
17901804
"mass_error",
17911805
"correlation",
1806+
"position",
17921807
"number",
17931808
"type",
17941809
"charge",

0 commit comments

Comments
 (0)