Closed lucygarner closed 2 years ago
So to answer your first issue regarding the conda install, what do you have in your base environment? Do you have python installed? In your base environment you should only have mamba installed and nothing else.
For the pysam issue, it may take me a little time to debug, do you have the command and the data that you are using to run bam2stats?
Thanks @Acribbs. My revision 0 of the base environment seems to contain python, and if I try to remove python, it will also remove conda. Is there any way I can easily get back to a "clean" base environment?
The command that I used was:
cgat bam2stats --force-output --output-filename-pattern=bam2stats.dir/sample_1.bamstats < mark_duplicates.dir/sample_1.dupmarked.bam > bam2stats.dir/sample_1.bamstats
Note: I wrote this command for a pipeline a few years ago now, so I hope the format is still correct!
I can send you one of my example BAM files.
Ah damn, unfortunately there isn't a good way to clean the base environment. The only reliable way is to reinstall miniconda.
Anything that is in your base environment usually gets copied to all your subsequent environment, so its pretty important not to install anything there
Command looks good, if you can send me the file I can try on my end.
Adam
Hi @Acribbs,
I just reinstalled miniconda, but python gets installed as a dependency.
This is what I ran:
curl -o Miniconda.sh https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh
bash Miniconda.sh -b -p conda
And these are the packages installed:
The following NEW packages will be INSTALLED:
_libgcc_mutex pkgs/main/linux-64::_libgcc_mutex-0.1-main
_openmp_mutex pkgs/main/linux-64::_openmp_mutex-4.5-1_gnu
brotlipy pkgs/main/linux-64::brotlipy-0.7.0-py39h27cfd23_1003
ca-certificates pkgs/main/linux-64::ca-certificates-2021.7.5-h06a4308_1
certifi pkgs/main/linux-64::certifi-2021.5.30-py39h06a4308_0
cffi pkgs/main/linux-64::cffi-1.14.6-py39h400218f_0
chardet pkgs/main/linux-64::chardet-4.0.0-py39h06a4308_1003
conda pkgs/main/linux-64::conda-4.10.3-py39h06a4308_0
conda-package-han~ pkgs/main/linux-64::conda-package-handling-1.7.3-py39h27cfd23_1
cryptography pkgs/main/linux-64::cryptography-3.4.7-py39hd23ed53_0
idna pkgs/main/noarch::idna-2.10-pyhd3eb1b0_0
ld_impl_linux-64 pkgs/main/linux-64::ld_impl_linux-64-2.35.1-h7274673_9
libffi pkgs/main/linux-64::libffi-3.3-he6710b0_2
libgcc-ng pkgs/main/linux-64::libgcc-ng-9.3.0-h5101ec6_17
libgomp pkgs/main/linux-64::libgomp-9.3.0-h5101ec6_17
libstdcxx-ng pkgs/main/linux-64::libstdcxx-ng-9.3.0-hd4cf53a_17
ncurses pkgs/main/linux-64::ncurses-6.2-he6710b0_1
openssl pkgs/main/linux-64::openssl-1.1.1k-h27cfd23_0
pip pkgs/main/linux-64::pip-21.1.3-py39h06a4308_0
pycosat pkgs/main/linux-64::pycosat-0.6.3-py39h27cfd23_0
pycparser pkgs/main/noarch::pycparser-2.20-py_2
pyopenssl pkgs/main/noarch::pyopenssl-20.0.1-pyhd3eb1b0_1
pysocks pkgs/main/linux-64::pysocks-1.7.1-py39h06a4308_0
python pkgs/main/linux-64::python-3.9.5-h12debd9_4
readline pkgs/main/linux-64::readline-8.1-h27cfd23_0
requests pkgs/main/noarch::requests-2.25.1-pyhd3eb1b0_0
ruamel_yaml pkgs/main/linux-64::ruamel_yaml-0.15.100-py39h27cfd23_0
setuptools pkgs/main/linux-64::setuptools-52.0.0-py39h06a4308_0
six pkgs/main/noarch::six-1.16.0-pyhd3eb1b0_0
sqlite pkgs/main/linux-64::sqlite-3.36.0-hc218d9a_0
tk pkgs/main/linux-64::tk-8.6.10-hbc83047_0
tqdm pkgs/main/noarch::tqdm-4.61.2-pyhd3eb1b0_1
tzdata pkgs/main/noarch::tzdata-2021a-h52ac0ba_0
urllib3 pkgs/main/noarch::urllib3-1.26.6-pyhd3eb1b0_1
wheel pkgs/main/noarch::wheel-0.36.2-pyhd3eb1b0_0
xz pkgs/main/linux-64::xz-5.2.5-h7b6447c_0
yaml pkgs/main/linux-64::yaml-0.2.5-h7b6447c_0
zlib pkgs/main/linux-64::zlib-1.2.11-h7b6447c_3
Hi,
I am able to reproduce this with
cgat bam2stats -h
Full steps (after ensuring that my shell does not have conda
already available):
mktemp -d
cd /tmp/<folder>
wget https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh
bash Miniconda3-latest-Linux-x86_64.sh -b -p conda-install
conda install -c conda-forge mamba
mamba create -n cgat-apps -c conda-forge -c bioconda cgat-apps
conda activate cgat-apps
cgat bam2stats -h
This installs pysam-0.17.0
for me as well. If I do:
mamba install -c conda-forge -c bioconda 'pysam<0.17'
I get cgat bam2stats -h
working again.
I hope it helps!
Best regards, Sebastian
Hi Sebastian,
Thanks for this, you beat me to it. I also found that the latest pysam build led to issues with bam2stats.
Now working out fi this is a cgat-apps issue or a pysam issue.
Thanks both!
AttributeError: module 'pysam.libcalignmentfile' has no attribute 'PileupColumn'
PileupColumn
was moved from libcalignmentfile to libcalignedsegment some years ago, and since pysam-developers/pysam#1007 (first released in 0.17.0) it no longer appears in libcalignmentfile.pxd at all — hence this error. So this particular error would go away if cgat-apps was rebuilt against current pysam.
Moreover it appears that nothing in cgat-apps actually uses PileupColumn
— at least, the text PileupColumn
does not appear in any source file. However cgat/BamTools/bamtools.pyx has
from pysam.libcalignmentfile cimport *
which (if built against pysam 0.16.0.1 or earlier) is presumably what is causing the need for (an outdated version of) PileupColumn
. So I suspect if you reduce the *
to only import what you actually need from libcalignmentfile (and similarly in the other *.pyx files that have a similar overly wide cimport
), this problem will disappear entirely (even if cgat-apps were rebuilt against 0.16.0.1 again).
Many thanks for your comment @jmarshall. I will make changes and go through the modifications made to pysam and hopefully catch other errors that may occur within our code. Thanks again!
Note that after PR #110 there are still several instances of cimport *
elsewhere:
$ git grep 'cimport\ \*'
cgat/BamTools/bamtools.pyx:from pysam.libchtslib cimport *
cgat/BamTools/bamtools.pyx:from pysam.libcfaidx cimport *
cgat/BamTools/geneprofile.pyx:from pysam.libchtslib cimport *
cgat/BamTools/geneprofile.pyx:from pysam.libcalignmentfile cimport *
cgat/BamTools/peakshape.pyx:from pysam.libcalignmentfile cimport *
cgat/FastqTools/fastqtools.pyx:from pysam.libchtslib cimport *
cgat/GeneModelAnalysis.pyx:from pysam.libchtslib cimport *
cgat/GeneModelAnalysis.pyx:from pysam.libcalignmentfile cimport *
cgat/VCFTools/vcftools.pyx:from pysam.libchtslib cimport *
doc/developing.rst: from csamtools cimport *
Hi @jmarshall, thanks and indeed I am aware but don't have time to change all the cimports yet so just wanted to fix this issue and fix the others at the weekend.
Hi,
I installed cgat-apps in a fresh Conda environment as follows:
I did not use mamba as this gave me an error (mamba installs python 3.9.7 by default):
When trying to run
bam2stats
, I get the following error:Do I require a different version of pysam?
conda list
: