Ⅰ. 插件描述
Reverse-complement sequence search plugin for VimⅡ. 基本信息
|
Ⅲ. 安装方法
使用Vundle管理器安装
在你的.vimrc下添加:Plugin 'stveep/biovim'
… 然后在Vim中运行以下命令:
:source %
:PluginInstall
对于Vundle版本 < 0.10.2,请用上面的Bundle替换Plugin。
使用NeoBundle管理器安装
在你的.vimrc下添加:NeoBundle 'stveep/biovim'
… 然后在Vim中运行以下命令:
:source %
:NeoBundleInstall
使用VimPlug管理器安装
在你的.vimrc下添加:Plug 'stveep/biovim'
… 然后在Vim中运行以下命令:
:source %
:PlugInstall
使用Pathogen管理器安装
在终端中运行以下命令:cd ~/.vim/bundle
git clone https://github.com/stveep/biovim
Ⅳ. 文档说明
##Using vim with DNA sequences
Installation
Install using Pathogen.
cd ~/.vim/bundle
git clone https://github.com/stveep/biovim.gitVim needs to be compiled with ruby support. vim --version | grep ruby should show +ruby. Many vim installations have this by default.
Reverse-complement sequence search
Run as follows, e.g. to search for NGG or CCN:
:Biorc NGGOr in a vimscript, :call Rcsearch("NGG"); or from ruby BioVim.rcsearch("NGG").
This works by converting the search string to a case-insensitive regexp containing the supplied and reverse-complemented string. Results will highlight if hlsearch is set (:set hlsearch).
In-place reverse complementation
To activate this functionality, add the following lines to your ~/.vimrc file. If you don't have a similar line setting up a 'leader' character, add this:
let mapleader = ","This sets the 'leader' character to the comma (,). Add the following lines to map the reverse complement operator command to R.
nnoremap <leader>R :set operatorfunc=RcOperator<cr>g@
vnoremap <leader>R :<c-u>call RcOperator(visualmode())<cr>Restart vim. Now you can reverse complement sequences either using conventional movement operations in vim (hjkl, w, b etc.):
,R<movement>If your leader character is different, replace the comma with your custom leader. e.g. ,Rw will reverse-complement up until the start of the next "word". ,R2l will reverse-complement the following two bases.
Alternatively, select sequence using visual line (shift-v) or character (v) modes and type the ,R command.
Lucky BLAT searching
Basic BLAT searching of visual (character or line) highlighted sequence is supported via UCSC's "I'm feeling Lucky" BLAT search. Currently only human hg38 without hacking.
Add to ~/.vimrc:
nnoremap <leader>L :set operatorfunc=LuckyBlat<cr>g@
vnoremap <leader>L :<c-u>call LuckyBlat(visualmode())<cr>
nnoremap <leader>B :set operatorfunc=LuckyBlatURL<cr>g@
vnoremap <leader>B :<c-u>call LuckyBlatURL(visualmode())<cr>Select sequence as for in-place reverse complement above. ,L prints the location of the top BLAT hit as a message (use :messages to view history). ,B opens default browser with the genomic location of the top BLAT hit.
AGAGCGGGCGCGCCTCTTGCAAGAAATGCAGCGAshift-V,L
# =>BLAT: AGAGCGGGCGCGCCTCTTGCAAGAAATGCAGCGA^@
#Position: chr1:226407853-226407886
shift-V,B
# => opens browser with UCSC location aboveThis is a quick and dirty search that ignores other equally good or near matches - use at own risk!
For more details see plugin/test directory.