How To Extract An Algorithm From A Visual Basic Software And Port It In Python?
1
0
Entering edit mode
11.1 years ago
mariusorion ▴ 60

Hi there,

I am trying to extract the base algorithm from a visual basic software, to port it in python or PHP. It seems simple in theory but I am not a professional programmer. I know python and a little PHP but I know very little about Visual Basic. I've tried to stick to visual basic but it seems that any changes I made to this software (PromKappa) damages the program. Can someone help me with a simpler version in python (or PHP)?

Any help is greatly appreciated, thanks!

genes dna sequence • 4.8k views
ADD COMMENT
3
Entering edit mode

It seems to me you'd have to be able to write out the algorithm, so that you can port it to your language of choice. If you don't understand it enough to write it out (i.e. as in pseudo-code), you risk programming something that may give you a result, with no guarantee that it's the correct result. "Extracting the algorithm" means you could write it down for someone. Poking around with visual basic, with the goal of getting an output that doesn't break the program, sounds kind of scary. Better to take the time to understand what's going on, and avoid black boxes.

ADD REPLY
0
Entering edit mode

Hi seidel,

Last night I read your comment and I stood a little to digest the problem. I need 3 functions: the first one (that I have from other experiments) should feed with sliding windows other two functions (one calculates Kappa and one calculates the CG content). Thus, each sliding window generates a point with the x=CG and y=kappa. If all goes well my code it should reach a very bizarre pattern, but that's just in theory for now.

thanks.

ADD REPLY
1
Entering edit mode

The program you have linked seems to be very simple. Basically, it just calculates the GC content of a promoter region, and an index of coincidence, which I think is a sort of alignment score. Which part of this algorithm do you want to reproduce?

ADD REPLY
0
Entering edit mode

Hi Giovanni,

That is the problem, that in theory is easy, but when I looked at PromKappa source code I remained "cross-eyed", it was too complicated. The software does much more than it is explained in the article and the source code does not have explanatory comments for each function or line of code. I originally wanted to cut the source code until only the section that interests me remains functional. The reason I want to port it is that the kappa index of coincidence is fundamentally different from sequence alignments (the analysis is done on a single sequence).

thanks.

ADD REPLY
1
Entering edit mode

You need to edit this question to highlight the bioinformatics problem you are trying to solve. Right now it looks like a generic programming question.

ADD REPLY
0
Entering edit mode

Hi Neilfws,

I try to make the simplified python version of this program, because I do not know visual basic. If my python implementation does not work in any way, I will make a new post here that will include my code in python for a direct advice on the code. The end result of my code must look something like this:http://upload.wikimedia.org/wikipedia/commons/4/4c/Insulin_gene_promoter.png

thanks.

ADD REPLY
0
Entering edit mode

Still sounds like a generic programming question :) Care to try again?

ADD REPLY
1
Entering edit mode

I found the hard solution for PHP ...http://www.design215.com/toolbox/asp.php

ADD REPLY
0
Entering edit mode

Please look one minute at the software:http://www.biomedcentral.com/content/supplementary/1471-2164-13-512-s3.rar. I want to know which function handles kappa and the C + G. thanks.

I was not able to do much with the converter, for example this function:

Private Sub gene_search_Click()
pro_no = List_promotori.ListCount
For i = 0 To pro_no
If List_promotori.List(i) <> "" Then
    If InStr(UCase(List_promotori.List(i)), UCase(gene_search_txt.Text)) <> 0 Then
    a = List_promotori.ItemData(i)
    MsgBox "Item found in row no " & i
        List_promotori.Enabled = False
        secventata.Text = Split(List_promotori.List(i), "|")(1)
        seq_name_from_file.Caption = Split(List_promotori.List(i), "|")(0)
        Procesare_Click
        List_promotori.Enabled = True
    Exit Sub
    End If
End If
Next i
MsgBox "Gene promoter not found !"
End Sub

is converted in:

def gene_search_Click():
    pro_no = List_promotori.ListCount
    for i in vbForRange(0, pro_no):
        if List_promotori.List(i) <> '':
            if InStr(UCase(List_promotori.List(i)), UCase(gene_search_txt.text)) <> 0:
                a = List_promotori.ItemData(i)
                MsgBox('Item found in row no ' + i)
                List_promotori.Enabled = False
                secventata.text = Split(List_promotori.List(i), '|')(1)
                seq_name_from_file.text = Split(List_promotori.List(i), '|')(0)
                Procesare_Click()
                List_promotori.Enabled = True
                return
    MsgBox('Gene promoter not found !')

which really confused me even more :)

ADD REPLY
4
Entering edit mode
11.1 years ago
ff.cc.cc ★ 1.3k

Hi, I never used automatic code converters, but sometime they provide a good starting point, here is a project for converting VB to python.

Anyway, even if the program is simple, be sure to setup a good testing-framework, to check that results remain the same.

Have luck !

ADD COMMENT
0
Entering edit mode

Hi ff.cc.cc,

I tried the converter. If I feed the entire PromKappa source code to the converter, then a real mess comes out in python, but if I feed individual functions it works like a charm. Certainly this converter helps me, at least I am familiar with the code.

thanks.

ADD REPLY

Login before adding your answer.

Traffic: 3045 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