This is a test version of Biostars. For the public version, visit https://www.biostars.org.
small C program (single file) doing Bioinformatic stuff to learn Python bindings

I am really bad at PC and programming. Trying to figure-out how Biopython works and Python at the same time.

Discovered existence of Python bindings. I am looking for a small c program (one file) to try to learn how

to call it from Python using ctypes or cython. Any idea ? I am asking for this because the print 'Hello'

isnt usefull to me , no way to pass argument to me and my C is absolutely zero

(asked same question on bioinformatics.stackexchange.com got closed. Hope find more help here)

python ctypes cython

If you are as bad at programming as you say, starting out by trying to conflate C (a not very beginner-friendly language in the first place) with another language (python), whilst trying to get in to the weeds of more niche interface layers like cython is not the approach I would take.

Start with something easy like python. Get comfortable with it, then start to explore the wider world.

1 answer

Here's a post where I show how to use Cython to take a very fast reverse complement of a DNA sequence, a task that Biopython is, oddly, not able to do quickly:

https://bioinformatics.stackexchange.com/questions/3583/what-is-the-fastest-way-to-get-the-reverse-complement-of-a-dna-sequence-in-pytho/3587#3587

My second answer speeds up the original approach further:

https://bioinformatics.stackexchange.com/questions/3583/what-is-the-fastest-way-to-get-the-reverse-complement-of-a-dna-sequence-in-pytho/3595#3595

I think these two answers should be a decent intro to a basic usage of Cython for a "real-world" bioinformatics application, though you will need to learn a little C to figure out how it works.

................................................

no good trying with something that returns value

Maybe use the Github repository that the original poster created to bundle tests of all the different reverse complement approaches:

https://github.com/conchoecia/fastest_rc_python

That should take most of the work out of setting things up, and you can then play with it in more of a "sandbox", if that makes sense.

But I think Joe's advice is pretty solid. You may need a bit of gentler introduction to programming before tackling this. C has a much steeper learning curve than Python, and that can cause some frustration. I'd suggest starting with the basics of Python, and then going from there once you're comfortable.

Log in to answer this question.