Error when combining multiple 5' adapter search with -g file: and ;rightmost
Nobody has claimed this yet.
Assessment
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Newbie friendliness
- 65/100
Research direction
Reproduce the command using a FASTA file with file:...;rightmost, then trace adapter specification handling in cutadapt/parser.py, especially make_adapter and _make_not_linked_adapter, alongside SingleAdapter in cutadapt/adapters.py. Compare this path with the individually expanded adapter arguments; done means file-based adapters accept the intended search parameter or report a clear, documented incompatibility.
Written by the indexing model from the issue text.
Description
Hi!
I'm using cutadapt 5.2 with Python 3.12.11, installed via conda (cutadapt updated today). I'm running within a longer script. I had a working -g adapter search from a file, and the line worked before I tried to add ;rightmost after the file name, in the hopes of trimming the rightmost match for reads with more than one match to the same 5' adapter (my understanding of the rightmost adapter search parameter). But the two did not seem to be compatible, or I am making a mistake and would appreciate guidance!
Here is the command within the script:
cutadapt -g "file:${well_barcodes};rightmost" -O 14 --revcomp -e 0.15 --cores=0 --info-file ${plate_dir}/${plate}_well_${reads_name}_cutadapt_porechop_INFO.tsv -o ${plate_dir}/${plate}_{name}_${reads_name}_cutadapt_porechop.fastq ${plate_dir}/${plate_file_name} > ${plate_dir}/${plate}_well_${reads_name}_cutadapt_porechop.log;
${well_barcodes} is a .fasta file with my adapter sequences, with format like this:
adpt01
ATCGATCGATCGATCGATCGATCG
adpt02
TAGCTAGCTAGCTAGCTAGCTAGC
....
adpt96
ACGTACGTACGTACGTACGTACGT
Here is the error:
Traceback (most recent call last):
File "/home/cmatt5/.conda/envs/cutadapt/bin/cutadapt", line 8, in <module>
sys.exit(main_cli())
^^^^^^^^^^
File "/home/cmatt5/.conda/envs/cutadapt/lib/python3.12/site-packages/cutadapt/cli.py", line 1166, in main_cli
main(sys.argv[1:])
File "/home/cmatt5/.conda/envs/cutadapt/lib/python3.12/site-packages/cutadapt/cli.py", line 1222, in main
adapters, adapters2 = adapters_from_args(args)
^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/cmatt5/.conda/envs/cutadapt/lib/python3.12/site-packages/cutadapt/cli.py", line 1011, in adapters_from_args
adapters = make_adapters_from_specifications(args.adapters, search_parameters)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/cmatt5/.conda/envs/cutadapt/lib/python3.12/site-packages/cutadapt/parser.py", line 389, in make_adapters_from_specifications
adapters.extend(
File "/home/cmatt5/.conda/envs/cutadapt/lib/python3.12/site-packages/cutadapt/parser.py", line 420, in make_adapters_from_one_specification
yield make_adapter(
^^^^^^^^^^^^^
File "/home/cmatt5/.conda/envs/cutadapt/lib/python3.12/site-packages/cutadapt/parser.py", line 469, in make_adapter
return _make_not_linked_adapter(spec, name, adapter_type, search_parameters)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/cmatt5/.conda/envs/cutadapt/lib/python3.12/site-packages/cutadapt/parser.py", line 547, in _make_not_linked_adapter
return adapter_class(
^^^^^^^^^^^^^^
File "/home/cmatt5/.conda/envs/cutadapt/lib/python3.12/site-packages/cutadapt/adapters.py", line 691, in __init__
super().__init__(*args, **kwargs)
TypeError: SingleAdapter.__init__() got an unexpected keyword argument 'rightmost'
Here is the command that worked:
cutadapt -g file:${well_barcodes} -O 14 --revcomp -e 0.15 --cores=0 --info-file ${plate_dir}/${plate}_well_${reads_name}_cutadapt_porechop_INFO.tsv -o ${plate_dir}/${plate}_{name}_${reads_name}_cutadapt_porechop.fastq ${plate_dir}/${plate_file_name} > ${plate_dir}/${plate}_well_${reads_name}_cutadapt_porechop.log;
My output when using without rightmost is something like this:
Done 00:00:00 44 reads @ 21709.2 µs/read; 0.00 M reads/minute
I think this is related to my using the line within a bash script, but not 100% sure. As of right now, I have not tried hard-coding the file name along with the ";rightmost" parameter added. But I was able to create a workaround that works in my bash script, below, by basically just listing the adapters individually, but with an array becuase there are a lot of them. But thought this issue might still be useful?
declare -a well_g_args=()
while read -r wb_name && read -r wb_seq; do
wb_name="${wb_name#>}"
well_g_args+=(-g "${wb_name}=${wb_seq};rightmost")
done < "${well_barcodes}"
cutadapt "${well_g_args[@]}" -O 14 --revcomp -e 0.15 --cores=0 \
--info-file ${plate_dir}/${plate}_well_${reads_name}_cutadapt_porechop_INFO.tsv \
-o ${plate_dir}/${plate}_{name}_${reads_name}_cutadapt_porechop.fastq \
${plate_dir}/${plate_file_name} \
> ${plate_dir}/${plate}_well_${reads_name}_cutadapt_porechop.log
Another note - I am also hoping to add --times to this line, if possible. But I'm not sure if it will be compatible or function as I am expecting yet.
Thanks so much!
Courtney
- Dominant language
- Python
- Stars
- 587
- Forks
- 144
- Avg merge
- 2h 37m
- Merged PRs (30d)
- 1
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from marcelm/cutadapt
-
Difficulty 1/5 Under an hour Newbie friendliness 85/100
-
Difficulty 4/5 3-5 days Newbie friendliness 65/100
-
Difficulty 5/5 Over a week Newbie friendliness 35/100
-
Difficulty 3/5 1-2 days Newbie friendliness 45/100
-
Difficulty 4/5 3-5 days Newbie friendliness 38/100
All issues in marcelm/cutadapt
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 74/100
bancolombia/sentinel#23 ·
-
test md OpenCI
Difficulty 2/5 1-3 hours Newbie friendliness 74/100
-
integration:quickjs org:external priority:backlog topic:code-interpreter topic:middleware type:feature
Difficulty 2/5 1-3 hours Newbie friendliness 74/100
langchain-ai/deepagents#6450 ·
-
bug client
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 74/100