Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 9 additions & 4 deletions workflow/scripts/fdr-table.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,11 +57,16 @@ def read_pileup_file(infile, nrows):
return None

# add scema overrides for the score columns
# Build schema overrides keyed by positional column names (column_1, column_2, ...)
# because polars infers schema BEFORE new_columns is applied when has_header=False.
# Keying on '#chrom' / 'score' here would be silently ignored.
schema_overrides = {}
for n in ["score", "score_H1", "score_H2", "score_shuffled"]:
if n in header:
schema_overrides[n] = float

for col_idx, col_name in enumerate(header, start=1):
positional = f"column_{col_idx}"
if col_name in ("score", "score_H1", "score_H2", "score_shuffled"):
schema_overrides[positional] = pl.Float64
elif col_name == "#chrom":
schema_overrides[positional] = pl.Utf8
logging.info(f"Header of the pileup file:\n{header}")
logging.info(f"Schema overrides for the pileup file:\n{schema_overrides}")

Expand Down
2 changes: 1 addition & 1 deletion workflow/scripts/merge_fire_peaks.py
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ def main(
logger.setLevel(log_level)

inf = io.StringIO(sys.stdin.read())
df = pl.read_csv(inf, separator="\t", null_values=".")
df = pl.read_csv(inf, separator="\t", null_values=".", schema_overrides={"#chrom": pl.Utf8},)
if df.shape[0] == 0:
logging.info("No peaks to merge")
return 0
Expand Down
Loading