Skip to content

Commit

Permalink
fine tuning
Browse files Browse the repository at this point in the history
  • Loading branch information
FelixMoelder committed Oct 27, 2023
1 parent 6da5d11 commit 84ad683
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions workflow/scripts/coverage_table.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,15 @@
import pandas as pd
import numpy as np

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


def add_missing_columns(df, samples):
missing_columns = set(samples).difference(df.columns)
df[list(missing_columns)] = np.nan
return df


group_regions = dict()
samples = []
for bed in snakemake.input:
Expand All @@ -23,6 +31,7 @@
df = pd.DataFrame.from_dict(group_regions).T
df.index.names = ("chromosome", "gene")
df.reset_index(inplace=True)
df = add_missing_columns(samples)
else:
df = pd.DataFrame(columns=["chromosome", "gene"] + samples)

Expand Down

0 comments on commit 84ad683

Please sign in to comment.