Skip to content

Commit

Permalink
fix empty table
Browse files Browse the repository at this point in the history
  • Loading branch information
FelixMoelder committed Oct 26, 2023
1 parent 7e798b3 commit 5c68058
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
2 changes: 1 addition & 1 deletion .test/config-simple/config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ params:
min_alternate_fraction: 0.05 # Reduce for calling variants with lower VAFs

gene_coverage:
min_avg_coverage: 5
min_avg_coverage: 0

report:
activate: true
Expand Down
9 changes: 6 additions & 3 deletions workflow/scripts/coverage_table.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,12 @@
group_regions[(chromosome, gene)] = dict()
group_regions[(chromosome, gene)][sample] = coverage

df = pd.DataFrame.from_dict(group_regions).T
df.index.names = ("chromosome", "gene")
df.reset_index(inplace=True)
if bool(group_regions):
df = pd.DataFrame.from_dict(group_regions).T
df.index.names = ("chromosome", "gene")
df.reset_index(inplace=True)
else:
df = pd.DataFrame(columns=["chromosome", "gene"])

with open(snakemake.output[0], "w") as csv_file:
df.to_csv(csv_file, index=False, sep="\t")

0 comments on commit 5c68058

Please sign in to comment.