-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
2f71809
commit 4284537
Showing
7 changed files
with
77 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
36 changes: 36 additions & 0 deletions
36
src/depiction_targeted_preproc/workflow/exp/mass_list_preparation.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
from pathlib import Path | ||
from typing import Annotated | ||
|
||
import polars as pl | ||
import typer | ||
from typer import Option | ||
|
||
|
||
def exp_mass_list_preparation( | ||
input_csv_path: Annotated[Path, Option()], | ||
out_calibration_csv_path: Annotated[Path, Option()], | ||
out_standards_csv_path: Annotated[Path, Option()], | ||
out_visualization_csv_path: Annotated[Path, Option()], | ||
) -> None: | ||
input_df = pl.read_csv(input_csv_path) | ||
|
||
# rename cols | ||
input_df = input_df.rename({"Marker": "label", "PC-MT (M+H)+": "mass"}).drop("No.") | ||
|
||
# add tol column | ||
visualization_df = input_df.with_columns(tol=pl.lit(0.25)) | ||
|
||
# for the calibration remove the CHCA peaks, they have names starting with CHCA | ||
calibration_df = visualization_df.filter(~pl.col("name").str.starts_with("CHCA")) | ||
|
||
# for the standards csv only keep the "standard" peaks | ||
standards_df = visualization_df.filter(pl.col("name").str.to_lowercase().contains("standard")) | ||
|
||
# write the results | ||
calibration_df.write_csv(out_calibration_csv_path) | ||
standards_df.write_csv(out_standards_csv_path) | ||
visualization_df.write_csv(out_visualization_csv_path) | ||
|
||
|
||
if __name__ == "__main__": | ||
typer.run(exp_mass_list_preparation) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters