乡下人产国偷v产偷v自拍,国产午夜片在线观看,婷婷成人亚洲综合国产麻豆,久久综合给合久久狠狠狠9

  • <output id="e9wm2"></output>
    <s id="e9wm2"><nobr id="e9wm2"><ins id="e9wm2"></ins></nobr></s>

    • 分享

      使用TASSEL學(xué)習(xí)GWAS筆記(3/6):基因型數(shù)據(jù)可視化:kingship,PCA,MDS

       育種數(shù)據(jù)分析 2021-11-18

      筆記計(jì)劃分為六篇:

      第一篇:讀取plink基因型數(shù)據(jù)和表型數(shù)據(jù)

      第二篇:對(duì)基因型數(shù)據(jù)質(zhì)控:缺失質(zhì)控,maf質(zhì)控,hwe質(zhì)控,樣本質(zhì)控

      第三篇:基因型數(shù)據(jù)可視化:kingship,MDS,PCA

      第四篇:一般線性模型進(jìn)行GWAS分析(GLM模型) 

      第五篇:混合線性模型進(jìn)行GWAS分析(MLM模型) 

      第六篇:TASSEL結(jié)果可視化:QQ plot,曼哈頓圖

      已完成前兩篇,本篇是第三篇。

      1. 將質(zhì)控的plink數(shù)據(jù)讀入到TASSEL軟件

      上個(gè)教程中,質(zhì)控后的數(shù)據(jù):

      讀取到TASSEL中:

      2. 構(gòu)建kinship矩陣

      kinship矩陣是親緣關(guān)系矩陣,是根據(jù)樣本的SNP,構(gòu)建樣本間的親緣關(guān)系矩陣,在GS中也叫G矩陣。

      首先,選中基因型數(shù)據(jù),然后點(diǎn)擊Kinship按鈕:默認(rèn)選項(xiàng),點(diǎn)擊OK

      查看結(jié)果:

      將Kinship矩陣導(dǎo)出到本地文件夾,通過R語言進(jìn)行可視化。

      設(shè)置名稱:導(dǎo)出到本地:

      文件查看:前三行,為文件的信息,第一列為ID,沒有行頭。

      「使用R代碼進(jìn)行可視化:」

      library(data.table)

      kinship = fread("kinship-result.txt",skip = 3)
      setDF(kinship)
      row.names(kinship) = kinship$V1
      kinship$V1 = NULL
      colnames(kinship) = row.names(kinship)
      kinship = as.matrix(kinship)

      heatmap(kinship)

      3. 構(gòu)建PCA分析及可視化

      選中基因型,選擇PCA按鈕:默認(rèn)選項(xiàng):

      PCA結(jié)果1:PCA得分

      PCA結(jié)果2:特征值及百分比及累計(jì)百分比PCA結(jié)果3:特征向量

      將PCA結(jié)果導(dǎo)出到本地:

      「使用R語言繪制PCA圖:」

      # PCA
      pca_re = fread("pca-result.txt",skip = 2)
      head(pca_re)

      ## 2D-PCA
      library(ggplot2)
      ggplot(pca_re, aes(x=PC1, y=PC2)) + geom_point(size=2) +
      geom_hline(yintercept = 0) + # 添加x坐標(biāo)
      geom_vline(xintercept = 0) + # 添加y坐標(biāo)
      theme_bw()

      當(dāng)然,也可以畫3D-PCA:

      library(scatterplot3d)
      scatterplot3d(pca_re[,2:4],
      pch = 16,angle=30,
      box=T,type="p",
      lty.hide=2,lty.grid = 2)

      當(dāng)然,這里可以將PCA不同的解釋百分比加到坐標(biāo)軸上,這里不再做介紹,感興趣的可以翻看我之前的博客內(nèi)容。

      4. 構(gòu)建MDS分析及可視化

      ?

      多維標(biāo)度(Multidimensional scaling,縮寫MDS,又譯“多維尺度”)也稱作“相似度結(jié)構(gòu)分析”(Similarity structure analysis),屬于多重變量分析的方法之一,是社會(huì)學(xué)、數(shù)量心理學(xué)、市場(chǎng)營(yíng)銷等統(tǒng)計(jì)實(shí)證分析的常用方法。--wiki

      ?
      ?

      MDS The MDS method performs classical multidimensional scaling as adapted from the R code for cmdscale(). An alternate name for this analysis is principal coordinate analysis. It produces results that are very similar to PCA (principal components analysis) but starts with a distance matrix and results in coordinate axes that are scaled differently. To use MDS, create a distance matrix from a genotype using Analysis/Distance Matrix in TASSEL or import a distance matrix. Then, select the distance matrix, choose Analysis/MDS, and enter the number of coordinate axes and associated eigenvalues to be reported.

      ?

      在GWAS分析時(shí),MDS分析和PCA分析類似,都可以將成分作為協(xié)變量放到模型中,可視化也和PCA類似.

      ?

      MDS and PCA will handle missing data differently. PCA imputes missing data to the mean allele frequency. The distance matrix calculation computes pairwise distances between taxa, using only sites with non-missing data for each taxon in a pair. There is no theoretical reason to prefer one method over the other. The axes produced by either MDS or PCA can be used as covariates in GLM or MLM models to correct for population structure.

      ?

      「MDS分析分為兩步:」

      • 首先構(gòu)建Distance Matrix
      • 然后進(jìn)行MDS分析

      這里我們做一下演示:

      選中基因型,點(diǎn)擊Distance Matrix

      生成距離矩陣:

      然后進(jìn)行MDS分析:

      生成結(jié)果:

      導(dǎo)出到本地:

      查看文件:

      「使用R語言進(jìn)行可視化:」

      # MDS
      mds_re = fread("MDS-result.txt",skip = 2)
      head(mds_re)

      ## 2D-MDS
      library(ggplot2)
      ggplot(mds_re, aes(x=PC1, y=PC2)) + geom_point(size=2) +
      geom_hline(yintercept = 0) + # 添加x坐標(biāo)
      geom_vline(xintercept = 0) + # 添加y坐標(biāo)
      theme_bw()

      可以看到MDS的圖和PCA的圖比較類似。

      下一章節(jié),我們進(jìn)行:第四篇:一般線性模型進(jìn)行GWAS分析(GLM模型)的部分,到時(shí)候和R語言進(jìn)行比較,深入理解GLM模型的本質(zhì)。

      下期見!

        轉(zhuǎn)藏 分享 獻(xiàn)花(0

        0條評(píng)論

        發(fā)表

        請(qǐng)遵守用戶 評(píng)論公約

        類似文章 更多