python生成序列的weblogo图

记忆力越来越差了,用个logo图都忘。还是写下来吧!奥利给~

  • 首先,如果是想立即看下logo图的话,我们可以用在线版,链接如下:
http://weblogo.threeplusone.com/create.cgi
  • 如果是本地命令行的话,可自定义参数较多。
  1. python 安装weblogo包
pip install weblogo
  1. 安装好之后就可以使用,命令如下
# Donor_Positive.fasta是输入序列文件
# Donor_Positive.png 输出的logo图
# --format PNG 输出格式
# --size large 输出尺寸,默认是medium。我觉得太小了。
weblogo --format PNG --size large < Donor_Positive.fasta > Donor_Positive.png
# V2
# 指定输入格式 fasta,样式 经典,dpi 1200
weblogo --format PNG --datatype fasta --color-scheme classic   --size large --resolution 1200  < IE_true_2880_train.fasta > IE_true_train.png

另外,命令行参数可选择使用。

Usage: weblogo [options]  < sequence_data.fa > sequence_logo.eps

Create sequence logos from biological sequence alignments.

Options:
     --version                  show program's version number and exit
  -h --help                     show this help message and exit

  Input/Output Options:
    -f --fin FILENAME           Sequence input file (default: stdin)
       --upload URL             Upload input file from URL
    -D --datatype FORMAT        Type of multiple sequence alignment or
                                position weight matrix file: (clustal, fasta,
                                msf, genbank, nbrf, nexus, phylip, stockholm,
                                intelligenetics, table, array, transfac)
    -o --fout FILENAME          Output file (default: stdout)
    -F --format FORMAT          Format of output: eps (default), png,
                                png_print, pdf, jpeg, svg, logodata

  Logo Data Options:
    -A --sequence-type TYPE     The type of sequence data: 'protein', 'rna' or
                                'dna'.
    -a --alphabet ALPHABET      The set of symbols to count, e.g. 'AGTC'. All
                                characters not in the alphabet are ignored. If
                                neither the alphabet nor sequence-type are
                                specified then weblogo will examine the input
                                data and make an educated guess. See also
                                --sequence-type, --ignore-lower-case
    -U --units UNIT             A unit of entropy ('bits' (default), 'nats',
                                'digits'), or a unit of free energy ('kT',
                                'kJ/mol', 'kcal/mol'), or 'probability' for
                                probabilities
       --composition COMP.      The expected composition of the sequences:
                                'auto' (default), 'equiprobable', 'none' (do
                                not perform any compositional adjustment), a
                                CG percentage, a species name (e.g. 'E. coli',
                                'H. sapiens'), or an explicit distribution
                                (e.g. "{'A':10, 'C':40, 'G':40, 'T':10}"). The
                                automatic option uses a typical distribution
                                for proteins and equiprobable distribution for
                                everything else.
       --weight NUMBER          The weight of prior data.  Default depends on
                                alphabet length
    -i --first-index INDEX      Index of first position in sequence data
                                (default: 1)
    -l --lower INDEX            Lower bound of sequence to display
    -u --upper INDEX            Upper bound of sequence to display

  Transformations:
    Optional transformations of the sequence data.

       --ignore-lower-case      Disregard lower case letters and only count
                                upper case letters in sequences.
       --reverse                reverse sequences
       --complement             complement nucleic sequences
       --revcomp                reverse complement nucleic sequences

  Logo Format Options:
    These options control the format and display of the logo.

    -s --size LOGOSIZE          Specify a standard logo size (small, medium
                                (default), large)
    -n --stacks-per-line COUNT  Maximum number of logo stacks per logo line.
                                (default: 40)
    -t --title TEXT             Logo title text.
       --label TEXT             A figure label, e.g. '2a'
    -X --show-xaxis YES/NO      Display sequence numbers along x-axis?
                                (default: True)
    -x --xlabel TEXT            X-axis label
       --annotate TEXT          A comma separated list of custom stack
                                annotations, e.g. '1,3,4,5,6,7'.  Annotation
                                list must be same length as sequences.
       --rotate-numbers YES/NO  Draw X-axis numbers with vertical orientation
                                (default: False).
       --number-interval NUMBER
                                Distance between numbers on X-axis (default:
                                5)
    -S --yaxis NUMBER           Height of yaxis in units. (Default: Maximum
                                value with uninformative prior.)
    -Y --show-yaxis YES/NO      Display entropy scale along y-axis? (default:
                                True)
    -y --ylabel TEXT            Y-axis label (default depends on plot type and
                                units)
    -E --show-ends YES/NO       Label the ends of the sequence? (default:
                                False)
    -P --fineprint TEXT         The fine print (default: weblogo version)
       --ticmarks NUMBER        Distance between ticmarks (default: 1.0)
       --errorbars YES/NO       Display error bars? (default: True)
       --reverse-stacks YES/NO  Draw stacks with largest letters on top?
                                (default: True)

  Color Options:
    Colors can be specified using CSS2 syntax. e.g. 'red', '#FF0000', etc.

    -c --color-scheme SCHEME    Specify a standard color scheme (auto, base
                                pairing, charge, chemistry, classic,
                                hydrophobicity, monochrome)
    -C --color COLOR SYMBOLS DESCRIPTION 
                                Specify symbol colors, e.g. --color black AG
                                'Purine' --color red TC 'Pyrimidine'
       --default-color COLOR    Symbol color if not otherwise specified.

  Font Format Options:
    These options provide control over the font sizes and types.

       --fontsize POINTS        Regular text font size in points (default: 10)
       --title-fontsize POINTS  Title text font size in points (default: 12)
       --small-fontsize POINTS  Small text font size in points (default: 6)
       --number-fontsize POINTS
                                Axis numbers font size in points (default: 8)
       --text-font FONT         Specify font for labels (default: ArialMT)
       --logo-font FONT         Specify font for logo (default: Arial-BoldMT)
       --title-font FONT        Specify font for title (default: ArialMT)

  Advanced Format Options:
    These options provide fine control over the display of the logo.

    -W --stack-width POINTS     Width of a logo stack (default: 10.8)
       --aspect-ratio POINTS    Ratio of stack height to width (default: 5)
       --box YES/NO             Draw boxes around symbols? (default: no)
       --resolution DPI         Bitmap resolution in dots per inch (DPI).
                                (Default: 96 DPI, except png_print, 600 DPI)
                                Low resolution bitmaps (DPI<300) are
                                antialiased.
       --scale-width YES/NO     Scale the visible stack width by the fraction
                                of symbols in the column?  (I.e. columns with
                                many gaps of unknowns are narrow.)  (Default:
                                yes)
       --debug YES/NO           Output additional diagnostic information.
                                (Default: False)
       --errorbar-fraction NUMBER
                                Sets error bars display proportion (default:
                                0.9)
       --errorbar-width-fraction NUMBER
                                Sets error bars width display proportion
                                (default: 0.25)
       --errorbar-gray NUMBER   Sets error bars' gray scale percentage
                                (default: 0.75)

  WebLogo Server:
    Run a standalone webserver on a local port.

       --serve                  Start a standalone WebLogo server for creating
                                sequence logos.
       --port PORT              Listen to this local port. (Default: 8080)

参考链接:

weblogo3的使用手册:http://weblogo.threeplusone.com/manual.html
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值