small C program (single file) doing Bioinformatic stuff to learn Python bindings
1
0
Entering edit mode
4.0 years ago
pippo1980 ▴ 10

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 • 1.1k views
ADD COMMENT
1
Entering edit mode

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.

ADD REPLY
0
Entering edit mode
4.0 years ago

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.

ADD COMMENT
0
Entering edit mode

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

ADD REPLY
0
Entering edit mode

no good trying with something that returns value

ADD REPLY
0
Entering edit mode

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.

ADD REPLY
0
Entering edit mode

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.

ADD REPLY
0
Entering edit mode

yep thanks. Fell back to https://realpython.com/python-bindings-overview/#ctypes , the ctypes part. It gave me

an idea of what is like. Was wondering how pymol and chimera are able to handle all the mix flavours they have !!

ADD REPLY

Login before adding your answer.

Traffic: 2614 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6