From 3e5c617d78b4c86ee0b1ab33fffe755bccc22a34 Mon Sep 17 00:00:00 2001 From: aineniamh Date: Tue, 7 Nov 2023 13:58:28 +0000 Subject: [PATCH] adding bare bones haplo fxns file --- piranha/analysis/haplo_functions.py | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 piranha/analysis/haplo_functions.py diff --git a/piranha/analysis/haplo_functions.py b/piranha/analysis/haplo_functions.py new file mode 100644 index 0000000..62ad948 --- /dev/null +++ b/piranha/analysis/haplo_functions.py @@ -0,0 +1,24 @@ +#!/usr/bin/env python3 +import csv +from Bio import SeqIO +import collections +from piranha.utils.config import * +import os + +from piranha.utils.log_colours import green,cyan,red + + +def parse_partition_file(partition_file): + + partitions = collections.defaultdict(set) + with open(partition_file, "r") as f: + part = "" + for l in f: + l=l.rstrip("\n") + if l[0] == "#": + part = l.lstrip("#") + else: + read_id = l.split("\t")[0] + partitions[part].add(read_id) + + return partitions \ No newline at end of file