Skip to content
Permalink
main
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Go to file
 
 
Cannot retrieve contributors at this time
import argparse
from collections import defaultdict
from general_functions import get_sv_type, load_sv_conflict, sorted_barplot
def parse_args():
parser = argparse.ArgumentParser(formatter_class=argparse.ArgumentDefaultsHelpFormatter)
parser.add_argument("conflicts", type=str)
parser.add_argument("--keep", "-k", type=str_list, default=None)
parser.add_argument("--keep_file", "-f", type=str, default=None)
parser.add_argument("--fig", type=str, default=None)
args = parser.parse_args()
return args
def str_list(s_list):
return s_list.split(",")
if __name__ == "__main__":
args = parse_args()
conflict_file = open(args.conflicts)
sv_types = defaultdict(lambda: 0)
if args.keep_file:
out_file = open(args.keep_file, "w")
for conflict in conflict_file:
svs = load_sv_conflict(conflict)
local_types = defaultdict(lambda: 0)
for sv in svs:
sv_type = get_sv_type(sv)
local_types[sv_type] += 1
if len(local_types) > 1:
sv_type = "COMBINATION"
sv_types[sv_type] += 1
if args.keep and sv_type in args.keep:
out_file.write(f"{conflict}")
if args.fig:
plot = sorted_barplot(sv_types, reverse=False)
plot.title("Frequency of SV conflicts by type")
plot.xlabel("Frequency")
plot.ylabel("Type")
plot.savefig(args.fig, bbox_inches="tight")