1. 程式人生 > >Vsearch免費替代收費版的usearch

Vsearch免費替代收費版的usearch

 

本文首先發佈於“巨集基因組”公眾號原創。

作者:舟行天下
編輯:metagenome

前言

用usearch,這個usearch在序列搜尋、聚類、去重、去嵌合體等序列操作有非常重要的作用。它由大神Robert Edgar開發,詳情見文章:擴增子分析神器USEARCH簡介

usearch這個軟體的安裝以及使用都非常方便,簡直就是擴增子測序分析的神器!進入官網USEARCH我們可以看到作者提供32位的免費版本和64位的收費版本。免費提供的32位版本限制使用者最多使用4G記憶體,依照本人資料量以及使用經驗的話,大於40個樣品可能就不能有效的跑完全部流程了。關於USEARCH的詳細介紹請參考:《

擴增子分析神器USEARCH簡介》 由於該軟體64位收費版確實有點貴,而且有的實驗室老闆不一定讓買。那麼有沒有什麼方法可以突破免費版本的記憶體限制呢? 小編在這裡就要給大家發一個福利了,讓你能無差別的使用usearch的絕大部分功能而且還不用收費。那就是用vsearch軟體替代usearch部分功能,結合usearch一起使用。

vsearch簡介

vsearch 是一個開源免費的64位,無記憶體限制的擴增子資料分析軟體。該軟體是專門針對Edgar大神開發的 USEARCH
軟體而設計的(Edgar 2010)。作者在文章前言中就提到由於Edgar大神開發的 USEARCH不開源,並且沒有給出其演算法的詳細描述,最主要是免費的版本只有32位,而且有4 GB的使用記憶體限制,所以他們想了想直接自己開發了一個與usearch功能類似的軟體工大家使用。根據谷歌學術的統計資料,該軟體從2 016年發表到現在已經被引用了218次。

從FIG.1可以看到:通過與USEARCH7和USEARCH8對比,VSEARCH在嵌合體檢測過程準確性優於USEARCH。 (FIG.1)

從FIG.2可以看到:通過與USEARCH7和USEARCH8對比,VSEARCH的搜尋準確率與USEARCH相當。 (FIG.2)

從FIG.2可以看到:通過與USEARCH7和USEARCH8對比,VSEARCH在聚類準確率上優於USEARCH的UPARSE功能。 (FIG.3)

vsearch主要的功能與引數都與usearch版本類似,其主要特點是開源免費,持續更新而且軟體易於安裝,且有各平臺的版本。 在最新發布的vsearch版本中,作者也針對usearch10中的UNOISE去噪方法(

詳細介紹),在vsearch中加入了UNOISE方法用於聚類分析。

vsearch軟體目前已經更新到了2.7.1版本,其Windows的安裝版本連結是:vsearch; MAC版本的下載連結是:MAC_vsearch
)

usearch+vsearch實戰操作

文中使用所有檔案下載連結:https://pan.baidu.com/s/1yS-WgViAPeix0jTbhtYOKQ 密碼:dmfy 然後我們將下載好的測試資料放在工作目錄下面。

首先是vsearch的安裝:

在linux中我們直接執行以下命令就可以直接安裝了

##如何安裝vsearch
wget https://github.com/torognes/vsearch/archive/v2.6.2.tar.gz
tar xzf v2.6.2.tar.gz
cd vsearch-2.6.2
./autogen.sh
./configure
make
make install  # as root or sudo make install

mkdir -p seq # 原始資料 raw data

要想靈活的玩轉vsearch加usearch軟體,那我們首先要知道usearch免費版本的軟體究竟是在你的分析流程中的哪幾個步驟限制了你的 資料量大小,這樣我們就可以在有需要替換的步驟用vsearch軟體進行替換了。當你拿到拆分好的擴增子資料後我們通過進行的資料處 理流程如下圖所示:(FIG.4)

從圖中我們可以看到usearch在整個分析流程中主要的記憶體限制步驟是<Dereplication>; <Chimera checking>以及 <Match OTU>這三個步驟。而這三步分別對應著的vsearch步驟是<vsearch —derep_fulllength>; <vsearch —uchime_ref>以及<vsearch —usearch_global>。轉化成一個可讀的OTU table了。

Vsearch使用實戰

# 目錄
mkdir -p temp # 臨時檔案 temp directory for intermediate files
mkdir -p result # 最終結果 important results

# 檔案
# pipeline.sh 分析主流程
# rdp_16s_v16.fa  16S資料庫
# seq/*.fq.gz 壓縮的原始測序資料
# doc/design.txt 實驗設計檔案

#Merge paired reads and label samples

# 測序資料解壓
gunzip seq/*

# 依照實驗設計批處理併合並

for i in `tail -n+2 doc/design.txt | cut -f 1`;do
vsearch --fastq_mergepairs seq/${i}_1.fq --reverse seq/${i}_2.fq --fastqout  temp/${i}.merged.fq
done 

for i in `tail -n+2 doc/design.txt | cut -f 1`;do
vsearch --fastx_filter temp/${i}.merged.fq  --fastqout temp/${i}.merged.relabe.fq --relabel ${i}. &
done

# 合併所有樣品至同一檔案
cat temp/*.merged.relabe.fq > temp/all.fq
ls -l temp/all.fq
less temp/all.fq
# remove useless file 
rm temp/*.merged.fq
# 壓縮原始檔案節省空間
#gzip seq/*
# 3. Cut primers and quality filter
# Cut barcode 10bp + V5 19bp in left and V7 18bp in right
vsearch --fastx_filter temp/all.fq --fastq_stripleft 29 --fastq_stripright 18 --fastqout temp/stripped.fq
# 質量控制fastq filter, keep reads error rates less than 1%
vsearch --fastx_filter temp/stripped.fq --fastq_maxee_rate 0.01 --fastaout temp/filtered.fa
#761431 sequences kept (of which 0 truncated), 5627 sequences discarded.

less temp/filtered.fa

# 4. 去冗餘與生成OTUs Dereplication and cluster otus
# 4.1 序列去冗餘,推薦使用vsearch,並新增miniuniqusize為8,去除低丰度,增加計算速度
vsearch --derep_fulllength temp/filtered.fa --sizein --fasta_width 0 --sizeout --output temp/uniques.fa --minuniquesize 2

## 如果用基於reference的去嵌合,# 細菌推薦用Gold資料庫去除嵌合體可以下載rdp_gold.fa作為reference資料庫 
#wget http://drive5.com/uchime/rdp_gold.fa
#然後執行下面這條註釋過的命令
#wget http://drive5.com/uchime/rdp_gold.fa
#vsearch --uchime_ref temp/filtered.fa --nonchimeras temp/filtered.nonchimera.fa --db ./rdp_gold.fa

#聚類分析生產OTU代表性序列
vsearch --cluster_fast temp/uniques.fa --id 0.97 --centroids result/otus.fa --relabel OTU_ --uc temp/clusters.uc
## 嵌合體的檢測與去除
#vsearch --uchime_ref temp/filtered.fa --nonchimeras temp/filtered.nonchimera.fa --db rdp_gold.fa

# Create OTUs table建立OTU表格

vsearch --usearch_global temp/filtered.fa --db result/otus.fa --id 0.97 --otutabout result/otutab.txt

Reference

  1. Rognes, T., Flouri, T., Nichols, B., Quince, C., & Mahé, F. (2016). VSEARCH: a versatile open source tool for metagenomics. PeerJ, 4, e2584.
  2. Edgar, R.C. (2013) UPARSE: Highly accurate OTU sequences from microbial amplicon reads, Nature Methods [Pubmed:23955772, dx.doi.org/10.1038/nmeth.2604].
  3. UNOISE2: Improved error-correction for Illumina 16S and ITS amplicon read. bioRxiv, 2016