otImplementedError: "sortBed" does not appear to be installed or on the path, so this method is disabled.

 
---------------------------------------------------------------------------
NotImplementedError                       Traceback (most recent call last)
Cell In[10], line 5
      3     s = pybedtools.BedTool(args.starrseq[0]).filter(lambda x: float(x[9]) > 1.30).sort().merge()
      4 else: ### merge replicates if having two  starr-seq peak file
----> 5     s1 = pybedtools.BedTool(args.starrseq[0]).filter(lambda x: float(x[9]) > 1.30).sort()
      6     s2 = pybedtools.BedTool(args.starrseq[1]).filter(lambda x: float(x[9]) > 1.30).sort()
      7     #s = s1.intersect(s2).filter(pybedtools.featurefuncs.greater_than, 300).sort().merge() #only 4000 positives

File /home/software/anaconda3/envs/mydlenv/lib/python3.8/site-packages/pybedtools/bedtool.py:923, in BedTool._log_to_history.<locals>.decorated(self, *args, **kwargs)
    919 def decorated(self, *args, **kwargs):
    920 
    921     # this calls the actual method in the first place; *result* is
    922     # whatever you get back
--> 923     result = method(self, *args, **kwargs)
    925     # add appropriate tags
    926     parent_tag = self._tag

File /home/software/anaconda3/envs/mydlenv/lib/python3.8/site-packages/pybedtools/bedtool.py:244, in _wraps.<locals>.decorator.<locals>.not_implemented_func(*args, **kwargs)
    243 def not_implemented_func(*args, **kwargs):
--> 244     raise NotImplementedError(help_str)

NotImplementedError: "sortBed" does not appear to be installed or on the path, so this method is disabled.  Please install a more recent version of BEDTools and re-import to use this method.

 ===========================================================

This error usually happens when bedtools bin folder is not in your PATH. You can check that by which sortBed.
If it is missing from PATH you can export it as:
export PATH="/PATH/TO/bedtools2/bin:$PATH".

I would recommend to use anaconda (or miniconda) as explained here to install all the python packages. Then you should make sure the conda binary folder is in your PATH by  export PATH="/PATH/TO/anconda/bin:$PATH".

===========================================================

首先保障已经安装了 bedtools-2

首先确保sortBed可以独立正常使用

 

# locate sortBed
/home/mysoft/bin/sortBed
/home/mysoft/bin/x86_64/bedtools-2.17.0/bin/sortBed
/home/mysoft/bin/x86_64/bedtools-2.17.0/docs/content/sortBed.rst
/home/mysoft/bin/x86_64/bedtools-2.17.0/obj/sortBed.o
/home/mysoft/bin/x86_64/bedtools-2.17.0/src/sortBed
/home/mysoft/bin/x86_64/bedtools-2.17.0/src/sortBed/Makefile
/home/mysoft/bin/x86_64/bedtools-2.17.0/src/sortBed/sortBed.cpp
/home/mysoft/bin/x86_64/bedtools-2.17.0/src/sortBed/sortBed.h
/home/mysoft/bin/x86_64/bedtools-2.17.0/src/sortBed/sortMain.cpp

 

# echo $PATH
/usr/lib/jvm/java-1.8.0-openjdk-1.8.0.191.b12-1.el7_6.x86_64/jre/bin:/home/software/anaconda3/bin:/home/software/anaconda3/condabin:/root/perl5/bin:/home/software/nanopolish/nanopolish:/root/.local/bin:/usr/local/python3/bin:/home/software/cufflinks-2.1.1.Linux_x86_64:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/root/bin:/home/software/cuda-10.0/bin

修改/etc/profile文件, 【https://www.cnblogs.com/emanlee/p/3464094.html
vi /etc/profile
在适当位置 加上  /home/mysoft/bin/x86_64/bedtools-2.17.0/bin
然后
source /etc/profile
这个对所有用户都起作用

 

命令行窗口可以正常使用,如下所示(但是:在jupyter notebook里面不能使用 sort(), 是不是sort会调用系统中的sortBed文件,调用不成功,所以错误  )

>>> import pybedtools
>>> s = pybedtools.BedTool('/data/peak.final.bed')
>>> s = pybedtools.BedTool('/data/peak.final.bed').filter(lambda x: float(x[9]) > 1.30).sort().merge()
>>> s
<BedTool(/tmp/pybedtools.dl2bexs4.tmp)>
>>>

pybedtools 会不会对sortBed的版本有要求,但是命令行窗口可以正常使用。

 

 conda install bedtools=2.27.1

#  conda install bedtools=2.27.1
Collecting package metadata (current_repodata.json): done
Solving environment: failed with initial frozen solve. Retrying with flexible solve.
Collecting package metadata (repodata.json): done
Solving environment: failed with initial frozen solve. Retrying with flexible solve.

PackagesNotFoundError: The following packages are not available from current channels:

  - bedtools=2.27.1

Current channels:

  - https://repo.anaconda.com/pkgs/main/linux-64
  - https://repo.anaconda.com/pkgs/main/noarch
  - https://repo.anaconda.com/pkgs/r/linux-64
  - https://repo.anaconda.com/pkgs/r/noarch

To search for alternate channels that may provide the conda package you're
looking for, navigate to

    https://anaconda.org

and use the search bar at the top of the page.


conda install -c bioconda bedtools

 

 

首先保障 sortBed 在centos 的命令行可以正常使用

然后保障 centos 命令行 python 中可以正常使用

然后是 notebook 中,重启服务。

 

===========================================================

https://github.com/bioinform/neusomatic/issues/11

https://github.com/bioinform/neusomatic#availability

posted @ 2023-10-10 19:58  emanlee  阅读(174)  评论(0编辑  收藏  举报