-
Notifications
You must be signed in to change notification settings - Fork 1
Install
MetaLogo was written in Python in Linux. If you are using Windows, you could try MetaLogo in the Windows SubSystem for Linux to make sure no unexpected errors occurred when using MetaLogo to make sequence logos.
Before install MetaLogo, you could create a new virtual python environment for MetaLogo, which could make it easy for you to manage python packages by isolating them from others. However, this is a optional step.
$conda create -n metalogo python=3.7
$conda activate metalogo
Then please clone the MetaLogo repository to your local environment and execute following commands:
$git clone https://github.com/labomics/MetaLogo .
$cd MetaLogo
$pip install .
After install, you can import MetaLogo in your scripts or notebook like below:
You can also call MetaLogo by directly type metalogo in your terminal:
If you don't want to install MetaLogo package or commands to your system, you could run the entrypoint script directly after installing all the requirements:
$pip install -r requirements.txt
$cd ..
$python -m MetaLogo.MetaLogo.entry -h
MetaLogo also provides webserver to conveniently make sequence logos. The MetaLogo webserver was developed by using Dash, which is a lightweight tool for python apps development. For a temporary webserver for interactive operations, you need to install server related packages first by using following commands:
$pip install .[webserver]
Before running the server, you need to open the Redis service and Redis-Queue first. Please refer to https://redis.io/topics/quickstart to start Redis service.
Specifically, run the following commands:
wget http://download.redis.io/redis-stable.tar.gz
tar xvzf redis-stable.tar.gz
cd redis-stable
make
./src/redis-server
For the redis-queue, first enter the parent directory of MetaLogo, and then run:
export PYTHONPATH=$(pwd); rqworker -P $(pwd)
Remember keep the service running, open new terminals to execute new commands.
Then, you need to move fasttree and clustalo bins to /user/bin/, or you can specify your custom paths in the server.toml file.
chmod +x MetaLogo/dependencies/clustalo
chmod +x MetaLogo/dependencies/FastTree
chmod +x MetaLogo/dependencies/FastTreeMP
sudo cp MetaLogo/dependencies/clustalo MetaLogo/dependencies/FastTree MetaLogo/dependencies/FastTreeMP /usr/bin/
User can specify several options for MetaLogo webserver in the server.toml file.
$ cat MetaLogo/server.toml
# This is a TOML document
title = "MetaLogo webserver configure example"
example_path = 'MetaLogo/examples'
output_png_path = 'MetaLogo/figure_output'
output_fa_path = 'MetaLogo/sequence_input'
config_path = 'MetaLogo/configs'
log_path = 'MetaLogo/logs'
group_limit = 20
max_seq_limit = 200000
max_seq_limit_auto = 20000
max_seq_len = 2000
max_input_size = 5242880
#bins
clustalo_bin = '/usr/bin/clustalo'
fasttree_bin = '/usr/bin/FastTree'
fasttreemp_bin = '/usr/bin/FastTreeMP'
treecluster_bin = 'TreeCluster.py'
sqlite3_db = 'MetaLogo/db/metalogo.db'
Then you could run a development Dash webserver with Debug mode on:
$cat MetaLogo/server.dev.sh
python -m MetaLogo.server.index
$sh server.dev.sh
Dash is running on http://127.0.0.1:8050/
* Serving Flask app 'main' (lazy loading)
* Environment: production
WARNING: This is a development server. Do not use it in a production deployment.
Use a production WSGI server instead.
* Debug mode: on
A MetaLogo webserver will be like:
For a production server, you can build a docker container to provide the service:
$cat server.docker.sh
docker build -t metalogo:v2 .
docker run -d --expose 8050 --name metalogo -e VIRTUAL_HOST=metalogo.omicsnet.org -v "$(pwd)"/..:/code metalogo:v2
$sh server.docker.sh
...
$docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
ad598ca936df metalogo:v1 "/bin/sh -c 'GUNICORN" 2 days ago Up 2 days 8050/tcp metalogo
You can change VIRTUAL_HOST to your own domain name if you know how it works.
Docker needs to be installed in the system before run the command. This command will build the Docker image and start a Docker container. You could set a nginx-proxy layer to redirect network requests to MetaLogo container or you can just simply use the MetaLogo docker to receive outside network traffic from your local network.
Next: Alignment
developed by Yaowen Chen