alexstaj / cutadapt

Automatically exported from code.google.com/p/cutadapt
0 stars 0 forks source link

program fails to write --rest-file when --overlap is sufficiently long #56

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
Really nice program, I especially like the detailed logging.  However, there 
seems to be a bug with the --rest-file option.  The bug only happens when 
--overlap is set to some high value.  (The default value of 3 does not cause 
this to happen.)

I am invoking cutadapt as follows:

cutadapt -a NNNNNAAAAAAAAAAAAAAAGATCGGAAGAGCACACGTCT --times 1 --minimum-length 
25 --overlap 21 --output test.cutadapt.fitered.fastq --info-file 
test.cutadapt.info.txt --rest-file test.cutadapt.rest.txt --wildcard-file 
test.cutadapt.wildcard.txt --too-short-output test.cutadapt.tooshort.txt 
--match-read-wildcards input.fastq.gz > test.cutadapt.log

The program fails on the very first read with:

Traceback (most recent call last):
  File "/cluster/home/auzilov/bin/cutadapt", line 10, in <module>
    cutadapt.main()
  File "/cluster/home/auzilov/lib/python2.7/site-packages/cutadapt/scripts/cutadapt.py", line 770, in main
    (n, total_bp) = process_reads(reader, adapter_matcher, quality_trimmer, modifiers, readfilter, trimmed_outfile, untrimmed_outfile, rest_writer, options.trim_primer)
  File "/cluster/home/auzilov/lib/python2.7/site-packages/cutadapt/scripts/cutadapt.py", line 506, in process_reads
    rest_writer.write(matches[-1])
IndexError: list index out of range

Removing the "--rest-file" flag fixes the problem.  This invocation runs 
correctly:

cutadapt -a NNNNNAAAAAAAAAAAAAAAGATCGGAAGAGCACACGTCT --times 1 --minimum-length 
25 --overlap 21 --output test.cutadapt.fitered.fastq --info-file 
test.cutadapt.info.txt --wildcard-file test.cutadapt.wildcard.txt 
--too-short-output test.cutadapt.tooshort.txt --match-read-wildcards 
input.fastq.gz > test.cutadapt.log

Original issue reported on code.google.com by andrew.u...@gmail.com on 4 Dec 2012 at 6:19

GoogleCodeExporter commented 9 years ago
Oh, I forgot to mention, this happens with this version:

$cutadapt --version
1.2.1

downloaded today.

I'm running on Python 2.7.1 on Linux and installed using the given setup.py 
script.

Please let me know if there are other system details you need, but it doesn't 
seem they are relevant here.

Original comment by andrew.u...@gmail.com on 4 Dec 2012 at 6:21

GoogleCodeExporter commented 9 years ago
Thanks for the report! This actually does not seem to be related to the 
--overlap option. The bug occurs when the --rest-file option is given to 
cutadapt 1.2.1 and it does not find an adapter in a read.

Could you install the most recent stable version from 
https://github.com/marcelm/cutadapt/tree/stable and tell me whether it works 
now? You can download it by clicking on the ZIP file link.

By the way, you could leave out the "--times 1" option from your command line 
(it is 1 by default).

Original comment by marcel.m...@tu-dortmund.de on 4 Dec 2012 at 9:35

GoogleCodeExporter commented 9 years ago
I confirm that the bug is fixed in the most recent "stable".  Thanks!

Yeah I know about the "--times" option, it was left over after some fiddling... 
thanks though.

Cheers.

Original comment by andrew.u...@gmail.com on 4 Dec 2012 at 10:30

GoogleCodeExporter commented 9 years ago
Great, thanks for the feedback.

Original comment by marcel.m...@tu-dortmund.de on 10 Dec 2012 at 10:36

GoogleCodeExporter commented 9 years ago
I ran into the same problem (version 1.2.1), tried the stable version (both 
versions downloaded Jan 02) and also confirm the fix in the new stable version. 

Original comment by ludo.pa...@gmail.com on 2 Jan 2013 at 11:17

GoogleCodeExporter commented 9 years ago
Thanks, I’ll prepare a new release soon.

Original comment by marcel.m...@tu-dortmund.de on 3 Jan 2013 at 10:13