Commit bb20e13b authored by Yoann Dufresne's avatar Yoann Dufresne
Browse files

global stats

parent 566d08b3
......@@ -12,6 +12,8 @@ def parse_args():
parser = argparse.ArgumentParser(description='Process some integers.')
parser.add_argument('filename', type=str,
help='The output file to evalute')
parser.add_argument('--light-print', '-l', action='store_true',
help='Print only wrong nodes and paths')
args = parser.parse_args()
......@@ -78,14 +80,35 @@ def parse_graph_frequencies(graph, only_wrong=False, file_pointer=sys.stdout):
def print_summary(frequencies, file_pointer=sys.stdout):
if file_pointer == None:
return
print("--- Global summary ---", file=file_pointer)
# --- Frequency usage ---
# Tags
distinct_theoritical_nodes = len(frequencies[0])
distinct_observed_nodes = len(frequencies[1])
print(f"Distinct barcodes: {distinct_observed_nodes}/{distinct_theoritical_nodes}", file=file_pointer)
# molecules
cumulative_theoritical_nodes = sum(frequencies[0].values())
cumulative_observed_nodes = sum(frequencies[1].values())
print(f"Molecules: {cumulative_observed_nodes}/{cumulative_theoritical_nodes}", file=file_pointer)
# Wrong splits
over_split = 0
under_split = 0
for barcode in frequencies[0]:
observed = frequencies[1][barcode]
theoritic = frequencies[0][barcode]
over_split += max(observed-theoritic, 0)
under_split += max(theoritic-observed, 0)
print(f"Under/Over splitting: {under_split} - {over_split}")
def main():
args = parse_args()
graph = load_graph(args.filename)
frequencies = parse_graph_frequencies(graph)
frequencies = parse_graph_frequencies(graph, only_wrong=args.light_print)
print_summary(frequencies)
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment