diff --git a/PKG-INFO b/PKG-INFO index 99c527a..a951980 100644 --- a/PKG-INFO +++ b/PKG-INFO @@ -1,6 +1,6 @@ Metadata-Version: 1.2 Name: pauvre -Version: 0.2.1 +Version: 0.2.2 Summary: Tools for plotting Oxford Nanopore and other long-read data. Home-page: https://github.com/conchoecia/pauvre Author: Darrin Schultz diff --git a/README.md b/README.md index 0122fc3..fa14729 100644 --- a/README.md +++ b/README.md @@ -1,12 +1,39 @@ [![travis-ci](https://travis-ci.org/conchoecia/pauvre.svg?branch=master)](https://travis-ci.org/conchoecia/pauvre) [![DOI](https://zenodo.org/badge/112774670.svg)](https://zenodo.org/badge/latestdoi/112774670) +## Getting Started -## pauvre: a plotting package designed for nanopore and PacBio long reads +``` +pauvre custommargin -i custom.tsv --ycol length --xcol qual # Custom tsv input +``` -This package currently hosts four scripts for plotting and/or printing stats. +## Table of Contents + +- [Getting Started](#started) +- [Users' Guide](#uguide) +- [Installation](#installation) + - [Requirements](#reqs) + - [Install Instructions](#install) +- [Usage](#usage) + - [pauvre stats](#stats) + - [pauvre marginplot](#marginplot) + - [Basic Usage](#marginbasic) + - [Plot Adjustments](#marginadjustments) + - [Specialized Options](#marginspecialized) +- [Contributors](#contributors) + +## Users' Guide + +Pauvre is a plotting package originally designed to help QC the length and +quality distribution of Oxford Nanopore or PacBio reads. The main outputs +are marginplots. Now, `pauvre` also hosts other additional data plotting +scripts. + +This package currently hosts five scripts for plotting and/or printing stats. - `pauvre marginplot` - takes a fastq file as input and outputs a marginal histogram with a heatmap. +- `pauvre custommargin` + - takes a tsv as input and outputs a marginal histogram with custom columns of your choice. - `pauvre stats` - Takes a fastq file as input and prints out a table of stats, including how many basepairs/reads there are for a length/mean quality cutoff. - This is also automagically called when using `pauvre marginplot` @@ -24,7 +51,10 @@ genomes with the fewest crossings-over. Input is one `.gff` file per circular genome and one directory of gene alignments. -# Requirements + +## Installation + +### Requirements - You must have the following installed on your system to install this software: - python 3.x @@ -33,8 +63,7 @@ - pandas - pillow -# Installation - +### Install Instructions - Instructions to install on your mac or linux system. Not sure on Windows! Make sure *python 3* is the active environment before installing. @@ -44,9 +73,9 @@ - Or, install with pip - `pip3 install pauvre` -# Usage +## Usage -## `stats` +### `stats` - generate basic statistics about the fastq file. For example, if I want to know the number of bases and reads with AT LEAST a PHRED score of 5 and AT LEAST a read length of 500, run the program as below @@ -78,9 +107,9 @@ et cetera... ``` -## `marginplot` +### `marginplot` -### Basic usage +#### Basic Usage - automatically calls `pauvre stats` for each fastq file - Make the default plot showing the 99th percentile of longest reads - `pauvre marginplot --fastq miniDSMN15.fastq` @@ -90,28 +119,27 @@ - `pauvre marginplot --maxlen 4000 --maxqual 25 --lengthbin 50 --fileform pdf png --qualbin 0.5 --fastq miniDSMN15.fastq` - ![example1](files/miniDSMN15.png) -### Filter reads and adjust viewing window +#### Plot Adjustments + - Filter out reads with a mean quality less than 5, and a length less than 800. Zoom in to plot only mean quality of at least 4 and read length at least 500bp. - `pauvre marginplot -f miniDSMN15.fastq --filt_minqual 5 --filt_minlen 800 -y --plot_minlen 500 --plot_minqual 4` - ![test4](files/test4.png) -### Specialized Options +#### Specialized Options - Plot ONT 1D data with a large tail - `pauvre marginplot --maxlen 100000 --maxqual 15 --lengthbin 500 .fastq` - Get more resolution on lengths - `pauvre marginplot --maxlen 100000 --lengthbin 5 .fastq` -### Transparency - - Turn off transparency if you just want a white background - `pauvre marginplot --transparent False .fastq` - Note: transparency is the default behavior - ![transparency](files/transparency.001.jpeg) -# Contributors +## Contributors @conchoecia (Darrin Schultz) @mebbert (Mark Ebbert) diff --git a/pauvre/custommargin.py b/pauvre/custommargin.py index de5b802..d522e42 100644 --- a/pauvre/custommargin.py +++ b/pauvre/custommargin.py @@ -30,6 +30,7 @@ import os.path as opath from sys import stderr from pauvre.functions import print_images +from pauvre.marginplot import generate_panel from pauvre.stats import stats import pauvre.rcparams as rc import sys @@ -37,44 +38,6 @@ # logging logger = logging.getLogger('pauvre') - - -def generate_panel(panel_left, panel_bottom, panel_width, panel_height, - axis_tick_param='both', which_tick_param='both', - bottom_tick_param='on', label_bottom_tick_param='on', - left_tick_param='on', label_left_tick_param='on', - right_tick_param='off', label_right_tick_param='off', - top_tick_param='off', label_top_tick_param='off'): - """ - Setting default panel tick parameters. Some of these are the defaults - for matplotlib anyway, but specifying them for readability. Here are - options and defaults for the parameters used below: - - axis : {'x', 'y', 'both'}; which axis to modify; default = 'both' - which : {'major', 'minor', 'both'}; which ticks to modify; - default = 'major' - bottom, top, left, right : bool or {'on', 'off'}; ticks on or off; - labelbottom, labeltop, labelleft, labelright : bool or {'on', 'off'} - """ - - # create the panel - panel_rectangle = [panel_left, panel_bottom, panel_width, panel_height] - panel = plt.axes(panel_rectangle) - - # Set tick parameters - panel.tick_params(axis=axis_tick_param, - which=which_tick_param, - bottom=bottom_tick_param, - labelbottom=label_bottom_tick_param, - left=left_tick_param, - labelleft=label_left_tick_param, - right=right_tick_param, - labelright=label_right_tick_param, - top=top_tick_param, - labeltop=label_top_tick_param) - - return panel - def _generate_histogram_bin_patches(panel, bins, bin_values, horizontal=True): """This helper method generates the histogram that is added to the panel. @@ -271,19 +234,19 @@ print(" - Setting panel options.", file = sys.stderr) if kwargs["Y_AXES"]: y_bottom_spine = True - y_bottom_tick = 'on' - y_bottom_label = 'on' + y_bottom_tick = True + y_bottom_label = True x_left_spine = True - x_left_tick = 'on' - x_left_label = 'on' + x_left_tick = True + x_left_label = True x_y_label = 'Count' else: y_bottom_spine = False - y_bottom_tick = 'off' - y_bottom_label = 'off' + y_bottom_tick = False + y_bottom_label = False x_left_spine = False - x_left_tick = 'off' - x_left_label = 'off' + x_left_tick = False + x_left_label = False x_y_label = None panels = [] @@ -336,12 +299,12 @@ legend_panel_height = heat_map_panel_height / fig_height legend_panel = generate_panel(legend_panel_left, legend_panel_bottom, legend_panel_width, legend_panel_height, - bottom_tick_param='off', - label_bottom_tick_param='off', - left_tick_param='off', - label_left_tick_param='off', - right_tick_param='on', - label_right_tick_param='on') + bottom_tick_param=False, + label_bottom_tick_param=False, + left_tick_param=False, + label_left_tick_param=False, + right_tick_param=True, + label_right_tick_param=True) panels.append(legend_panel) # diff --git a/pauvre/version.py b/pauvre/version.py index 200a6d2..5b0655f 100644 --- a/pauvre/version.py +++ b/pauvre/version.py @@ -1,4 +1,4 @@ # -*- coding: utf-8 -*- -__version__ = "0.2.1" +__version__ = "0.2.2" diff --git a/pauvre.egg-info/PKG-INFO b/pauvre.egg-info/PKG-INFO index 99c527a..a951980 100644 --- a/pauvre.egg-info/PKG-INFO +++ b/pauvre.egg-info/PKG-INFO @@ -1,6 +1,6 @@ Metadata-Version: 1.2 Name: pauvre -Version: 0.2.1 +Version: 0.2.2 Summary: Tools for plotting Oxford Nanopore and other long-read data. Home-page: https://github.com/conchoecia/pauvre Author: Darrin Schultz