althonos / pyrodigal

Cython bindings and Python interface to Prodigal, an ORF finder for genomes and metagenomes. Now with SIMD!
https://pyrodigal.readthedocs.org
GNU General Public License v3.0
138 stars 5 forks source link

example for gene annotation on a MAG #48

Closed Hocnonsense closed 10 months ago

Hocnonsense commented 10 months ago

In the example of the document, the classic prodigal -p single mode can be accessed by running

gf = pyrodigal.GeneFinder()
gf.train(training_sequence)

where training_sequence refers to a bite sequence

However, in a MAG, there are multiple sequences. Is there any example to predict gene on a set of sequences? Thanks!

althonos commented 10 months ago

Hi @Hocnonsense, you can pass more than one sequence to the train method, they will be treated as all originating from the same genome. If you have a list sequences with all your sequences, you can run:

gf = pyrodigal.GeneFinder()
gf.train(*sequences)

This will pass all the sequences to train a gene finder (using the splat operator *). Then simply loop over your MAG sequences and call gf.find_genes on each of them!

Hocnonsense commented 10 months ago

I've got it, thanks!