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

Pipe multiple adatper trimming steps is unsupported when using the python API. #777

Closed
y9c opened this issue Apr 21, 2024 · 5 comments · Fixed by #781
Closed

Pipe multiple adatper trimming steps is unsupported when using the python API. #777

y9c opened this issue Apr 21, 2024 · 5 comments · Fixed by #781

Comments

@y9c
Copy link
Contributor

y9c commented Apr 21, 2024

When using the API code in cutadapt, multiple adapter trimming steps will cause error.

For example given a NGS sequencing library with the following scheme:

(p5 adapter)-(UMI)-(inner adapter)-(insert sequence)-(p7 adapter)

We need to cut p5 adapter by -a, then cut UMI sequence by -u, then cut inner adapter again by -a. Since -a is triggered twice, cutadapter will raise an error.

assert self.with_adapters[i] is None

marcelm added a commit that referenced this issue Apr 23, 2024
Closes #777

Co-authored-by: Chang Y <yech1990@gmail.com>
@marcelm
Copy link
Owner

marcelm commented Apr 23, 2024

Hi, thanks for reporting this. As you (maybe) know, Cutadapt doesn’t have an official API at the moment, so you’re a bit on your own, but I’m still willing to fix this.

I think it would be a bit nicer to actually allow more than two AdapterCutters and to merge their statistics. I’ll open an alternative PR if you don’t mind.

marcelm added a commit that referenced this issue Apr 23, 2024
Closes #777

Co-authored-by: Chang Y <yech1990@gmail.com>
marcelm added a commit that referenced this issue Apr 23, 2024
Closes #777

Co-authored-by: Chang Y <yech1990@gmail.com>
@y9c
Copy link
Contributor Author

y9c commented Apr 23, 2024

Thank you @marcelm for helping with this issue. I wrote a simple tool, cutseq (https://github.com/y9c/cutseq), to simplify the adapter trimming steps. It heavily uses the API of cutadapt, and might solve some of the pain points in issue #606.

@marcelm
Copy link
Owner

marcelm commented Apr 25, 2024

I wrote a simple tool, cutseq (https://github.com/y9c/cutseq), to simplify the adapter trimming steps. It heavily uses the API of cutadapt, and might solve some of the pain points in issue #606.

Awesome! Have you considered integrating this into Cutadapt and submitting a PR? It looks similar to what I had in mind.

@y9c
Copy link
Contributor Author

y9c commented Apr 25, 2024

Thank you very much for your help. I am testing this idea with some real-world data these days, trying to find out the limitations of this API. It meets the requirements of most of the NGS data I have analyzed. It would be great if cutadapt could support this out of the box. I tried to add one new argument for this, but it seems that most of the existing arguments are conflicting with it. Is it okay to suppress all other arguments once the new API is given, or to add a subcommand for cutadapt for this new API?

@marcelm
Copy link
Owner

marcelm commented Apr 26, 2024

I have considered adding subcommands to Cutadapt previously, I suppose that would be the cleanest way. The only problem which complicates things a little is that it should be backwards compatible, that is, the current way of running without a subcommand still needs to work. For simplicity, you could initially suggest a PR that is not backwards compatible and we continue from there.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants