Skip to content

Commit 6ba2312

Browse files
committed
0.4b15: PyPI. Gtk.CRITICAL 🪲 F1 help and F5 refresh. GPLv3 instead of MIT. new_version loop.
1 parent 73d821e commit 6ba2312

File tree

16 files changed

+835
-122
lines changed

16 files changed

+835
-122
lines changed

LICENSE.md

100755100644
Lines changed: 673 additions & 19 deletions
Large diffs are not rendered by default.

README.md

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
# AB12PHYLO
22

3-
![PyPI license](https://img.shields.io/pypi/l/ansicolortags.svg)
4-
![github version](https://img.shields.io/static/v1?label=version&message=0.4b013&color=blue&style=flat)
5-
![Python version](https://img.shields.io/static/v1?label=python&message=3.6&color=orange&style=flat&logo=python)
3+
![PyPI license](https://img.shields.io/pypi/l/ab12phylo?color=green)
4+
![github version](https://img.shields.io/static/v1?label=version&message=0.4.15-beta&color=brightgreen&style=flat)
5+
![PyPI Python version](https://img.shields.io/pypi/pyversions/ab12phylo)
66

77
[AB12PHYLO](https://github.com/lkndl/ab12phylo) is an integrated, easy-to-use pipeline for Maximum Likelihood (ML) phylogenetic tree inference from ABI sequencing data.
88
At its core, AB12PHYLO runs parallelized instances of [RAxML-NG](https://github.com/amkozlov/raxml-ng) (Kozlov et al. 2019) and a BLAST search in a reference database.
@@ -15,11 +15,11 @@ AB12PHYLO was developed to identify plant pathogen populations possibly under ba
1515

1616
## Installation
1717

18-
First, clone the AB12PHYLO repository:
19-
18+
The recommended way to install AB12PHYLO is via
2019
```shell script
21-
git clone https://github.com/lkndl/ab12phylo
20+
pip install ab12phylo
2221
```
22+
2323
All [external tools](#external-tools) are in the [Bioconda](https://anaconda.org/bioconda/repo) channel, which can simplify installation. To create a new or activate an existing python3 [conda](https://docs.conda.io/) environment:
2424
```shell script
2525
conda create -n <your_python3_conda_env> python=3
@@ -47,15 +47,18 @@ If you are on Linux and using conda, please check `which python` and `which pip`
4747
```
4848
In the case shown here, `pip` points to a version outside of your conda installation, so use `pip3`. If neither points to your conda, re-start your shell and check your environment. Sometimes there is no `pip` at all, which can be fixed on Linux using your package manager (or `sudo apt-get install python3-pip` on Ubuntu), or in conda via `conda install -c conda-forge pip`.
4949

50-
Now install AB12PHYLO and its python [dependencies](#dependencies) via `pip` or `pip3`:
50+
Now install AB12PHYLO and its python [dependencies](#dependencies) via `pip` or `pip3` as shown at the top.
51+
52+
Alternatively, build AB12PHYLO from source:
5153

52-
```shell script
54+
```shell script
55+
git clone https://github.com/lkndl/ab12phylo
5356
cd ab12phylo
5457
pip install --upgrade pip
5558
pip install .
5659
```
5760

58-
If starting AB12PHYLO via `ab12phylo` fails with something like `ValueError: Namespace Gtk not available` or `ModuleNotFoundError: No module named 'gi'`, the conda python cannot see GTK3. This can be fixed by installing GTK3 to `<env>` via:
61+
If starting AB12PHYLO via `ab12phylo` fails with something like `ValueError: Namespace Gtk not available` or `ModuleNotFoundError: No module named 'gi'`, you're missing PyGObject, the bindings for GTK3. You can find instructions for a system installation [here](https://pygobject.readthedocs.io/en/latest/getting_started.html), or install it to your conda `<env>` via:
5962

6063
```shell script
6164
conda install -c conda-forge pygobject gtk3

ab12phylo/__init__.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
# 2021 Leo Kaindl
2+
3+
__author__ = 'Leo Kaindl'
4+
__email__ = '[email protected]'
5+
__version__ = '0.4.15-beta'
6+
__date__ = '14 February 2021'
7+
__license__ = 'gpl-3.0'
8+
__status__ = 'Beta'

ab12phylo/files/gui.glade

Lines changed: 27 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1341,6 +1341,32 @@
13411341
</packing>
13421342
</child>
13431343
</object>
1344+
<object class="GtkHeaderBar" id="tbar">
1345+
<property name="name">tbar</property>
1346+
<property name="visible">True</property>
1347+
<property name="can-focus">False</property>
1348+
<property name="title" translatable="yes">AB12PHYLO</property>
1349+
<property name="has-subtitle">False</property>
1350+
<property name="spacing">0</property>
1351+
<property name="show-close-button">True</property>
1352+
<property name="decoration-layout">menu:minimize,maximize,close</property>
1353+
<child>
1354+
<object class="GtkMenuButton">
1355+
<property name="visible">True</property>
1356+
<property name="can-focus">True</property>
1357+
<property name="focus-on-click">False</property>
1358+
<property name="receives-default">True</property>
1359+
<property name="direction">none</property>
1360+
<property name="popover">pop_menu</property>
1361+
<child>
1362+
<placeholder/>
1363+
</child>
1364+
</object>
1365+
<packing>
1366+
<property name="pack-type">end</property>
1367+
</packing>
1368+
</child>
1369+
</object>
13441370
<object class="GtkAdjustment" id="qal_scroll_adj">
13451371
<property name="upper">100</property>
13461372
<property name="step-increment">1</property>
@@ -2644,6 +2670,7 @@ Alternatively, a color legend would nicely fit here.</property>
26442670
<child>
26452671
<object class="GtkScrolledWindow" id="parallel_qal">
26462672
<property name="name">parallel_qal</property>
2673+
<property name="height-request">1</property>
26472674
<property name="visible">True</property>
26482675
<property name="can-focus">True</property>
26492676
<property name="hexpand">True</property>
@@ -7193,7 +7220,6 @@ Please define your dataset of ABI trace files or sequence data in &lt;i&gt;.fast
71937220
<child>
71947221
<placeholder/>
71957222
</child>
7196-
<accelerator key="F1" signal="close"/>
71977223
</object>
71987224
<packing>
71997225
<property name="left-attach">0</property>
@@ -7271,7 +7297,6 @@ Please define your dataset of ABI trace files or sequence data in &lt;i&gt;.fast
72717297
<property name="icon-name">window-close-symbolic</property>
72727298
</object>
72737299
</child>
7274-
<accelerator key="a" signal="clicked" modifiers="GDK_LOCK_MASK"/>
72757300
<style>
72767301
<class name="image-button"/>
72777302
</style>
@@ -7348,31 +7373,4 @@ Please define your dataset of ABI trace files or sequence data in &lt;i&gt;.fast
73487373
<property name="hexpand">False</property>
73497374
<property name="stack">ml_stack</property>
73507375
</object>
7351-
<object class="GtkHeaderBar" id="tbar">
7352-
<property name="name">tbar</property>
7353-
<property name="visible">True</property>
7354-
<property name="can-focus">False</property>
7355-
<property name="title" translatable="yes">AB12PHYLO</property>
7356-
<property name="has-subtitle">False</property>
7357-
<property name="spacing">0</property>
7358-
<property name="show-close-button">True</property>
7359-
<property name="decoration-layout">menu:minimize,maximize,close</property>
7360-
<child>
7361-
<object class="GtkMenuButton">
7362-
<property name="visible">True</property>
7363-
<property name="can-focus">True</property>
7364-
<property name="focus-on-click">False</property>
7365-
<property name="receives-default">True</property>
7366-
<property name="align-widget">win</property>
7367-
<property name="direction">none</property>
7368-
<property name="popover">pop_menu</property>
7369-
<child>
7370-
<placeholder/>
7371-
</child>
7372-
</object>
7373-
<packing>
7374-
<property name="pack-type">end</property>
7375-
</packing>
7376-
</child>
7377-
</object>
73787376
</interface>

ab12phylo/gtk_app.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,13 @@
1717
from ab12phylo.gtk_tree import tree_page
1818

1919
gi.require_version('Gtk', '3.0')
20-
2120
LOG = logging.getLogger(__name__)
2221

2322

23+
# debug via G_DEBUG="fatal_warnings" gdb --args python /home/quirin/PYTHON/AB12PHYLO/ab12phylo/gtk_app.py
24+
# python3 -m build
25+
# twine upload dist/*
26+
2427
# set the icon theme
2528
# Gtk.Settings.get_default().set_property('gtk-icon-theme-name', 'Papirus-Dark-Maia')
2629
# Gtk.Settings.get_default().set_property('gtk-theme-name', 'Matcha-dark-sea')
@@ -183,6 +186,7 @@ def delete_and_ignore_rows(self, *args):
183186
elif page == 4:
184187
self.iface.view_gbl.grab_focus()
185188
self.drop_seqs()
189+
return True
186190

187191

188192
def main():

ab12phylo/gtk_base.py

Lines changed: 27 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,32 @@
11
# 2021 Leo Kaindl
22

33
import ast
4+
import hashlib
45
import logging
56
import mmap
67
import pickle
78
import shutil
8-
import sys
9-
import hashlib
109
import threading
11-
import warnings, zipfile
10+
import warnings
11+
import zipfile
1212
from argparse import Namespace
1313
from pathlib import Path
1414
from time import sleep
1515

1616
import gi
17-
import matplotlib.pyplot as plt
17+
import matplotlib
1818
import pandas as pd
19+
import sys
1920
from matplotlib.colorbar import ColorbarBase
2021
from matplotlib.colors import ListedColormap
2122

22-
from ab12phylo_cmd import msa
2323
from ab12phylo import repo
24-
from ab12phylo_cmd.__init__ import __version__, __author__, __email__
24+
from ab12phylo.__init__ import __version__, __author__, __email__
2525
from ab12phylo.gtk_proj import project_dataset
26+
from ab12phylo_cmd import msa
27+
28+
matplotlib.use('agg')
29+
import matplotlib.pyplot as plt
2630

2731
gi.require_version('Gtk', '3.0')
2832
from gi.repository import Gtk, Gdk, Gio, GLib, GObject, GdkPixbuf
@@ -67,11 +71,13 @@ def do_startup(self):
6771
self.set_accels_for_action(detailed_action_name='app.%s' % act,
6872
accels=['<Control>%s' % acc])
6973
self.set_accels_for_action(detailed_action_name='app.help',
70-
accels=['<Control>F1', '<Control>h'])
74+
accels=['F1', '<Control>h'])
7175
# self.add_accelerator(accelerator='<Control>h', action_name='app.help', parameter=None)
7276

7377
def do_command_line(self, cmd):
7478
options = cmd.get_options_dict().end().unpack()
79+
if 'version' in options:
80+
sys.exit('ab12phylo: %s' % __version__)
7581
if 'open' in options:
7682
self.load(options['open'])
7783
if 'proceed' in options:
@@ -87,8 +93,9 @@ def __init__(self):
8793
'to open a project from the commandline. '
8894
'A .proj file next to a directory of data.')
8995
self.add_main_option('proceed', ord('p'), GLib.OptionFlags.IN_MAIN,
90-
GLib.OptionArg.NONE, 'try to proceed',
91-
'to go to the next analysis stage.')
96+
GLib.OptionArg.NONE, 'try to proceed')
97+
self.add_main_option('version', ord('v'), GLib.OptionFlags.IN_MAIN,
98+
GLib.OptionArg.NONE, 'print version')
9299
# fetch all named objects from the .glade XML
93100
iface = dict()
94101
for widget in Gtk.Builder().new_from_file(str(ab12phylo_app_base.TEMPLATE)).get_objects():
@@ -129,7 +136,7 @@ def __init__(self):
129136
mod = b'lighter', b'darker'
130137
mod2 = 200 # per default, make TreeView text color darker
131138
theme = Gtk.Settings.get_default().get_property('gtk-theme-name')
132-
if 'dark' in theme:
139+
if 'dark' in theme.lower():
133140
mod = mod[::-1]
134141
mod2 = 255
135142

@@ -148,7 +155,7 @@ def __init__(self):
148155
button:active { background-color: #17f }
149156
notebook header { background-color: transparent; }
150157
'''
151-
if 'atcha' in theme:
158+
if 'matcha' in theme.lower():
152159
css += b'''
153160
.codeview text { background-color: %s(@bg_color); color: %s(@fg_color); }
154161
window { background-color: mix(@bg_color, rgba(127,127,127,0), 0.05) }
@@ -187,10 +194,12 @@ def __init__(self):
187194
# connect buttons
188195
iface.next.connect('clicked', self.proceed)
189196
self.bind_accelerator(self.accelerators, iface.next, '<Alt>Right')
197+
iface.next.grab_focus()
190198
iface.back.connect('clicked', self.step_back)
191199
self.bind_accelerator(self.accelerators, iface.back, '<Alt>Left')
192200
iface.refresh.connect('clicked', self.re_run)
193201
self.bind_accelerator(self.accelerators, iface.refresh, 'Return')
202+
self.bind_accelerator(self.accelerators, iface.refresh, 'F5')
194203
iface.reset.connect('clicked', self.reset)
195204
# any page change
196205
iface.notebook.connect_after('switch-page', self.refresh)
@@ -412,9 +421,10 @@ def _import(self, *args):
412421
self.iface.notebook.set_current_page(7)
413422
dialog.destroy()
414423

415-
def help(self, show=False, *args):
424+
def help(self, *args, **kwargs):
416425
bar = self.iface.infobar
417-
bar.set_revealed(not bar.get_revealed() or show)
426+
bar.set_revealed(not bar.get_revealed() or 'show' in kwargs)
427+
return True
418428

419429
def test(self, *args):
420430
if self.wd != Path('untitled'):
@@ -453,12 +463,13 @@ def on_quit(self, *args):
453463

454464
def about(self, *args):
455465
Gtk.AboutDialog(transient_for=self.win, modal=True, title='About AB12PHYLO',
456-
authors=['%s<%s>' % (__author__, __email__), 'Dr Remco Stam', 'Corinn Small'],
466+
authors=['%s<%s>' % (__author__, __email__),
467+
'Remco Stam<[email protected]>', 'Corinn Small'],
457468
comments='An integrated pipeline for Maximum Likelihood (ML) '
458469
'phylogenetic tree inference from ABI sequencing data',
459470
program_name='AB12PHYLO', version=__version__,
460471
website='https://github.com/lkndl/ab12phylo',
461-
website_label='Github Repo', license_type=Gtk.License.MIT_X11,
472+
website_label='Github Repo', license_type=Gtk.License.GPL_3_0,
462473
logo=GdkPixbuf.Pixbuf.new_from_file(str(ab12phylo_app_base.ICON))).present()
463474

464475
def _init_log(self, **kwargs):
@@ -1042,10 +1053,9 @@ def edit_numerical_entry_up_down(self, widget, event):
10421053
key = Gdk.keyval_name(event.keyval)
10431054
if key == 'Up':
10441055
widget.set_text(str(1 + int(widget.get_text())))
1045-
return True
10461056
elif key == 'Down':
10471057
widget.set_text(str(max(0, -1 + int(widget.get_text()))))
1048-
return True
1058+
return True
10491059

10501060
def edit_numerical_entry(self, widget):
10511061
# filter for numbers only

ab12phylo/gtk_msa.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,9 +42,9 @@ def __init__(self):
4242

4343
# connect buttons
4444
iface.msa_build.connect('clicked', self.start_align)
45-
self.bind_accelerator(self.accelerators, iface.msa_build, '<Enter>')
45+
self.bind_accelerator(self.accelerators, iface.msa_build, 'Return')
4646
iface.remote_build.connect('clicked', self.start_align, True)
47-
self.bind_accelerator(self.accelerators, iface.remote_build, '<Enter>')
47+
self.bind_accelerator(self.accelerators, iface.remote_build, 'Return')
4848

4949
data.msa.stack_child_name = iface.align_stack.get_visible_child_name()
5050

ab12phylo/gtk_proj.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ def __init__(self):
4141
bool) # low quality
4242
self.search_rev = False
4343
self.rgx = Namespace()
44-
self.qal = Namespace(gene_roll='all', accept_rev=False, accept_nophred=True,
44+
self.qal = Namespace(gene_roll='all', accept_rev=True, accept_nophred=True,
4545
min_phred=30, trim_out=8, trim_of=10, bad_stretch=5)
4646
self.msa = Namespace(cmd=dict(), remote_cmd=dict(), last_cmd='')
4747
self.gbl = Namespace(ignore_ids=set())

ab12phylo/repo.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -148,10 +148,11 @@ def inc_priv_timestamp():
148148
'www.ncbi.nlm.nih.gov/nuccore/AF347033.1?report=fasta">AF347033.1</a>. '
149149
'If wellsplates are used in conjunction with sequence data for multiple '
150150
'genes, please make sure the plate layouts are identical.',
151-
1: 'Parse sample IDs / well coordinates, gene, orientation and wellsplate ID '
152-
'from the respective file name or sequence ID using <a href="https://regex101'
153-
'.com/r/Yulwlf/8" title="pre-publication/development stage examples">Regular '
154-
'Expressions</a> with capturing groups. Fields may be manually corrected.',
151+
1: 'Parse sample ID / well coordinates, gene, orientation and wellsplate ID '
152+
'from the file name using <a href="https://regex101.com/r/Yulwlf/8" title='
153+
'"development stage examples">Regular Expressions</a> with capturing groups. '
154+
'For <i>.fasta</i> files with multiple records, the sequence ID is used. '
155+
'Fields can be edited manually.',
155156
2: 'ABI trace files can be trimmed to remove low-quality regions here, based '
156157
'on phred quality scores. The maximum score is 60, indicating the probability '
157158
'of an incorrect base call is 1:10^6. Equivalently, 30 indicates 1:1000.',

ab12phylo_cmd/__init__.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
__author__ = 'Leo Kaindl'
44
__email__ = '[email protected]'
5-
__version__ = '0.4b13'
6-
__date__ = '12 February 2021'
7-
__license__ = 'MIT'
5+
__version__ = '0.4.15-beta'
6+
__date__ = '14 February 2021'
7+
__license__ = 'gpl-3.0'
88
__status__ = 'Beta'

0 commit comments

Comments
 (0)