Skip to content

Commit

Permalink
Fix from_yaml
Browse files Browse the repository at this point in the history
  • Loading branch information
Phlya committed Dec 12, 2023
1 parent 167ed0d commit bb7d2d4
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions pairtools/lib/stats.py
Original file line number Diff line number Diff line change
Expand Up @@ -380,9 +380,11 @@ def from_yaml(cls, file_handle):
new PairCounter filled with the contents of the input file
"""
# fill in from file - file_handle:
stat_from_file = cls()

stat = yaml.safe_load(file_handle)
stat_from_file = cls(
filters={key: val.get("filter_expression", "") for key, val in stat.items()}
)

for key, filter in stat.items():
chromdict = {}
for chroms in stat[key]["chrom_freq"].keys():
Expand Down Expand Up @@ -637,7 +639,6 @@ def __add__(self, other, filter="no_filter"):
].get(union_key, 0) + other._stat[filter][k].get(union_key, 0)
elif k == "dist_freq":
for dirs in sum_stat[k]:

from functools import reduce

def reducer(accumulator, element):
Expand Down

0 comments on commit bb7d2d4

Please sign in to comment.