Skip to content

Commit

Permalink
Fix check for unlabeled/labeled compounds so ISTD atlas compounds are…
Browse files Browse the repository at this point in the history
… in the correct order
  • Loading branch information
bkieft-usa committed Aug 27, 2024
1 parent 7bf6cfc commit 1b29fcc
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions metatlas/io/metatlas_get_data_helper_fun.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,9 @@ def sort_atlas_csv(input_csv: str, column1: str, column2: str, istd_atlas: bool)
# Sort the DataFrame based on the specified columns in ascending order
if istd_atlas == True:
if 'label' in df.columns:
if 'unlabeled' not in df['label'].values:
logger.info("Warning: The designation 'unlabeled' does not appear in the 'label' column. Only set 'istd_atlas' to True if this is an internal standard atlas with isotopic labeling.")
if not df['label'].str.contains('unlabeled').any():
logger.info("Warning: The designation 'unlabeled' does not appear in the 'label' column. Only set 'istd_atlas' to True if this is an internal standard atlas with isotopic labeling. Exiting!")
sys.exit(1)
df['rt_peak'] = df.apply(lambda row: row['rt_peak'] + 0.1 if 'unlabeled' in row['label'] else row['rt_peak'], axis=1)
sorted_df = df.sort_values(by=[column1, column2], ascending=[True, True])
sorted_df['rt_peak'] = sorted_df.apply(lambda row: row['rt_peak'] - 0.1 if 'unlabeled' in row['label'] else row['rt_peak'], axis=1)
Expand Down

0 comments on commit 1b29fcc

Please sign in to comment.