fragcompΒΆ
The fragment competition module contains functionality to maintain the exclusive assignment of signal to identifications.
The fragment competition module contains functionality to maintain the exclusive assignment of signal to identifications.
The sweep itself lives in Rust (alphadia_search_rs.FragmentCompetition); what is left here is the dataframe bookkeeping it needs.
- alphadia.fragcomp.fragcomp.compete_for_fragments(psm_df: DataFrame, frag_df: DataFrame, cycle: ndarray, rt_tol_seconds: float = 3.0, mass_tol_ppm: float = 15.0) DataFrame[source]ΒΆ
Remove PSMs that share fragments with other PSMs.
PSMs only compete against others in the same DIA window and within rt_tol_seconds, and the lower proba wins. Row order does not matter and is preserved.
- Parameters:
psm_df (pd.DataFrame) β The PSM dataframe.
frag_df (pd.DataFrame) β The fragment dataframe.
cycle (np.ndarray) β DIA cycle.
rt_tol_seconds (float) β The retention time tolerance in seconds.
mass_tol_ppm (float) β The mass tolerance in ppm.
- Returns:
The PSM dataframe, reduced to the PSMs that won their fragments.
- Return type:
pd.DataFrame
Utility methods for fragment competition.
- alphadia.fragcomp.utils.add_frag_start_stop_idx(psm_df: DataFrame, frag_df: DataFrame) DataFrame[source]ΒΆ
The fragment dataframe is indexed by the precursor index.
This function adds the start and stop indices of the fragments to the PSM dataframe.
- Parameters:
psm_df (pd.DataFrame) β The PSM dataframe.
frag_df (pd.DataFrame) β The fragment dataframe.
- Returns:
The PSM dataframe with the start and stop indices of the fragments.
- Return type:
pd.DataFrame
- alphadia.fragcomp.utils.candidate_hash(precursor_idx: ndarray, rank: ndarray) ndarray[source]ΒΆ
Create a 64 bit hash (np.ndarray[np.uint64]) from precursor_idx and rank.
The precursor_idx is the lower 32 bits. The rank is the next 8 bits.
Note: the explicit casting is important to ensure it returns a 64-bit integer.