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

IndexError: list index out of range #354

Closed
Hofphi opened this issue Feb 14, 2019 · 4 comments

Comments

@Hofphi
Copy link

commented Feb 14, 2019

Hey,
first of all thanks for this very nice tool!

I am using Pythhon v3.6.6 and Cutadapt v1.18. I used a multiple adapter fasta-file to trim unwanted sequences and noticed an error message that at first was very unclear to me and I couldn't find any related issue report on this github page.

Here is the error message:

Traceback (most recent call last):
 File "/home/hitz-m/miniconda3/bin/cutadapt", line 12, in <module>
   sys.exit(main())
 File "/home/hitz-m/.local/lib/python3.6/site-packages/cutadapt/__main__.py", line 741, in main
   pipeline = pipeline_from_parsed_args(options, paired, pair_filter_mode, quality_filename, is_interleaved_output)
 File "/home/hitz-m/.local/lib/python3.6/site-packages/cutadapt/__main__.py", line 614, in pipeline_from_parsed_args
   adapters = adapter_parser.parse_multi(options.adapters, options.anywhere, options.front)
 File "/home/hitz-m/.local/lib/python3.6/site-packages/cutadapt/adapters.py", line 335, in parse_multi
   adapters.extend(self.parse(spec, cmdline_type))
 File "/home/hitz-m/.local/lib/python3.6/site-packages/cutadapt/adapters.py", line 319, in parse
   name = record.name.split(None, 1)[0]
IndexError: list index out of range

I noticed that this error arises if the adapters in the fasta-file have no description or any kind of specification (for example lettering) after the ">"!

It would be nice if you could mention in the User guide that the adapters provided in the fasta-file for multiple adapters must have at least some kind of description. This was not stated clearly while reading through the instructions of how to use multiple adapter files (at least not to me).

PS. You can marked this issue as resolved since it is only an report of how the error message looks like for this particular case!

@marcelm

This comment has been minimized.

Copy link
Owner

commented Feb 14, 2019

Thanks for reporting this! Of course the error message should be a lot more helpful than this. I’ll make sure to improve it. I have changed the FASTA parsing routine in the development version of Cutadapt and will need to check whether that same error is still present.

@marcelm marcelm closed this in 229cd42 Feb 19, 2019

@marcelm

This comment has been minimized.

Copy link
Owner

commented Feb 19, 2019

I’ve fixed this now: Instead of updating the documentation or improving the error message, I chose to simply allow sequences without names.

@sirgeldaja

This comment has been minimized.

Copy link

commented Jun 6, 2019

Hi,
I'd just like to let you know that this error persisted. I used Cutadapt 1.18 with Python 3.7.1 and a fasta file for trimming multiple (unnamed) barcodes from both read1 and read2. Upon naming the barcodes in the fasta files my command worked again.

@marcelm

This comment has been minimized.

Copy link
Owner

commented Jun 6, 2019

Cutadapt 1.18 has the problem, yes, but Cutadapt 2.0 or later should be fine.

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.