Skip to content

Commit 6d4942d

Browse files
authored
MRG: add --detection-column-name to presence_filter; other minor updates (#83)
* WIP: add `detection-column-name` * minor fixes * bump version * oops
1 parent b204d0f commit 6d4942d

File tree

3 files changed

+8
-6
lines changed

3 files changed

+8
-6
lines changed

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -459,14 +459,14 @@ sourmash sig cat sketches/{2,47,48,49,51,52,53,59,60,63}.sig.zip \
459459
-o 10sketches.sig.zip
460460
sourmash scripts pairwise 10sketches.sig.zip --write-all -o 10sketches.pairwise.csv
461461
462-
sourmash scripts tree --pairwise 10sketches.pairwise.csv --save-image 10sketches.pairwise-cmp.tree.png
462+
sourmash scripts tree --pairwise 10sketches.pairwise.csv -o 10sketches.pairwise-cmp.tree.png
463463
```
464464

465465
and each will produce this plot:
466466

467467
![neighbor joining tree](examples/disttree10sketches.pairwise.png)
468468

469-
To output the image to a file, specify the file name with `-o` and use your desired filetype extension (.html, .png, .jpg, .jpeg, .pdf, or .svg). To save the tree in newick format, use `--newick` and specify a file ending with '.nwk'. To open an interactive viewer for the tree file, use `--show`. Note: this requires an X display; do not use it without display capacity, as is will cause the tree command to fail.
469+
To output the image to a file, specify the file name with `-o` and use your desired filetype extension (.html, .png, .jpg, .jpeg, .pdf, or .svg). To save the tree in newick format, use `--newick` and specify a file ending with '.nwk'. To open an interactive viewer for the tree file, use `--show`. Note: this requires an X display; do not use it without display capacity, as it will cause the tree command to fail.
470470

471471
### `treemap` - plot a treemap summary of a taxonomy
472472

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ name = "sourmash_plugin_betterplot"
33
description = "sourmash plugin for improved plotting/viz and cluster examination."
44
readme = "README.md"
55
requires-python = ">=3.11"
6-
version = "0.5.3"
6+
version = "0.5.4"
77

88
# note: "legacy_cgi" is currently needed for ete3, but may need to be changed on next ete release, see: https://github.com/etetoolkit/ete/issues/780
99
dependencies = ["sourmash>=4.9.2,<5", "sourmash_utils>=0.2",

src/sourmash_plugin_betterplot.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1670,6 +1670,8 @@ def __init__(self, subparser):
16701670
help='detection threshold (default: None)')
16711671
subparser.add_argument('--detection', action="store_true",
16721672
default=True)
1673+
subparser.add_argument('--detection-column-name',
1674+
default='f_match_orig')
16731675
subparser.add_argument('--ani', dest='detection',
16741676
action="store_false")
16751677
subparser.add_argument('--green-color',
@@ -1701,11 +1703,11 @@ def main(self, args):
17011703
notify(f"filtered down to {len(df)} rows with match_containment_ani >= {args.min_ani} (--min-ani)")
17021704

17031705
if args.min_fraction:
1704-
df = df[df['f_match_orig'] >= args.min_fraction]
1705-
notify(f"filtered down to {len(df)} rows with f_match_orig >= {args.min_fraction} (--min-fraction)")
1706+
df = df[df[args.detection_column_name] >= args.min_fraction]
1707+
notify(f"filtered down to {len(df)} rows with {args.detection_column_name} >= {args.min_fraction} (--min-fraction)")
17061708

17071709
if args.detection:
1708-
plt.plot(df.f_match_orig, df.average_abund, 'k.')
1710+
plt.plot(df[args.detection_column_name], df.average_abund, 'k.')
17091711
else:
17101712
plt.plot(df.match_containment_ani, df.average_abund, 'k.')
17111713

0 commit comments

Comments
 (0)