Giter VIP home page Giter VIP logo

metalogo's Introduction

MetaLogo

Introduction

MetaLogo is a tool for making sequence logos. It can take multiple sequences as input, automatically identify the homogeneity and heterogeneity among sequences and cluster them into different groups given any wanted resolution, finally output multiple aligned sequence logos in one figure. Grouping can also be specified by users, such as grouping by lengths, grouping by sample Id, etc. Compared to conventional sequence logo generator, MetaLogo can display the total sequence population in a more detailed, dynamic and informative view.

To use MetaLogo, you could visit our public webserver http://metalogo.omicsnet.org. You could also install MetaLogo as a python package to using MetaLogo in your python scripts or in your OS terminal. If you want to provide MetaLogo to people in your local network, you could also setup a webserver by using docker.

Please check the tutorial for detailed usage of MetaLogo package and webserver.

Introduction

Install

Before you install MetaLogo, you could first set up a virtual environment for MetaLogo using conda:

$conda create -n metalogo python=3.7
$conda activate metalogo

Then, you can install MetaLogo using following commands:

$git clone https://github.com/labomics/MetaLogo 
$cd MetaLogo
$pip install .

If succeed, you can run MetaLogo directly:

$metalogo -h

Note that the paths of clustal omega and fasttree bins should be given to MetaLogo, which are required for grouping. You can have these binary files in the dependencies folder in this repo. Basically, you can run metalogo as follows:

$metalogo --seq_file examples/cdr3.fa --clustalo_bin dependencies/clustalo --fasttree_bin dependencies/FastTree --fasttreemp_bin dependencies/FastTreeMP --logo_format pdf --output_name test.xx --task_name test.xx

If you want to using MetaLogo in your scripts, it is also very easy:

from MetaLogo import logo
sequences = [['seq1','ATACAGATACACATCACAG'],['seq2','ATACAGAGATACCAACAGAC'],['seq3','ATACAGAGTTACCCACGGAC']]

bin_args = {
    'clustalo_bin':'../MetaLogo/dependencies/clustalo',
    'fasttree_bin':'../MetaLogo/dependencies/FastTree',
    'fasttreemp_bin':'../MetaLogo/dependencies/FastTreeMP',
    }

lg = logo.LogoGroup(sequences,height_algorithm='probabilities',group_strategy='length', **bin_args)
lg.draw()

Note that the paths of clustal omega and fasttree bins should be given to MetaLogo, which are required for grouping.

MetaLogo also provide webserver to draw sequence logos without coding. For server setup, you need to install the required packages first.

$pip install .[webserver]

You need to start a redis server and the redis queue servic before running the MetaLogo server locally (see tutorial). We recommend that you can build a docker container to provide the service:

$cat MetaLogo/server.docker.sh
 docker build -t metalogo:v1 .
 docker run -d  --expose 8050 --name metalogo -e VIRTUAL_HOST=metalogo.omicsnet.org -v "$(pwd)":/code metalogo:v1 
$sh MetaLogo/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

Docker needs to be installed in the system before running 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.

More detailed instructions please check the tutorial of MetaLogo.

Citation

Please kindly cite our work if you use MetaLogo in your work.

Chen, Yaowen, et al. "MetaLogo: a heterogeneity-aware sequence logo generator and aligner." Briefings in Bioinformatics (2021).

metalogo's People

Contributors

yaowenacademic avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

metalogo's Issues

图片输出为其他格式

图片输出为其他格式,而不是png,希望能添加一个输出项,修改源代码找起来就麻烦了。感谢!

metalogo fails when --task_name or --output_name contains a period

Thanks for making MetaLogo! I'm using v1.1.3.

Works fine

name=sample_A

metalogo \
    --seq_file sampleA.fasta \
    --seq_file_type fasta \
    --sequence_type dna \
    --task_name ${name} \
    --output_name ${name} \
    --clustalo_bin /programs/clustalo \
    --fasttree_bin /programs/fasttree/FastTree \
    --fasttreemp_bin /programs/fasttree/FastTreeMP

Fails

name=sample.A

metalogo \
    --seq_file sampleA.fasta \
    --seq_file_type fasta \
    --sequence_type dna \
    --task_name ${name} \
    --output_name ${name} \
    --clustalo_bin /programs/clustalo \
    --fasttree_bin /programs/fasttree/FastTree \
    --fasttreemp_bin /programs/fasttree/FastTreeMP

Error message

Traceback (most recent call last):
  File "/home/miniconda3/envs/metalogo/bin/metalogo", line 8, in <module>
    sys.exit(main())
  File "/home/miniconda3/envs/metalogo/lib/python3.7/site-packages/MetaLogo/entry.py", line 310, in main
    run_from_args(args)
  File "/home/miniconda3/envs/metalogo/lib/python3.7/site-packages/MetaLogo/entry.py", line 62, in run_from_args
    logogroup.savefig(f'{args.output_dir}/{args.output_name}')
  File "/home/miniconda3/envs/metalogo/lib/python3.7/site-packages/MetaLogo/item.py", line 28, in savefig
    self.ax.get_figure().savefig(filename,bbox_inches=bbox_inches)
  File "/home/miniconda3/envs/metalogo/lib/python3.7/site-packages/matplotlib/figure.py", line 3058, in savefig
    self.canvas.print_figure(fname, **kwargs)
  File "/home/miniconda3/envs/metalogo/lib/python3.7/site-packages/matplotlib/backend_bases.py", line 2259, in print_figure
    canvas = self._get_output_canvas(backend, format)
  File "/home/miniconda3/envs/metalogo/lib/python3.7/site-packages/matplotlib/backend_bases.py", line 2190, in _get_output_canvas
    .format(fmt, ", ".join(sorted(self.get_supported_filetypes()))))
ValueError: Format 'a' is not supported (supported formats: eps, jpeg, jpg, pdf, pgf, png, ps, raw, rgba, svg, svgz, tif, tiff)

metalogo fails to write pdf

The metalogo help text (metalogo -h) states that --logo_format can be used to specify either png or pdf output. However, --logo_format pdf is ignored, and a png is created.

I'm using metalogo v1.1.3.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.