首页 > 其他分享 >选择清除分析软件XP-CLR的安装折腾之路

选择清除分析软件XP-CLR的安装折腾之路

时间:2023-09-16 15:32:06浏览次数:41  
标签:__ bin vcf -- project xpclr 折腾 XP CLR

目录

  • 1. 原版
  • 2. Python版本
  • 安装
  • 运行
  • 原因分析
  • 后续分析推荐

1. 原版

安装比较简单。

wget https://reich.hms.harvard.edu/sites/reich.hms.harvard.edu/files/inline-files/XPCLR.tar

tar xvf XPCLR.tar

直接运行bin下的XPCLR即可,若不能运行,则编译下:

cd src
make 
make install

原版分析时准备文件过程较为繁琐,因此更建议使用Python版。

$ /project/biosoft/XPCLR/bin/XPCLR -h
Usage:
 XPCLR -xpclr hapmapInput1 hapmapInput2 mapInput outFile -w gWin(Morgan) snpWin gridSize(bp) chrN -p corrLevel
-w1: gWin sets the size of a sliding window(units: 100cM),sWin sets # of SNPs in a window. otherwise, no sliding window
-p1:the input genotpe is already phased. -p0: the input genotype is not phased
corrLevel: the value is on (0,1], set corrLevel equal to 0 if no correction is needed

2. Python版本

安装

conda create -n xpclr  -c bioconda xpclr
conda activate xpclr

报错:

$ xpclr -h
Traceback (most recent call last):
  File "/home/miniconda3/envs/xpclr/bin/xpclr", line 5, in <module>
    import xpclr
  File "/home/miniconda3/envs/xpclr/lib/python2.7/site-packages/xpclr/__init__.py", line 3, in <module>
    from xpclr import methods
  File "/home/miniconda3/envs/xpclr/lib/python2.7/site-packages/xpclr/methods.py", line 11, in <module>
    from functools import lru_cache
ImportError: cannot import name lru_cache

重新安装pip install lru_cache仍然报错。
由于python版本引起,直接修改methods.pyfrom functools import lru_cache的为:

try:
    from functools import lru_cache
except ImportError:
    from backports.functools_lru_cache import lru_cache

运行

xpclr --format  vcf --input /project/04.sweep/sample750_miss0.6_impute/meanDP3.miss0.6.maf0.01.impute.rename.vcf \
    --samplesA /project/04.sweep/sample750_miss0.6_impute/List/w-l-c/Cultivar.list \
    --samplesB /project/04.sweep/sample750_miss0.6_impute/List/w-l-c/Wild.list \
    --chr 1 --maxsnps 600 --size 1000 --step 1000 --out test_out

报错:

Traceback (most recent call last):
  File "/home/miniconda3/envs/xpclr/bin/xpclr", line 195, in <module>
    main()
  File "/home/miniconda3/envs/xpclr/bin/xpclr", line 88, in main
    "No permission to write in the specified directory: {0}".format(outdir)
AssertionError: No permission to write in the specified directory:

xpclr第84行fn = args.out修改为:

fn = os.path.abspath(args.out)

运行继续报错:

2023-03-17 19:05:48 : INFO : running xpclr v1.1.0
2023-03-17 19:05:48 : INFO : Loading VCF
Traceback (most recent call last):
  File "/home/miniconda3/envs/xpclr/bin/xpclr", line 196, in <module>
    main()
  File "/home/miniconda3/envs/xpclr/bin/xpclr", line 103, in main
    gdistkey=args.gdistkey)
  File "/home/miniconda3/envs/xpclr/lib/python2.7/site-packages/xpclr/util.py", line 112, inload_vcf_format_data
    pos1, geno1 = load_vcf_wrapper(vcf_fn, chrom, samples1)
  File "/home/miniconda3/envs/xpclr/lib/python2.7/site-packages/xpclr/util.py", line 94, in load_vcf_wrapper
    callset = allel.read_vcf(
AttributeError: 'module' object has no attribute 'read_vcf'

网上没有我的同类安装相关错误报道,查看了下allel模块,确实没有read_vcf函数:

Python 2.7.18 |Anaconda, Inc.| (default, Nov 25 2022, 06:27:37)
[GCC 11.2.0] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import allel
>>> allel
<module 'allel' from '/home/miniconda3/envs/xpclr/lib/python2.7/site-packages/scikit_allel-0.20.3-py2.7-linux-x86_64.egg/allel/__init__.py'>
>>> dir(allel)
['AlleleCountsArray', 'AlleleCountsCArray', 'AlleleCountsCTable', 'AlleleCountsChunkedArray', 'AlleleCountsChunkedTable', 'AlleleCountsDaskArray', 'FeatureCTable', 'FeatureChunkedTable', 'FeatureTable', 'GenotypeArray', 'GenotypeCArray', 'GenotypeChunkedArray', 'GenotypeDaskArray', 'HaplotypeArray', 'HaplotypeCArray', 'HaplotypeChunkedArray', 'HaplotypeDaskArray', 'SortedIndex', 'SortedMultiIndex', 'UniqueIndex', 'VariantCTable', 'VariantChunkedTable', 'VariantTable', '__builtins__', '__doc__', '__file__', '__loader__', '__name__', '__package__', '__path__', '__version__', '_bcolz', '_da', 'chunked', 'compat', 'constants', 'io', 'model', 'plot', 'stats', 'util']

但实际上官网上是有这个函数的:

选择清除分析软件XP-CLR的安装折腾之路_python

难道是版本问题吗?装了下python3版本,发现确实是有的:

选择清除分析软件XP-CLR的安装折腾之路_Python_02

试图重新安装,旧版本删除不了:

$ pip uninstall scikit-allel
DEPRECATION: Python 2.7 will reach the end of its life on January 1st, 2020. Please upgrade your Python as Python 2.7 won't be maintained after that date. A future version of pip will dropsupport for Python 2.7. More details about Python 2 support in pip, can be found at https://pip.pypa.io/en/latest/development/release-process/#python-2-support
ERROR: Cannot remove entries from nonexistent file /home/pengjx/miniconda3/envs/xpclr/lib/python2.7/site-packages/easy-install.pth

升级也升级不了:

>pip install --upgrade --ignore-installed scikit-allel -i https://pypi.tuna.tsinghua.edu.cn/simple
.......
  ERROR: Command errored out with exit status 1:

没办法放弃conda安装,直接从GitHub安装:https://github.com/hardingnj/xpclr。

git clone https://github.com/hardingnj/xpclr.git
cd xpclr
python setup.py install

进入bin后,可直接运行xpclr:

$ xpclr -h
usage: xpclr [-h] --out OUT [--format FORMAT] [--input INPUT] [--gdistkey GDISTKEY] [--samplesA SAMPLESA] [--samplesB SAMPLESB] [--rrate RRATE] [--map MAP] [--popA POPA] [--popB POPB]
             --chr CHROM [--ld LDCUTOFF] [--phased] [--verbose VERBOSE] [--maxsnps MAXSNPS] [--minsnps MINSNPS] [--size SIZE] [--start START] [--stop STOP] [--step STEP]

Tool to calculate XP-CLR as per Chen, Patterson, Reich 2010

需要注意的是,你如果使用xpclr的全路径是运行不了的:

$ /project/xpclr/bin/xpclr
Traceback (most recent call last):
  File "/project/xpclr/bin/xpclr", line 4, in <module>
    import numpy as np
ImportError: No module named numpy

安装依赖包:pip install -r requirements.txt -i https://pypi.tuna.tsinghua.edu.cn/simple
这时,也可以用python(实际上我当前的版本已经是Python 3.9.1,所以xpclr也是支持的。)来调用全路径:

python /project/xpclr/bin/xpclr --format  vcf --input /project/04.sweep/sample750_miss0.6_impute/meanDP3.miss0.6.maf0.01.impute.rename.vcf --samplesA /project/04.sweep/sample750_miss0.6_impute/List/w-l-c/Cultivar.list --samplesB /project/04.sweep/sample750_miss0.6_impute/List/w-l-c/Wild.list --chr 1 --maxsnps 600 --size 1000 --step 1000 --out test_out

建议还是将安装路径/project/xpclr/bin加入环境变量(测试了下,貌似不用加入环境变量也可直接调用,可能是软件安装环节已经加入),直接用xpclr。

原因分析

conda安装虽然便捷,但作者没有及时更新,最早的版本也是在3年前(Python2),导致一些包不兼容。

选择清除分析软件XP-CLR的安装折腾之路_Python_03


而GitHub版本作者还是在维护的,所以对于后来者推荐之。

选择清除分析软件XP-CLR的安装折腾之路_List_04

后续分析推荐

原版XP-CLR用法参考:https://zhuanlan.zhihu.com/p/145387269

Python版XP-CLR用法参考:https://www.jianshu.com/p/9c827a0be66d

作者:Bioinfarmer,微信公众号:Bioinfarmer。



标签:__,bin,vcf,--,project,xpclr,折腾,XP,CLR
From: https://blog.51cto.com/u_15668923/7494059

相关文章

  • 长达 1.7 万字的 explain 关键字指南!
    当你的数据里只有几千几万,那么SQL优化并不会发挥太大价值,但当你的数据里去到了几百上千万,SQL优化的价值就体现出来了!因此稍微有些经验的同学都知道,怎么让MySQL查询语句又快又好是一件很重要的事情。要让SQL又快又好的前提是,我们知道它「病」在哪里,而explain关键字就是MyS......
  • xpath
    XPath即为XML路径语言(XMLPathLanguage),它是一种用来确定XML文档中某部分位置的语言。XPath基于XML的树状结构,提供在数据结构树中找寻节点的能力。起初XPath的提出的初衷是将其作为一个通用的、介于XPointer与XSL间的语法模型。但是XPath很快地被开发者采用来当作小型查询语言。一......
  • Nodejs+Express+MongoDB实战
    项目安装安装express脚手架:npminstallexpress-generator-g创建项目:express-eproject-e代表使用ejs模板,project是项目名称进入项目:npminstall下载依赖包安装nodemon:npminstallnodemon-g使用nodemon来启动项目,不用node来启动启动项目:npmstart,端口号在www启动文件中可以......
  • explanation
    PolynomialshapefunctionsThebasisfunctionvectorisgeneratedwithrow-stackingoftheindividuallagrangepolynomials.Eachpolynomialdefinedintheinterval \([-1,1]\) isafunctionoftheparameter \(r\).Thecurveparametersmatrix \(\bolds......
  • 界面组件DevExpress WinForms v23.1亮点 - 全新升级HTML & CSS模板
    DevExpressWinForms拥有180+组件和UI库,能为WindowsForms平台创建具有影响力的业务解决方案。DevExpressWinForms能完美构建流畅、美观且易于使用的应用程序,无论是Office风格的界面,还是分析处理大批量的业务数据,它都能轻松胜任!DevExpressWinForm 控件已正式发布v23.1版本,此版......
  • 【愚公系列】2023年09月 WPF控件专题 Expander控件详解
    (文章目录)前言WPF控件是WindowsPresentationFoundation(WPF)中的基本用户界面元素。它们是可视化对象,可以用来创建各种用户界面。WPF控件可以分为两类:原生控件和自定义控件。原生控件是由Microsoft提供的内置控件,如Button、TextBox、Label、ComboBox等。这些控件都是WPF中常见......
  • 解密MySQL中强大的武器——REGEXP正则表达式
    家人们,今天我来为大家介绍一项在MySQL中非常强大的武器——REGEXP正则表达式。MySQL作为一款广泛使用的关系型数据库管理系统,其内置的REGEXP关键字为我们提供了强大的正则表达式功能,使得我们可以更加灵活和高效地进行数据匹配和处理。以下是一些常见的用法和语法规则来详解REG......
  • MySQL之Explain各列详解
    Explain各列详解explain语句执行后返回id、select_type、table、type、possible_keys、key、key_len、ref、rows、Extra列。1、id列id列的编号是select的序列号,有几个select就有几个id,并且id的顺序是按照select出现顺序增长的,MySQL将select查询分为简单查询(SIMPLE)和复杂查询(P......
  • WiFi6 Series IP68 Maxon explosion-proof WiFi base station
    Thereareavarietyofmaxonexplosion-proofWiFibasestations.It'satypeofwirelessnetworkingthatisdesignedtobeusedinhazardousareaswherethereisariskofexplosion,suchasoilandgasrefineries,chemicalplants,andpowerplants.......
  • Paper reading: Improving Deep Forest by Exploiting High-order Interactions
    目录研究动机文章贡献本文方法通过gRIT和ERF提取特征交互特征交互的稳定性分数自适应层次生成实验结果合成数据集实验真实数据集实验数据集实验设置实验结果计算复杂度优点和创新点PaperReading是从个人角度进行的一些总结分享,受到个人关注点的侧重和实力所限,可能有理解不......