dataframe-toolkit 0.27.0__tar.gz → 0.28.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {dataframe_toolkit-0.27.0 → dataframe_toolkit-0.28.0}/PKG-INFO +4 -2
- {dataframe_toolkit-0.27.0 → dataframe_toolkit-0.28.0}/README.md +3 -1
- {dataframe_toolkit-0.27.0 → dataframe_toolkit-0.28.0}/pyproject.toml +1 -1
- {dataframe_toolkit-0.27.0 → dataframe_toolkit-0.28.0}/pyproject.toml.orig +1 -1
- {dataframe_toolkit-0.27.0 → dataframe_toolkit-0.28.0}/src/dftk/commands/box_cmd.py +1 -1
- {dataframe_toolkit-0.27.0 → dataframe_toolkit-0.28.0}/src/dftk/commands/forest_cmd.py +0 -1
- {dataframe_toolkit-0.27.0 → dataframe_toolkit-0.28.0}/src/dftk/commands/heatmap_cmd.py +17 -2
- {dataframe_toolkit-0.27.0 → dataframe_toolkit-0.28.0}/src/dftk/commands/locus_cmd.py +1 -1
- {dataframe_toolkit-0.27.0 → dataframe_toolkit-0.28.0}/src/dftk/commands/manhattan_cmd.py +1 -3
- {dataframe_toolkit-0.27.0 → dataframe_toolkit-0.28.0}/src/dftk/commands/pairs_cmd.py +1 -2
- {dataframe_toolkit-0.27.0 → dataframe_toolkit-0.28.0}/src/dftk/commands/phewas_cmd.py +1 -1
- {dataframe_toolkit-0.27.0 → dataframe_toolkit-0.28.0}/src/dftk/commands/qq_cmd.py +1 -1
- {dataframe_toolkit-0.27.0 → dataframe_toolkit-0.28.0}/src/dftk/common/plot.py +22 -18
- {dataframe_toolkit-0.27.0 → dataframe_toolkit-0.28.0}/src/dftk/__init__.py +0 -0
- {dataframe_toolkit-0.27.0 → dataframe_toolkit-0.28.0}/src/dftk/cli.py +0 -0
- {dataframe_toolkit-0.27.0 → dataframe_toolkit-0.28.0}/src/dftk/commands/__init__.py +0 -0
- {dataframe_toolkit-0.27.0 → dataframe_toolkit-0.28.0}/src/dftk/commands/annotate_cmd.py +0 -0
- {dataframe_toolkit-0.27.0 → dataframe_toolkit-0.28.0}/src/dftk/commands/append_cmd.py +0 -0
- {dataframe_toolkit-0.27.0 → dataframe_toolkit-0.28.0}/src/dftk/commands/base.py +0 -0
- {dataframe_toolkit-0.27.0 → dataframe_toolkit-0.28.0}/src/dftk/commands/binx_cmd.py +0 -0
- {dataframe_toolkit-0.27.0 → dataframe_toolkit-0.28.0}/src/dftk/commands/chi_cmd.py +0 -0
- {dataframe_toolkit-0.27.0 → dataframe_toolkit-0.28.0}/src/dftk/commands/clean_cmd.py +0 -0
- {dataframe_toolkit-0.27.0 → dataframe_toolkit-0.28.0}/src/dftk/commands/cleannames_cmd.py +0 -0
- {dataframe_toolkit-0.27.0 → dataframe_toolkit-0.28.0}/src/dftk/commands/concat_cmd.py +0 -0
- {dataframe_toolkit-0.27.0 → dataframe_toolkit-0.28.0}/src/dftk/commands/corr_cmd.py +0 -0
- {dataframe_toolkit-0.27.0 → dataframe_toolkit-0.28.0}/src/dftk/commands/dataset_cmd.py +0 -0
- {dataframe_toolkit-0.27.0 → dataframe_toolkit-0.28.0}/src/dftk/commands/describe_cmd.py +0 -0
- {dataframe_toolkit-0.27.0 → dataframe_toolkit-0.28.0}/src/dftk/commands/eval_cmd.py +0 -0
- {dataframe_toolkit-0.27.0 → dataframe_toolkit-0.28.0}/src/dftk/commands/explode_cmd.py +0 -0
- {dataframe_toolkit-0.27.0 → dataframe_toolkit-0.28.0}/src/dftk/commands/fit_cmd.py +0 -0
- {dataframe_toolkit-0.27.0 → dataframe_toolkit-0.28.0}/src/dftk/commands/func_cmd.py +0 -0
- {dataframe_toolkit-0.27.0 → dataframe_toolkit-0.28.0}/src/dftk/commands/help.py +0 -0
- {dataframe_toolkit-0.27.0 → dataframe_toolkit-0.28.0}/src/dftk/commands/hist_cmd.py +0 -0
- {dataframe_toolkit-0.27.0 → dataframe_toolkit-0.28.0}/src/dftk/commands/implode_cmd.py +0 -0
- {dataframe_toolkit-0.27.0 → dataframe_toolkit-0.28.0}/src/dftk/commands/info_cmd.py +0 -0
- {dataframe_toolkit-0.27.0 → dataframe_toolkit-0.28.0}/src/dftk/commands/interp_cmd.py +0 -0
- {dataframe_toolkit-0.27.0 → dataframe_toolkit-0.28.0}/src/dftk/commands/line_cmd.py +0 -0
- {dataframe_toolkit-0.27.0 → dataframe_toolkit-0.28.0}/src/dftk/commands/melt_cmd.py +0 -0
- {dataframe_toolkit-0.27.0 → dataframe_toolkit-0.28.0}/src/dftk/commands/merge_cmd.py +0 -0
- {dataframe_toolkit-0.27.0 → dataframe_toolkit-0.28.0}/src/dftk/commands/pivot_cmd.py +0 -0
- {dataframe_toolkit-0.27.0 → dataframe_toolkit-0.28.0}/src/dftk/commands/print_cmd.py +0 -0
- {dataframe_toolkit-0.27.0 → dataframe_toolkit-0.28.0}/src/dftk/commands/query_cmd.py +0 -0
- {dataframe_toolkit-0.27.0 → dataframe_toolkit-0.28.0}/src/dftk/commands/randvar_cmd.py +0 -0
- {dataframe_toolkit-0.27.0 → dataframe_toolkit-0.28.0}/src/dftk/commands/sample_cmd.py +0 -0
- {dataframe_toolkit-0.27.0 → dataframe_toolkit-0.28.0}/src/dftk/commands/scale_cmd.py +0 -0
- {dataframe_toolkit-0.27.0 → dataframe_toolkit-0.28.0}/src/dftk/commands/scat_cmd.py +0 -0
- {dataframe_toolkit-0.27.0 → dataframe_toolkit-0.28.0}/src/dftk/commands/segid_cmd.py +0 -0
- {dataframe_toolkit-0.27.0 → dataframe_toolkit-0.28.0}/src/dftk/commands/skill_cmd.py +0 -0
- {dataframe_toolkit-0.27.0 → dataframe_toolkit-0.28.0}/src/dftk/commands/split_cmd.py +0 -0
- {dataframe_toolkit-0.27.0 → dataframe_toolkit-0.28.0}/src/dftk/commands/stat_cmd.py +0 -0
- {dataframe_toolkit-0.27.0 → dataframe_toolkit-0.28.0}/src/dftk/commands/test_cmd.py +0 -0
- {dataframe_toolkit-0.27.0 → dataframe_toolkit-0.28.0}/src/dftk/commands/transpose_cmd.py +0 -0
- {dataframe_toolkit-0.27.0 → dataframe_toolkit-0.28.0}/src/dftk/commands/wstat_cmd.py +0 -0
- {dataframe_toolkit-0.27.0 → dataframe_toolkit-0.28.0}/src/dftk/common/__init__.py +0 -0
- {dataframe_toolkit-0.27.0 → dataframe_toolkit-0.28.0}/src/dftk/common/copula.py +0 -0
- {dataframe_toolkit-0.27.0 → dataframe_toolkit-0.28.0}/src/dftk/common/docformats.py +0 -0
- {dataframe_toolkit-0.27.0 → dataframe_toolkit-0.28.0}/src/dftk/common/evalfuncs.py +0 -0
- {dataframe_toolkit-0.27.0 → dataframe_toolkit-0.28.0}/src/dftk/common/gwas.py +0 -0
- {dataframe_toolkit-0.27.0 → dataframe_toolkit-0.28.0}/src/dftk/common/io.py +0 -0
- {dataframe_toolkit-0.27.0 → dataframe_toolkit-0.28.0}/src/dftk/common/seed.py +0 -0
- {dataframe_toolkit-0.27.0 → dataframe_toolkit-0.28.0}/src/dftk/common/seq.py +0 -0
- {dataframe_toolkit-0.27.0 → dataframe_toolkit-0.28.0}/src/dftk/common/stats.py +0 -0
- {dataframe_toolkit-0.27.0 → dataframe_toolkit-0.28.0}/src/dftk/io.py +0 -0
- {dataframe_toolkit-0.27.0 → dataframe_toolkit-0.28.0}/src/dftk/skills/dftk/SKILL.md +0 -0
- {dataframe_toolkit-0.27.0 → dataframe_toolkit-0.28.0}/src/dftk/skills/dftk/references/snakemake.md +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.3
|
|
2
2
|
Name: dataframe-toolkit
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.28.0
|
|
4
4
|
Summary: A command-line toolkit for DataFrame analysis and manipulation
|
|
5
5
|
Keywords: dataframe,statistics,data analysis,CLI,TSV,pandas
|
|
6
6
|
Author: Gunnar Pálsson
|
|
@@ -713,7 +713,9 @@ dftk annotate iris2.parquet # source, species_col, and step all still present
|
|
|
713
713
|
## Figure options (plot commands)
|
|
714
714
|
|
|
715
715
|
```text
|
|
716
|
-
--size single|double|full|WxH figure
|
|
716
|
+
--size single|double|full|WxH size of the whole figure, panels included (single ≈ 3.5",
|
|
717
|
+
double ≈ 7.2"); without it, each panel gets a default size
|
|
718
|
+
and the figure grows with them up to 16x10
|
|
717
719
|
--fontsize screen|publication|presentation
|
|
718
720
|
-f FILE save to file (PNG/PDF/SVG); omit to display
|
|
719
721
|
--groupcol COL colour-code by this column
|
|
@@ -683,7 +683,9 @@ dftk annotate iris2.parquet # source, species_col, and step all still present
|
|
|
683
683
|
## Figure options (plot commands)
|
|
684
684
|
|
|
685
685
|
```text
|
|
686
|
-
--size single|double|full|WxH figure
|
|
686
|
+
--size single|double|full|WxH size of the whole figure, panels included (single ≈ 3.5",
|
|
687
|
+
double ≈ 7.2"); without it, each panel gets a default size
|
|
688
|
+
and the figure grows with them up to 16x10
|
|
687
689
|
--fontsize screen|publication|presentation
|
|
688
690
|
-f FILE save to file (PNG/PDF/SVG); omit to display
|
|
689
691
|
--groupcol COL colour-code by this column
|
|
@@ -195,7 +195,7 @@ class BoxCommand(BaseCommand):
|
|
|
195
195
|
|
|
196
196
|
add_figure_arguments(parser)
|
|
197
197
|
add_refline_arguments(parser, vertical=False)
|
|
198
|
-
parser.set_defaults(
|
|
198
|
+
parser.set_defaults(default_size="7x4.5")
|
|
199
199
|
|
|
200
200
|
def execute(self, args: argparse.Namespace) -> None:
|
|
201
201
|
df = io.read(args, columns=option_columns(args))
|
|
@@ -145,6 +145,9 @@ def _heatmap(
|
|
|
145
145
|
ax.set_aspect("equal" if args.square else "auto")
|
|
146
146
|
|
|
147
147
|
if args.annot:
|
|
148
|
+
import matplotlib
|
|
149
|
+
|
|
150
|
+
size = args.annotsize or matplotlib.rcParams["xtick.labelsize"]
|
|
148
151
|
for (i, j), v in np.ndenumerate(shown.filled(np.nan)):
|
|
149
152
|
if np.isfinite(v):
|
|
150
153
|
# Dark text on light cells, light text on dark cells
|
|
@@ -157,6 +160,7 @@ def _heatmap(
|
|
|
157
160
|
ha="center",
|
|
158
161
|
va="center",
|
|
159
162
|
color="black" if light else "white",
|
|
163
|
+
fontsize=size,
|
|
160
164
|
)
|
|
161
165
|
return mesh
|
|
162
166
|
|
|
@@ -242,8 +246,9 @@ COLOURS AND NUMBERS
|
|
|
242
246
|
-------------------
|
|
243
247
|
--cmap takes any matplotlib colour map (viridis, magma, RdBu_r, coolwarm,
|
|
244
248
|
...). --annot writes each value in its cell, with --fmt as a Python format
|
|
245
|
-
(.2f, .1%, g; default g for whole numbers, else .2f)
|
|
246
|
-
|
|
249
|
+
(.2f, .1%, g; default g for whole numbers, else .2f), as large as the
|
|
250
|
+
tick labels (--fontsize publication makes both smaller; --annotsize PT
|
|
251
|
+
sets the numbers alone). Empty cells stay blank.
|
|
247
252
|
|
|
248
253
|
dftk dataset penguins -o | dftk pivot -i species -g island -v body_mass_g \\
|
|
249
254
|
-f count -o \\
|
|
@@ -288,6 +293,14 @@ class HeatmapCommand(BaseCommand):
|
|
|
288
293
|
help="Format of --annot values, e.g. .2f or .1%% (default: g for "
|
|
289
294
|
"whole numbers, else .2f).",
|
|
290
295
|
)
|
|
296
|
+
g.add_argument(
|
|
297
|
+
"--annotsize",
|
|
298
|
+
type=float,
|
|
299
|
+
default=None,
|
|
300
|
+
metavar="PT",
|
|
301
|
+
help="Font size of the --annot values in points (default: that of "
|
|
302
|
+
"the tick labels, set by --fontsize).",
|
|
303
|
+
)
|
|
291
304
|
g.add_argument(
|
|
292
305
|
"--cmap",
|
|
293
306
|
default=None,
|
|
@@ -345,6 +358,8 @@ class HeatmapCommand(BaseCommand):
|
|
|
345
358
|
add_figure_arguments(parser)
|
|
346
359
|
|
|
347
360
|
def execute(self, args: argparse.Namespace) -> None:
|
|
361
|
+
if args.annotsize is not None and args.annotsize <= 0:
|
|
362
|
+
raise ValueError(f"--annotsize must be above 0, not {args.annotsize:g}.")
|
|
348
363
|
df = io.read(args)
|
|
349
364
|
if args.select:
|
|
350
365
|
check_cols(df, args.select, "--select")
|
|
@@ -346,7 +346,7 @@ class LocusCommand(BaseCommand):
|
|
|
346
346
|
)
|
|
347
347
|
|
|
348
348
|
add_figure_arguments(parser)
|
|
349
|
-
parser.set_defaults(
|
|
349
|
+
parser.set_defaults(default_size="7x4")
|
|
350
350
|
|
|
351
351
|
def execute(self, args: argparse.Namespace) -> None:
|
|
352
352
|
if args.logy is not None and args.logy <= 0:
|
|
@@ -607,7 +607,6 @@ class ManhattanCommand(BaseCommand):
|
|
|
607
607
|
)
|
|
608
608
|
|
|
609
609
|
add_figure_arguments(parser)
|
|
610
|
-
parser.set_defaults(size=None)
|
|
611
610
|
add_group_arguments(parser)
|
|
612
611
|
add_legend_arguments(parser)
|
|
613
612
|
|
|
@@ -619,8 +618,7 @@ class ManhattanCommand(BaseCommand):
|
|
|
619
618
|
raise ValueError("--miami and -g/--groupcol can't be combined.")
|
|
620
619
|
if args.logy is not None and args.logy <= 0:
|
|
621
620
|
raise ValueError(f"--logy must be above 0, not {args.logy:g}.")
|
|
622
|
-
if args.
|
|
623
|
-
args.size = "12x6" if args.miami else "12x4"
|
|
621
|
+
args.default_size = "12x6" if args.miami else "12x4"
|
|
624
622
|
data = gwas_table(df, args)
|
|
625
623
|
if args.miami:
|
|
626
624
|
data, args.miami_names = miami_halves(data, args.miami)
|
|
@@ -15,7 +15,6 @@ import pandas as pd
|
|
|
15
15
|
from dftk.commands.base import BaseCommand
|
|
16
16
|
from dftk.common.io import check_cols, io
|
|
17
17
|
from dftk.common.plot import (
|
|
18
|
-
_DEFAULT_SIZE,
|
|
19
18
|
WONG_PALETTE,
|
|
20
19
|
add_figure_arguments,
|
|
21
20
|
apply_style,
|
|
@@ -178,7 +177,7 @@ def _corr_text(ax, df, groups, xcol: str, ycol: str, method: str, cmap, colors):
|
|
|
178
177
|
|
|
179
178
|
|
|
180
179
|
def _figsize(args: argparse.Namespace, k: int) -> tuple[float, float]:
|
|
181
|
-
if args.size
|
|
180
|
+
if args.size is not None:
|
|
182
181
|
return parse_figsize(args.size)
|
|
183
182
|
side = min(_PANEL_INCHES * k, _MAX_INCHES)
|
|
184
183
|
return side, side
|
|
@@ -609,7 +609,7 @@ class PhewasCommand(BaseCommand):
|
|
|
609
609
|
)
|
|
610
610
|
|
|
611
611
|
add_figure_arguments(parser)
|
|
612
|
-
parser.set_defaults(
|
|
612
|
+
parser.set_defaults(default_size="8x4.5")
|
|
613
613
|
|
|
614
614
|
def execute(self, args: argparse.Namespace) -> None:
|
|
615
615
|
if args.logy is not None and args.logy <= 0:
|
|
@@ -176,24 +176,14 @@ def make_figure(
|
|
|
176
176
|
Returns (fig, axes) where axes is always a 2-D numpy array of shape
|
|
177
177
|
(nrows, ncols) for uniform indexing even when nrows=ncols=1.
|
|
178
178
|
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
179
|
+
--size, when given (a preset or WxH), is the whole figure, exactly: the
|
|
180
|
+
panels share it. Without it, the command's default size
|
|
181
|
+
(``args.default_size``, else _DEFAULT_SIZE) is the size of one panel, and
|
|
182
|
+
the figure grows with the grid up to _MAX_SCREEN_W × _MAX_SCREEN_H.
|
|
183
183
|
"""
|
|
184
184
|
import matplotlib.pyplot as plt
|
|
185
185
|
|
|
186
|
-
|
|
187
|
-
w, h = parse_figsize(size_str)
|
|
188
|
-
|
|
189
|
-
w_total = w * ncols
|
|
190
|
-
h_total = h * nrows
|
|
191
|
-
|
|
192
|
-
# Cap total size for freeform (non-preset) sizes so grids don't balloon.
|
|
193
|
-
if size_str not in _SIZE_PRESETS:
|
|
194
|
-
w_total = min(w_total, _MAX_SCREEN_W)
|
|
195
|
-
h_total = min(h_total, _MAX_SCREEN_H)
|
|
196
|
-
|
|
186
|
+
w_total, h_total = figure_size(args, nrows, ncols)
|
|
197
187
|
fig, axes = plt.subplots(
|
|
198
188
|
nrows,
|
|
199
189
|
ncols,
|
|
@@ -203,6 +193,18 @@ def make_figure(
|
|
|
203
193
|
return fig, axes
|
|
204
194
|
|
|
205
195
|
|
|
196
|
+
def figure_size(
|
|
197
|
+
args: argparse.Namespace, nrows: int = 1, ncols: int = 1
|
|
198
|
+
) -> tuple[float, float]:
|
|
199
|
+
"""(width, height) in inches of a figure of nrows × ncols panels; see
|
|
200
|
+
make_figure."""
|
|
201
|
+
given = getattr(args, "size", None)
|
|
202
|
+
if given is not None:
|
|
203
|
+
return parse_figsize(given)
|
|
204
|
+
w, h = parse_figsize(getattr(args, "default_size", None) or _DEFAULT_SIZE)
|
|
205
|
+
return min(w * ncols, _MAX_SCREEN_W), min(h * nrows, _MAX_SCREEN_H)
|
|
206
|
+
|
|
207
|
+
|
|
206
208
|
# ---------------------------------------------------------------------------
|
|
207
209
|
# Subplot grid for --subgraphcol
|
|
208
210
|
# ---------------------------------------------------------------------------
|
|
@@ -603,10 +605,12 @@ def add_figure_arguments(parser: argparse.ArgumentParser) -> None:
|
|
|
603
605
|
g.add_argument("-t", "--title", default="", metavar="TEXT", help="Figure title.")
|
|
604
606
|
g.add_argument(
|
|
605
607
|
"--size",
|
|
606
|
-
default=
|
|
608
|
+
default=None,
|
|
607
609
|
metavar="PRESET|WxH",
|
|
608
|
-
help='
|
|
609
|
-
|
|
610
|
+
help='Size of the whole figure, panels included: single (3.5" '
|
|
611
|
+
'journal column), double (7.2"), or WxH in inches (default: '
|
|
612
|
+
"a size per panel, growing with the panels up to "
|
|
613
|
+
f"{_MAX_SCREEN_W:g}x{_MAX_SCREEN_H:g}).",
|
|
610
614
|
)
|
|
611
615
|
g.add_argument(
|
|
612
616
|
"--fontsize",
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{dataframe_toolkit-0.27.0 → dataframe_toolkit-0.28.0}/src/dftk/skills/dftk/references/snakemake.md
RENAMED
|
File without changes
|