pyrodigal icon indicating copy to clipboard operation
pyrodigal copied to clipboard

[Feature request] Support for stdin

Open jolespin opened this issue 2 years ago • 5 comments

I'm trying to replace prodigal with pyrodigal in my VEBA binning-prokaryotic.py module. I use stdin because I do some filtering on contig lengths w/ seqkit before I do gene calls and don't want to rewrite the contigs b/c that's a lot of space.

Can you add support for reading fasta input as stdin?

Preferably it no input is provided then assume it's stdin which is the current functionality of prodigal.

Also, I just noticed there's not support for stdout. Can you add this functionality as well? This is the default functionality of prodigal and it's quite useful. I use it to pipe directly into this script: https://github.com/jolespin/veba/blob/devel/src/scripts/append_geneid_to_prodigal_gff.py which adds the gene id.

jolespin avatar Jun 13 '23 00:06 jolespin

Hi @jolespin,

I'm always a bit reluctant to add more features to the CLI as the primary goal of Pyrodigal is to be used as a library when possible, and because I don't want to mimic the Prodigal CLI 100% (like the broken GenBank output for instance). However, I had a look at your code architecture, and while I believe it would be best not to invoke Pyrodigal as a subprocess, I understand why it's organized like that. I'd accept a PR if you want to try, otherwise I'll have a look but can't promise when.

althonos avatar Jun 26 '23 08:06 althonos

Can you point me in the direction of the executable I should edit? I thought it was the _cli.py but noticed there are some arguments that are not usable in the cli such as the number of threads.

jolespin avatar Jun 26 '23 16:06 jolespin

No, you're right, it's indeed the _cli.py file that should be changed. The --jobs argument was added recently and was not available in the Pyrodigal release on PyPI, but you could use it locally. Check the CONTRIBUTING.md guide if you need help setting up a local copy of the repository for testing :smiley:

althonos avatar Jun 28 '23 09:06 althonos

Have you got any other requests about stdin support?

jolespin avatar Jun 29 '23 00:06 jolespin

Not really, just make the stdin and stdout explicit in CLI, e.g. pyrodigal -i - to read from stdin, rather that assuming stdin when the -i flag is missing. I think it's better to keep the -i flag required.

althonos avatar Jun 29 '23 09:06 althonos

I've added support for reading from stdin like in the original binary, this will be available in the next release (v3.5).

althonos avatar Jul 17 '24 14:07 althonos