Skip to content

Commit 148f526

Browse files
committed
fix: add buffering=1 to sys.stderr logging to explicitly turn on line buffering (i.e. flush lines to file once they are completed with a newline)
1 parent 42e6a83 commit 148f526

16 files changed

+17
-17
lines changed

workflow/scripts/compare_diffexp.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
import altair as alt
55
import sys
66

7-
sys.stderr = open(snakemake.log[0], "w")
7+
sys.stderr = open(snakemake.log[0], "w", buffering=1)
88

99
diffexp_x = pl.from_pandas(pyreadr.read_r(snakemake.input[0])[None]).lazy()
1010
diffexp_y = pl.from_pandas(pyreadr.read_r(snakemake.input[1])[None]).lazy()

workflow/scripts/compare_enrichment.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
import altair as alt
44
import sys
55

6-
sys.stderr = open(snakemake.log[0], "w")
6+
sys.stderr = open(snakemake.log[0], "w", buffering=1)
77

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

workflow/scripts/compare_pathways.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
import altair as alt
44
import sys
55

6-
sys.stderr = open(snakemake.log[0], "w")
6+
sys.stderr = open(snakemake.log[0], "w", buffering=1)
77

88
diffexp_x = pl.read_csv(snakemake.input[0], separator="\t", null_values="NA").lazy()
99
diffexp_y = pl.read_csv(snakemake.input[1], separator="\t", null_values="NA").lazy()

workflow/scripts/compose-sample-sheet.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import sys
2-
sys.stderr = open(snakemake.log[0], "w")
2+
sys.stderr = open(snakemake.log[0], "w", buffering=1)
33

44
samples_ = snakemake.params.units[["sample", "unit"]].merge(snakemake.params.samples, on="sample")
55
samples_["sample"] = samples_.apply(

workflow/scripts/get-sample-hist-bins.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
import json
55

66

7-
sys.stderr = open(snakemake.log[0], "w")
7+
sys.stderr = open(snakemake.log[0], "w", buffering=1)
88

99
# Get the read-length
1010
f = open(snakemake.input["read_length"])

workflow/scripts/get_main_transcripts_per_gene_fasta.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
import pandas as pd
33
from Bio import SeqIO
44

5-
sys.stderr = open(snakemake.log[0], "w")
5+
sys.stderr = open(snakemake.log[0], "w", buffering=1)
66

77
with open(snakemake.output[0], "w") as transcript_clean_cdna_fasta:
88
all_transcripts = pd.read_csv(

workflow/scripts/goatools-go-enrichment-analysis.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import sys
22

3-
sys.stderr = open(snakemake.log[0], "w")
4-
sys.stdout = open(snakemake.log[0], "a")
3+
sys.stderr = open(snakemake.log[0], "w", buffering=1)
4+
sys.stdout = open(snakemake.log[0], "a", buffering=1)
55

66
import pandas as pd
77
import matplotlib.pyplot as plt

workflow/scripts/plot-3prime-qc-histogram.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
import sys
44
import json
55

6-
sys.stderr = open(snakemake.log[0], "w")
6+
sys.stderr = open(snakemake.log[0], "w", buffering=1)
77

88
# reading the file read length
99
f = open(snakemake.input["read_length"])

workflow/scripts/plot-ind-sample-QC-histogram.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
from scipy import stats
99
import sys
1010
import json
11-
sys.stderr = open(snakemake.log[0], "w")
11+
sys.stderr = open(snakemake.log[0], "w", buffering=1)
1212
transcript_ids = snakemake.params["each_transcript"]
1313

1414
samples = snakemake.params["samples"]

workflow/scripts/plot-pca.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
import altair as alt
33
import sys
44

5-
sys.stderr = open(snakemake.log[0], "w")
5+
sys.stderr = open(snakemake.log[0], "w", buffering=1)
66

77

88
def plot(df, effect_x, effect_y):

workflow/scripts/plot_enrichment_pathway_scatter.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
import altair as alt
33
import sys
44

5-
sys.stderr = open(snakemake.log[0], "w")
5+
sys.stderr = open(snakemake.log[0], "w", buffering=1)
66

77

88
def plot(df_plot, identifier, effect_x, effect_y, title, selector, color_scheme):

workflow/scripts/postprocess_diffexp.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import sys
2-
sys.stderr = open(snakemake.log[0], "w")
2+
sys.stderr = open(snakemake.log[0], "w", buffering=1)
33

44
import pandas as pd
55

workflow/scripts/postprocess_go_enrichment.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import sys
2-
sys.stderr = open(snakemake.log[0], "w")
2+
sys.stderr = open(snakemake.log[0], "w", buffering=1)
33

44
# import pandas as pd
55
from ast import literal_eval as make_tuple

workflow/scripts/postprocess_logcount.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import sys
2-
sys.stderr = open(snakemake.log[0], "w")
2+
sys.stderr = open(snakemake.log[0], "w", buffering=1)
33

44
import pandas as pd
55

workflow/scripts/postprocess_tpm.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import sys
22
import pandas as pd
33

4-
sys.stderr = open(snakemake.log[0], "w")
4+
sys.stderr = open(snakemake.log[0], "w", buffering=1)
55

66
# Load input files
77
tpm_df = pd.read_csv(snakemake.input["tpm"], sep="\t")

workflow/scripts/remove_poly_tails.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
from Bio import SeqIO
44
from Bio.Seq import Seq
55

6-
sys.stderr = open(snakemake.log[0], "w")
6+
sys.stderr = open(snakemake.log[0], "w", buffering=1)
77

88
with open(snakemake.output[0], "w") as transcript_clean_cdna_fasta:
99
for seq_record in SeqIO.parse(snakemake.input["ref_fasta"], "fasta"):

0 commit comments

Comments
 (0)