可以做structure的R語言包LEA是怎樣的

這期內(nèi)容當中小編將會給大家?guī)碛嘘P(guān)可以做structure的R語言包LEA是怎樣的,文章內(nèi)容豐富且以專業(yè)的角度為大家分析和敘述,閱讀完這篇文章希望大家可以有所收獲。

目前創(chuàng)新互聯(lián)已為數(shù)千家的企業(yè)提供了網(wǎng)站建設(shè)、域名、虛擬空間、網(wǎng)站托管維護、企業(yè)網(wǎng)站設(shè)計、浮梁網(wǎng)站維護等服務(wù),公司將堅持客戶導(dǎo)向、應(yīng)用為本的策略,正道將秉承"和諧、參與、激情"的文化,與客戶和合作伙伴齊心協(xié)力一起成長,共同發(fā)展。

關(guān)于分群的軟件,之前寫了structure 2.3.4 軟件使用指南,軟件雖然有windows版本,但是操作太麻煩了,也寫了Admixture使用說明文檔cookbook,但是只有Linux版本,使用起來有難度。難道不能使用R語言進行structure繪圖么?結(jié)果來了:LEA!

1. paper

LEA: An R package for landscape and ecological association studies

使用說明文檔

不同格式的數(shù)據(jù)使用LEA

2. 軟件介紹

This short tutorial explains how population structure analyses reproducing the results of the widely-used computer program structure can be performed using commands in the R language. The method works for any operating systems, and it does not require the installation
of structure or additional computer programs. The R program allows running population structure inference algorithms, choosing the number of clusters, and showing admixture coefficient bar-plots using a few commands. The methods used by R are fast and accurate, and they
are free of standard population genetic equilibrium hypotheses. In addition, these methods allow their users to play with a large panel of graphical functions for displaying pie-charts and interpolated admixture coefficients on geographic maps.

劃重點:

  • 可以在R語言中實現(xiàn)軟件Structure的功能

  • 可以做類似admixture的圖

  • 簡單操作, 幾個命令實現(xiàn)相關(guān)功能

  • C語言開發(fā), 可以處理大數(shù)據(jù)

3. 軟件安裝
install.packages(c("fields","RColorBrewer","mapplots"))
source("http://bioconductor.org/biocLite.R")
biocLite("LEA")

如果安裝不成功, 也可以通過CRAN把軟件包下載到本地, 進行安裝:

install.packages("LEA_1.4.0_tar.gz", repos = NULL, type ="source")

載入兩個函數(shù), 進行格式轉(zhuǎn)化以及可視化:

source("http://membres-timc.imag.fr/Olivier.Francois/Conversion.R")
source("http://membres-timc.imag.fr/Olivier.Francois/POPSutilities.R")
4. 測試數(shù)據(jù)

plink格式的ped文件, 具體格式參考:plink格式的ped和map文件及轉(zhuǎn)化為012的方法

1 SAMPLE0 0 0 2 2 1 2 3 3 1 1 2 1
2 SAMPLE1 0 0 1 2 2 1 1 3 0 4 1 1
3 SAMPLE2 0 0 2 1 2 2 3 3 1 4 1 1

前六列為:
家系ID
個體ID
父本
母本
性別
表型值
SNP1-1(SNP1的第一個位點)
SNP1-2(SNP的第二個位點)

測試數(shù)據(jù)采用admixture的示例數(shù)據(jù), 使用plink將其轉(zhuǎn)化為ped文件

library(LEA)
# 結(jié)果會生成test.geno文件的數(shù)據(jù).
output = ped2lfmm("test.ped")
# 使用LEA進行structure進行分析
library(LEA)
obj.snmf = snmf("test.geno", K = 3, alpha = 100, project = "new")
qmatrix = Q(obj.snmf, K = 3)
head(qmatrix)
barplot(t(qmatrix), col = rainbow(3), border = NA, space = 0,
       xlab = "Individuals", ylab = "Admixture coefficients")

可以做structure的R語言包LEA是怎樣的

對比admixture的結(jié)果

# 對比admixture結(jié)果
qad = read.table("test.3.Q")
head(qad)
barplot(t(qad), col = rainbow(3), border = NA, space = 0,
       xlab = "Individuals", ylab = "Admixture coefficients")

可以做structure的R語言包LEA是怎樣的

5. 使用snmf選擇最優(yōu)K值
# 繪制折線圖, 選擇最優(yōu)K值.
plot(project, col = "blue", pch = 19, cex = 1.2)

可以做structure的R語言包LEA是怎樣的
可以看出, K=3時, 最小, 因此選擇K=3.

上述就是小編為大家分享的可以做structure的R語言包LEA是怎樣的了,如果剛好有類似的疑惑,不妨參照上述分析進行理解。如果想知道更多相關(guān)知識,歡迎關(guān)注創(chuàng)新互聯(lián)行業(yè)資訊頻道。

網(wǎng)站名稱:可以做structure的R語言包LEA是怎樣的
分享路徑:http://muchs.cn/article34/ppjjpe.html

成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供網(wǎng)站策劃企業(yè)建站、網(wǎng)站排名、App設(shè)計網(wǎng)站設(shè)計公司電子商務(wù)

廣告

聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請盡快告知,我們將會在第一時間刪除。文章觀點不代表本網(wǎng)站立場,如需處理請聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時需注明來源: 創(chuàng)新互聯(lián)

營銷型網(wǎng)站建設(shè)