Skip to content

Commit

Permalink
Minor
Browse files Browse the repository at this point in the history
  • Loading branch information
genomewalker committed Nov 19, 2022
1 parent aa4951e commit 4b12a7f
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions bam_filter/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -105,22 +105,21 @@ def main():
logging.info("Reducing results to a single dataframe")
data = list(filter(None, data))
data_df = [x[0] for x in data]
data_df = list(filter(None, data_df))
# data_df = fast_flatten(list(filter(None, data_df)))
print(data_df)
data_df = fast_flatten(list(filter(None, data_df)))
data_df = concat_df(data_df)

if args.read_length_freqs:
logging.info("Calculating read length frequencies...")
lens = [x[1] for x in data]
lens = list(filter(None, lens))
lens = json.dumps(lens, default=obj_dict, ensure_ascii=False, indent=4)
with open(out_files["read_length_freqs"], "w", encoding="utf-8") as outfile:
print(lens, file=outfile)

if args.read_hits_count:
logging.info("Calculating read hits counts...")
hits = [x[2] for x in data]
hits = list(filter(None, hits))

# merge dicts and sum values
hits = reduce(lambda x, y: x.update(y) or x, (Counter(dict(x)) for x in hits))
# hits = sum(map(Counter, hits), Counter())
Expand Down

0 comments on commit 4b12a7f

Please sign in to comment.