Permalink
Cannot retrieve contributors at this time
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?
sv-conflict-analysis/ambiguity_scores.py
Go to fileThis commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
31 lines (23 sloc)
897 Bytes
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import sys | |
import matplotlib.pyplot as plt | |
from general_functions import load_sv_conflict | |
if __name__ == '__main__': | |
fn = sys.argv[1] | |
method = sys.argv[2] | |
f = open(fn, "r") | |
ambiguities = [] | |
for line in f: | |
called_svs = load_sv_conflict(line) | |
method_count = 0 | |
for sv in called_svs: | |
if sv.startswith(method): | |
method_count += 1 | |
# dynamically expand the count array if needed | |
if len(ambiguities)-1 < method_count: | |
ambiguities += [0]*(method_count-len(ambiguities)+1) | |
ambiguities[method_count] += 1 | |
plt.bar(list(range(len(ambiguities))), ambiguities) | |
plt.xlabel("Ambiguity Score") | |
plt.ylabel("Frequency") | |
plt.title(f"Distribution of how often {method} calls k SVs in conflicting graphs") | |
plt.savefig(f"ambiguity_score_distribution_{method}.png", bbox_inches="tight") |