Skip to content

Commit

Permalink
fixed: dropping precursor_idx
Browse files Browse the repository at this point in the history
  • Loading branch information
mo-sameh committed Mar 5, 2024
1 parent 30f9854 commit 74be226
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions alphabase/spectral_library/flat.py
Original file line number Diff line number Diff line change
Expand Up @@ -263,7 +263,9 @@ def to_SpecLibBase(self) -> SpecLibBase:
column_indices = frag_types_z_charge.map(frag_type_to_col_dict)

# We need to calculate for each fragment the precursor_idx that maps a fragment to a precursor
if 'precursor_idx' not in self._fragment_df.columns:
drop_precursor_idx = False
if 'precursor_idx' not in self._fragment_df.columns:
drop_precursor_idx = True
# Sort precursor_df by 'flat_frag_start_idx'
self._precursor_df = self._precursor_df.sort_values('flat_frag_start_idx')
# Add precursor_idx to precursor_df as 0,1,2,3...
Expand Down Expand Up @@ -306,8 +308,9 @@ def to_SpecLibBase(self) -> SpecLibBase:
self._precursor_df['frag_stop_idx'] = accumlated_nAA

#Drop precursor Idx from both fragment_df and precursor_df
self._fragment_df = self._fragment_df.drop(columns = ['precursor_idx'])
self._precursor_df = self._precursor_df.drop(columns = ['precursor_idx'])
if drop_precursor_idx:
self._fragment_df = self._fragment_df.drop(columns = ['precursor_idx'])
self._precursor_df = self._precursor_df.drop(columns = ['precursor_idx'])


#Drop flat indices from precursor_df
Expand Down

0 comments on commit 74be226

Please sign in to comment.