Skip to content

Commit

Permalink
adding bare bones haplo fxns file
Browse files Browse the repository at this point in the history
  • Loading branch information
aineniamh committed Nov 7, 2023
1 parent daf41f2 commit 3e5c617
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions piranha/analysis/haplo_functions.py
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit 3e5c617

Please sign in to comment.