Code
git clone git@github.com:PlasmoGenEpi/pmotools-python.git
pmotools-python is a tool base for interacting with the PMO format file in python. It provides both code to include in your python package as well as a command line interface to run some basic scripts on PMO files.
pmotools-python code can be found on github https://github.com/PlasmoGenEpi/pmotools-python/tree/develop
Downloading repo
Currently (as 2025-09) majority of code is currently still in develop branch
To set up a conda environment that has all the python libraries that would be needed by pmotools-python
From within repo can install with pip in a virtual environment
To enable bash auto-completion for pmotools-python
, add the following to your ~/.bash_completion
and make sure it’s being loaded as part of your .bashrc and/or ~/.bash_profile (on MacOS) or ~/.profile (on ubuntu)
_pmotools_python_complete()
{
local cur prev
COMPREPLY=()
cur="${COMP_WORDS[COMP_CWORD]}"
prev="${COMP_WORDS[COMP_CWORD-1]}"
# 1) Completing the command name (1st arg): list all commands
if [[ ${COMP_CWORD} -eq 1 ]]; then
# Our CLI prints machine-friendly list via --list-plain:
# "<command>\t<group>\t<help>"
local lines cmds
lines="$(${COMP_WORDS[0]} --list-plain 2>/dev/null)"
cmds="$(printf '%s\n' "${lines}" | awk -F'\t' '{print $1}')"
COMPREPLY=( $(compgen -W "${cmds}" -- "${cur}") )
return 0
fi
# 2) Completing flags for a leaf command: scrape leaf -h
if [[ "${cur}" == -* ]]; then
local helps opts
helps="$(${COMP_WORDS[0]} ${COMP_WORDS[1]} -h 2>/dev/null)"
# Pull out flag tokens and split comma-separated forms
opts="$(printf '%s\n' "${helps}" \
| sed -n 's/^[[:space:]]\{0,\}\(-[-[:alnum:]][-[:alnum:]]*\)\(, *-[[:alnum:]][-[:alnum:]]*\)\{0,\}.*/\1/p' \
| sed 's/, / /g')"
COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
return 0
fi
# 3) Otherwise, fall back to filename completion for positional args
COMPREPLY=( $(compgen -f -- "${cur}") )
return 0
}
complete -F _pmotools_python_complete pmotools-python
The above can also be found within the repo in the etc/
folder.
---
title: pmotools-python installation
---
```{r setup, echo=F}
source("../common.R")
```
# pmotools-python
pmotools-python is a tool base for interacting with the PMO format file in python. It provides both code to include in your python package as well as a command line interface to run some basic scripts on PMO files.
## Installation
pmotools-python code can be found on github <https://github.com/PlasmoGenEpi/pmotools-python/tree/develop>
### Set up
Downloading repo
```{bash, eval = F}
git clone git@github.com:PlasmoGenEpi/pmotools-python.git
```
Currently (as 2025-09) majority of code is currently still in develop branch
```{bash, eval = F}
cd pmotools-python
git checkout develop
```
#### Setting up python environment
To set up a conda environment that has all the python libraries that would be needed by pmotools-python
```{bash, eval = F}
conda env create -f envs/pmotools-env.yml
conda active pmotools
```
### Installing
From within repo can install with pip in a virtual environment
```{bash, eval = F}
pip install -e .
```
### Adding autocompletion
To enable bash auto-completion for `pmotools-python`, add the following to your `~/.bash_completion` and make sure it's being loaded as part of your .bashrc and/or ~/.bash_profile (on MacOS) or ~/.profile (on ubuntu)
```{bash, eval = F}
_pmotools_python_complete()
{
local cur prev
COMPREPLY=()
cur="${COMP_WORDS[COMP_CWORD]}"
prev="${COMP_WORDS[COMP_CWORD-1]}"
# 1) Completing the command name (1st arg): list all commands
if [[ ${COMP_CWORD} -eq 1 ]]; then
# Our CLI prints machine-friendly list via --list-plain:
# "<command>\t<group>\t<help>"
local lines cmds
lines="$(${COMP_WORDS[0]} --list-plain 2>/dev/null)"
cmds="$(printf '%s\n' "${lines}" | awk -F'\t' '{print $1}')"
COMPREPLY=( $(compgen -W "${cmds}" -- "${cur}") )
return 0
fi
# 2) Completing flags for a leaf command: scrape leaf -h
if [[ "${cur}" == -* ]]; then
local helps opts
helps="$(${COMP_WORDS[0]} ${COMP_WORDS[1]} -h 2>/dev/null)"
# Pull out flag tokens and split comma-separated forms
opts="$(printf '%s\n' "${helps}" \
| sed -n 's/^[[:space:]]\{0,\}\(-[-[:alnum:]][-[:alnum:]]*\)\(, *-[[:alnum:]][-[:alnum:]]*\)\{0,\}.*/\1/p' \
| sed 's/, / /g')"
COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
return 0
fi
# 3) Otherwise, fall back to filename completion for positional args
COMPREPLY=( $(compgen -f -- "${cur}") )
return 0
}
complete -F _pmotools_python_complete pmotools-python
```
The above can also be found within the repo in the `etc/` folder.