Skip to content

Commit

Permalink
refactor: Redirect stderr to log file for easier debugging (#133)
Browse files Browse the repository at this point in the history
This PR refactors the meta comparison scripts in the workflow to improve
debugging capabilities. The change redirects stderr to the log file
specified by `snakemake.log[0]`. By capturing error messages in the log
file, it becomes easier to diagnose and troubleshoot issues during
workflow execution.

<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->

## Summary by CodeRabbit

- **New Features**
- Enhanced error tracking by redirecting standard error output to a
designated log file.
  • Loading branch information
fxwiegand authored Dec 17, 2024
1 parent e2ece96 commit f399621
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 0 deletions.
3 changes: 3 additions & 0 deletions workflow/scripts/compare_diffexp.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@
import polars as pl
import polars.selectors as cs
import altair as alt
import sys

sys.stderr = open(snakemake.log[0], "w")

diffexp_x = pl.from_pandas(pyreadr.read_r(snakemake.input[0])[None]).lazy()
diffexp_y = pl.from_pandas(pyreadr.read_r(snakemake.input[1])[None]).lazy()
Expand Down
3 changes: 3 additions & 0 deletions workflow/scripts/compare_enrichment.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
import polars as pl
import polars.selectors as cs
import altair as alt
import sys

sys.stderr = open(snakemake.log[0], "w")

diffexp_x = pl.read_csv(snakemake.input[0], separator="\t").lazy()
diffexp_y = pl.read_csv(snakemake.input[1], separator="\t").lazy()
Expand Down
3 changes: 3 additions & 0 deletions workflow/scripts/compare_pathways.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
import polars as pl
import polars.selectors as cs
import altair as alt
import sys

sys.stderr = open(snakemake.log[0], "w")

diffexp_x = pl.read_csv(snakemake.input[0], separator="\t").lazy()
diffexp_y = pl.read_csv(snakemake.input[1], separator="\t").lazy()
Expand Down

0 comments on commit f399621

Please sign in to comment.