C/C++教程

fastStructure和SNPhylo安装使用

本文主要是介绍fastStructure和SNPhylo安装使用,对大家解决编程问题具有一定的参考价值,需要的程序猿们随着小编来一起学习吧!

fastStructure和SNPhylo安装使用

1.1 fastStructure安装步骤(python2.7)

fastStructure是python软件编写的计算群体结构的软件,依赖较多,官网编译下载复杂,使用conda或者docker更方便。

conda create -n faststructure_py2  python=2.7
mamba install -c bioconda faststructure

1.2 fastStructure使用步骤

fastStructure使用bed格式基因型作为输入(plink生成):

## 将下面plink格式(map/ped)转为bed格式
chrall.plink.map ## 文件名
chrall.plink.ped ## 文件名

## 生成bed格式基因型
plink --file chrall.plink  --make-bed --out  chrallfas

## 基因型结果如下
chrallfas.bed
chrallfas.fam
chrallfas.bim

然后运行下面的主体命令:

for i in {2..10}
do
nohup python /home/cfc424/bin/miniconda3/envs/faststructure_py2/bin/structure.py -K ${i}\
 --input=chrallfas --output=genotypes_output &
done

## 筛选最合适的K群体个数和绘制图片
python chooseK.py --input=genotypes_output ## 假定K=5
python distruct.py -K 5 --input=genotypes_output --output=genotypes_output.svg 

2.1 SNPhylo安装步骤(python2.7)

SNPhylo是计算群体进化树的软件,依赖软件多,使用conda安装即可:

conda create -n snphylo_r4.0_py2 r=4.1 python=2.7
conda activate snphylo_r4.0_py2

在github release中下载SNPhylo的安装包,地址如下:

https://github.com/thlee/SNPhylo/releases/download/20180901/SNPhylo.20180901.zip

解压文件,进入配置命令,检查软件依赖软件:

bash ./setup.sh
R ## R4.1
python ## python2.7
muscle ## 比对软件
dnaml 
缺少R包:"getopt", "gdsfmt","SNPRelate","ape","phangorn"

提示环境中R包不存在,下载这些R包:

if (!requireNamespace("BiocManager", quietly = TRUE));install.packages("BiocManager") 
BiocManager::install(c("getopt", "gdsfmt","SNPRelate","ape","phangorn"))

重新运行成功安装:

bash ./setup.sh
## 最终提示
SNPHYLO is successfully installed!!!

2.1 SNPhylo使用

该软件接受VCF文件、HapMap文件和Simple SNP文件作为输入。
使用VCF文件的命令例子如下:

~/bin/SNPhylo-master/snphylo.sh -v ./Chrall.filter.maf0.05_maxmissing0.8.vcf -p 5 -c 5

以上,具体参数需要使用时查阅。

参考
https://rajanil.github.io/fastStructure/
https://github.com/thlee/SNPhylo
https://cloud.tencent.com/developer/news/311649
https://www.jianshu.com/p/64db4635e511

这篇关于fastStructure和SNPhylo安装使用的文章就介绍到这儿,希望我们推荐的文章对大家有所帮助,也希望大家多多支持为之网!