Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix qual_vs_pos #145

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
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()