Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 5 additions & 6 deletions poretools/qual_v_pos.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
from collections import defaultdict
import pandas
import matplotlib.pyplot as plt
import sys

#logging
import logging
Expand All @@ -12,7 +13,7 @@ def run(parser, args):
""" returns boxplot with qual scores for each bin/position"""
qualpos = defaultdict(list)
bin_width = args.bin_width

for fast5 in Fast5File.Fast5FileSet(args.files):
if args.start_time or args.end_time:
read_start_time = fast5.get_start_time()
Expand All @@ -32,7 +33,7 @@ def run(parser, args):
continue

for fq in fqs:
if fq is None or len(fq.seq) < args.min_length or len(fq.seq) > args.max_length:
if fq is None or len(fq.seq) < args.min_length or len(fq.seq) > args.max_length:
continue

ctr = 0
Expand All @@ -53,14 +54,12 @@ def run(parser, args):
if args.saveas is not None:
logger.info("Writing plot to file...")
plot_file = args.saveas
if plot_file.endswith(".pdf") or plot_file.endswith(".jpg"):
if plot_file.endswith(".pdf") or plot_file.endswith(".png"):
plt.savefig(plot_file)
else:
logger.error("Unrecognized extension for %s! Try .pdf or .jpg" % (plot_file))
logger.error("Unrecognized extension for %s! Try .pdf or .png" % (plot_file))
sys.exit()

else:
logger.info("Showing plot...")
plt.show()