brentp / bwa-meth

fast and accurate alignment of BS-Seq reads using bwa-mem and a 3-letter genome
https://arxiv.org/abs/1401.1129
MIT License
139 stars 53 forks source link

toolshed issue #56

Closed supermaxiste closed 6 years ago

supermaxiste commented 6 years ago

Hi Brent, I was trying to have a testrun with the example from bwa-meth and after running bwameth.py --reference ref.fa t_R1.fastq.gz t_R2.fastq.gz -t 12 | samtools view -b - > bwa-meth.bam I get the following error:

Traceback (most recent call last): File "/home/superste/.local/bin/bwameth.py", line 4, in <module> __import__('pkg_resources').run_script('bwameth==0.2.1', 'bwameth.py') File "/usr/local/lib/python2.7/dist-packages/pkg_resources/__init__.py", line 750, in run_script self.require(requires)[0].run_script(script_name, ns) File "/usr/local/lib/python2.7/dist-packages/pkg_resources/__init__.py", line 1527, in run_script exec(code, namespace, namespace) File "/home/superste/.local/lib/python2.7/site-packages/bwameth-0.2.1-py2.7.egg/EGG-INFO/scripts/bwameth.py", line 509, in <module> main(sys.argv[1:]) File "/home/superste/.local/lib/python2.7/site-packages/bwameth-0.2.1-py2.7.egg/EGG-INFO/scripts/bwameth.py", line 506, in main set_as_failed=args.set_as_failed) File "/home/superste/.local/lib/python2.7/site-packages/bwameth-0.2.1-py2.7.egg/EGG-INFO/scripts/bwameth.py", line 331, in bwa_mem as_bam(cmd, fa, set_as_failed) File "/home/superste/.local/lib/python2.7/site-packages/bwameth-0.2.1-py2.7.egg/EGG-INFO/scripts/bwameth.py", line 341, in as_bam sam_iter = nopen_keep_parent_stdin(pfile, 'r') File "/home/superste/.local/lib/python2.7/site-packages/bwameth-0.2.1-py2.7.egg/EGG-INFO/scripts/bwameth.py", line 49, in nopen_keep_parent_stdin preexec_fn=toolshed.files.prefunc, AttributeError: 'module' object has no attribute 'prefunc'

I tried to reinstall both bwa-meth and toolshed but the error is still there.

Thank you in advance for the help!

Stefan

brentp commented 6 years ago

what is the output of:

python -c "import toolshed; print toolshed.__version__"

?

supermaxiste commented 6 years ago

0.4.0

brentp commented 6 years ago

so your bwameth must be getting an old version of toolshed or something. Do you have another toolshed installed on your system?

supermaxiste commented 6 years ago

Hi brent, there is no other version of toolshed installed that I know about. I checked all python packages in my system and no other version of toolshed seems to be there besides the one with the correct version. I'm going to look a bit deeper into the issue and will let you know if I find something else. Thank you for the help!

supermaxiste commented 6 years ago

Hi brent, I found the issue and you were right about the version. I was trying to run bwameth locally on a calculation server and my local old version of toolshed (0.4.0) was causing the issue. After deleting the old version and asking the admin to install the newer version (0.4.6) everything is working properly.

brentp commented 6 years ago

glad you figured it out. let me know if you have any more issues.

viralexia commented 2 years ago

Hi brent, I have a similar problem, with the same error.

bwameth.py --reference GCF_000648655.2_Cflo_2.0_genomic.fna.gz SRR3702960_trimmed.fq | samtools view -S -b > Cflo_SRR3702960.bam returns


`Found BWA MEM index
running: /scr/cachaca/sonja/miniconda3/envs/bwameth/bin/python /scr/cachaca/sonja/miniconda3/envs/bwameth/bin/bwameth.py c2t SRR3702960_trimmed.fq NA |bwa mem -T 40 -B 2 -L 10 -CM -R '@RG\tID:SRR3702960_trimmed\tSM:SRR3702960_trimmed' -t 6  GCF_000648655.2_Cflo_2.0_genomic.fna.gz.bwameth.c2t -

--------------------
Traceback (most recent call last):
  File "/scr/cachaca/sonja/miniconda3/envs/bwameth/bin/bwameth.py", line 559, in <module>
    main(sys.argv[1:])
  File "/scr/cachaca/sonja/miniconda3/envs/bwameth/bin/bwameth.py", line 550, in main
    bwa_mem(args.reference, conv_fqs_cmd, ' '.join(map(str, pass_through_args)),
  File "/scr/cachaca/sonja/miniconda3/envs/bwameth/bin/bwameth.py", line 370, in bwa_mem
    as_bam(cmd, fa, set_as_failed, do_not_penalize_chimeras)
  File "/scr/cachaca/sonja/miniconda3/envs/bwameth/bin/bwameth.py", line 380, in as_bam
    sam_iter = nopen_keep_parent_stdin(pfile, 'r')
  File "/scr/cachaca/sonja/miniconda3/envs/bwameth/bin/bwameth.py", line 60, in nopen_keep_parent_stdin
    preexec_fn=toolshed.files.prefunc,
AttributeError: module 'toolshed.files' has no attribute 'prefunc'
[main_samview] fail to read the header from "-".`

despite that my conda enviroment contains the following:

packages in environment at /scr/cachaca/sonja/miniconda3/envs/bwameth:

#

Name Version Build Channel

bwameth 0.2.3 pypi_0 pypi

packages in environment at /scr/cachaca/sonja/miniconda3/envs/bwameth:

#

Name Version Build Channel

toolshed 0.4.6 pypi_0 pypi

packages in environment at /scr/cachaca/sonja/miniconda3/envs/bwameth:

#

Name Version Build Channel

python 3.10.1 h62f1059_2_cpython conda-forge python_abi 3.10 2_cp310 conda-forge



Thanks for your help in advance.
Sonja
brentp commented 2 years ago

Hi, you must be getting an older toolshed. Versions < 0.4.5 did not have prefunc. You can try in a python terminal:

import toolshed
print(toolshed.__version__)
print(toolshed.files.prefunc)

and report the result here.

viralexia commented 2 years ago

python indeed finds an old version of toolshed:

>>> import toolshed
>>> print(toolshed.__version__)
0.4.0

Thanks a lot, I guess I can fix this.