Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Q: cutadapt 2.0 with Python 3.6.7 -> 'str' object has no attribute 'name' #366

Closed
sklages opened this issue Mar 12, 2019 · 11 comments

Comments

@sklages
Copy link

commented Mar 12, 2019

I upgraded to version 2.0 just a few hours ago .. now running a simple using conda

cutadapt --cores 8 --adapter AGATCGGAAGAGC -A AGATCGGAAGAGC --interleaved xxx.r1.fq.gz xxx.r2.fq.gz

raises an exception:

This is cutadapt 2.0 with Python 3.6.7
Command line parameters: --cores 8 --adapter AGATCGGAAGAGC -A AGATCGGAAGAGC --interleaved xxx.r1.fq.gz xxx.r2.fq.gz
Processing reads on 8 cores in paired-end mode ...
Traceback (most recent call last):
  File "/path/to/bin/cutadapt", line 12, in <module>
    sys.exit(main())
  File /path/to/anaconda3/envs/ngs/lib/python3.6/site-packages/cutadapt/__main__.py", line 787, in main
    stats = runner.run()
  File "/path/to/anaconda3/envs/ngs/lib/python3.6/site-packages/cutadapt/pipeline.py", line 684, in run
    raise e
AttributeError: 'str' object has no attribute 'name'

There went probably sth wrong during upgrade? Omitting --cores 8 just works fine..? Any idea?

@marcelm

This comment has been minimized.

Copy link
Owner

commented Mar 12, 2019

Hm, there was a somewhat similar message reported in issue #275 which was caused by the input file being named input_fastq.gz (with an underscore). This should be fixed, but I wonder whether something similar is going on. Can you test to rename the input files so that they have the extension.fastq.gz?

Also, is it correct that you do not use the -o option? Can you please add it, providing an explicit output file name, and see whether that makes a difference?

@marcelm marcelm added the bug label Mar 12, 2019

@marcelm

This comment has been minimized.

Copy link
Owner

commented Mar 12, 2019

Oh, no need to reply: I can reproduce the problem myself: Not using -o together with --cores greater than 1 does not work. This doesn’t seem to be covered by the unit tests, will need to fix this. As a workaround, you can either specify the output file name directly or use -o - (dash) to write to standard output as before.

@sklages

This comment has been minimized.

Copy link
Author

commented Mar 12, 2019

I just saw that too. Thanks for testing. I will do as recommended (I need to use cutadapt in a pipe, though I will need -o -).

@sklages

This comment has been minimized.

Copy link
Author

commented Mar 12, 2019

Hmm, still an issue as part of a pipe?

cutadapt --cores 8 \
--adapter AGATCGGAAGAGC -A AGATCGGAAGAGC \
--output - \
--interleaved INPUT_R1_001.fastq.gz INPUT_R2_001.fastq.gz  | \
cutadapt --interleaved --cores 8 --output x1 --paired-output x2 -

The first part, isolated, works fine. Together with the second call I get another exception:

This is cutadapt 2.0 with Python 3.6.7
Command line parameters: --interleaved --cores 8 --output x1 --paired-output x2 -
Processing reads on 8 cores in paired-end mode ...
ERROR: Traceback (most recent call last):
  File "/path/to/anaconda3/envs/ngs/lib/python3.6/site-packages/cutadapt/pipeline.py", line 400, in reader_process
    for chunk_index, chunk in enumerate(dnaio.read_chunks(f, buffer_size)):
  File "/path/to/anaconda3/envs/ngs/lib/python3.6/site-packages/dnaio/chunks.py", line 57, in read_chunks
    raise UnknownFileFormat('Input file format unknown')
dnaio.exceptions.UnknownFileFormat: Input file format unknown

ERROR: Traceback (most recent call last):
  File "/path/to/anaconda3/envs/ngs/lib/python3.6/site-packages/cutadapt/pipeline.py", line 400, in reader_process
    for chunk_index, chunk in enumerate(dnaio.read_chunks(f, buffer_size)):
  File "/path/to/anaconda3/envs/ngs/lib/python3.6/site-packages/dnaio/chunks.py", line 57, in read_chunks
    raise UnknownFileFormat('Input file format unknown')
dnaio.exceptions.UnknownFileFormat: Input file format unknown

ERROR: Traceback (most recent call last):
  File "/path/to/anaconda3/envs/ngs/lib/python3.6/site-packages/cutadapt/pipeline.py", line 400, in reader_process
    for chunk_index, chunk in enumerate(dnaio.read_chunks(f, buffer_size)):
  File "/path/to/anaconda3/envs/ngs/lib/python3.6/site-packages/dnaio/chunks.py", line 57, in read_chunks
    raise UnknownFileFormat('Input file format unknown')
dnaio.exceptions.UnknownFileFormat: Input file format unknown

ERROR: Traceback (most recent call last):
  File "/path/to/anaconda3/envs/ngs/lib/python3.6/site-packages/cutadapt/pipeline.py", line 400, in reader_process
    for chunk_index, chunk in enumerate(dnaio.read_chunks(f, buffer_size)):
  File "/path/to/anaconda3/envs/ngs/lib/python3.6/site-packages/dnaio/chunks.py", line 57, in read_chunks
    raise UnknownFileFormat('Input file format unknown')
dnaio.exceptions.UnknownFileFormat: Input file format unknown

ERROR: Traceback (most recent call last):
  File "/path/to/anaconda3/envs/ngs/lib/python3.6/site-packages/cutadapt/pipeline.py", line 400, in reader_process
    for chunk_index, chunk in enumerate(dnaio.read_chunks(f, buffer_size)):
  File "/path/to/anaconda3/envs/ngs/lib/python3.6/site-packages/dnaio/chunks.py", line 57, in read_chunks
    raise UnknownFileFormat('Input file format unknown')
dnaio.exceptions.UnknownFileFormat: Input file format unknown

ERROR: Traceback (most recent call last):
  File "/path/to/anaconda3/envs/ngs/lib/python3.6/site-packages/cutadapt/pipeline.py", line 400, in reader_process
    for chunk_index, chunk in enumerate(dnaio.read_chunks(f, buffer_size)):
  File "/path/to/anaconda3/envs/ngs/lib/python3.6/site-packages/dnaio/chunks.py", line 57, in read_chunks
    raise UnknownFileFormat('Input file format unknown')
dnaio.exceptions.UnknownFileFormat: Input file format unknown

cutadapt: error: Input file format unknown

Is that the same issue?

@marcelm marcelm closed this in c94ebf4 Mar 12, 2019

@marcelm

This comment has been minimized.

Copy link
Owner

commented Mar 12, 2019

I fixed the first part, but the second problem probably still exists. I’ll look into that later.

@marcelm marcelm reopened this Mar 12, 2019

@marcelm

This comment has been minimized.

Copy link
Owner

commented Mar 12, 2019

Ok, and the second problem occurs because if using -o -, both status messages and the FASTQ will be sent to standard output, corrupting it, and then the file format can no longer be recognized. This is a related, but separate problem.

@marcelm marcelm closed this in fe77107 Mar 13, 2019

@marcelm

This comment has been minimized.

Copy link
Owner

commented Mar 13, 2019

Both problems should be fixed now. I’ve added a couple of tests to make sure that this type of regression does not happen again. I’ll consider making a new release as well if I have time.

@sklages

This comment has been minimized.

Copy link
Author

commented Mar 13, 2019

Awesome, thanks.

@laurenfitch

This comment has been minimized.

Copy link

commented Mar 15, 2019

This fix has not been released yet, right? I have just had the same problem today.

`trim_galore -q 20 --fastqc_args "--outdir=/results" --dont_gzip --output_dir=/results --cores 4 /data/ccs.fastq

This is cutadapt 2.0 with Python 3.5.3
Command line parameters: -j 4 -e 0.1 -q 20 -O 1 -a TGGAATTCTCGG /data/ccs.fastq
Processing reads on 4 cores in single-end mode ...
Traceback (most recent call last):
File "/usr/local/bin/cutadapt", line 11, in
sys.exit(main())
File "/usr/local/lib/python3.5/dist-packages/cutadapt/main.py", line 787, in main
stats = runner.run()
File "/usr/local/lib/python3.5/dist-packages/cutadapt/pipeline.py", line 684, in run
raise e
AttributeError: 'str' object has no attribute 'name'`

Ran fine when I dropped the --cores 4. Fresh install today in my docker container.

@marcelm

This comment has been minimized.

Copy link
Owner

commented Mar 15, 2019

That’s right, it’s not released. I’ll prepare a release now.

@marcelm

This comment has been minimized.

Copy link
Owner

commented Mar 15, 2019

Cutadapt 2.1 is now released. pip install should work already. conda install should also work in a couple of minutes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
3 participants
You can’t perform that action at this time.