I see, thank you for the clarification.
Hello all,
I am trying to transfer UMIs (already extracted) from the headers of raw reads to the headers of reads that had already been filtered for rRNA (using Sortmerna) and trimmed (for adapters and quality using trimmomatic). The command I'm running in Bash is
umi_tools extract -I 00_UMI/tmp/sample001_R1.fastq.gz -S 00_UMI/sample001_R1_transferred.fastq.gz --read2-in=01_Shallow_Trim/fish/001_trim_Q20.fastq.gz --read2-out=01_Shallow_Trim/tmp/001_trim_Q20_transferred.fastq.gz --bc-pattern=NNNNNNNNNNNN --reconcile-pairs -L extract_transfer.log
But get the error
Traceback (most recent call last):
File "/home/ubuntu/.local/lib/python3.8/site-packages/umi_tools/umi_methods.py", line 142, in joinedFastqIterate
read2 = next(fastq_iterator2)
StopIteration
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/home/ubuntu/.local/bin/umi_tools", line 8, in <module>
sys.exit(main())
File "/home/ubuntu/.local/lib/python3.8/site-packages/umi_tools/umi_tools.py", line 61, in main
module.main(sys.argv)
File "/home/ubuntu/.local/lib/python3.8/site-packages/umi_tools/extract.py", line 466, in main
for read1, read2 in umi_methods.joinedFastqIterate(
RuntimeError: generator raised StopIteration
Can the headers not be transferred in this case? Has anyone else encountered this error before?
1 answer
The error here looks to me to be being caused by their being fewer reads in the read1 file than in the read two file. UMI tools expects that the two sets of reads are pairs, and so that the first read in file 1 matches the first read in file 2, and the 100000th read in file 1 matchs the 100000 read in file 2.
If file 2 contains reads that have been filtered in any way (which I believe trimmomatic will do), the the reads will no longer align between the two files.
Furthermore, UMI tools won't transfer UMIs from the header of one read to the header of another. Rather, it extracts the UMI from the sequence of read1 and adds it to the header of both read1 and read2.
Log in to answer this question.