Question: How To Extract An Algorithm From A Visual Basic Software And Port It In Python?
0
gravatar for mariusorion
7.0 years ago by
mariusorion50
mariusorion50 wrote:

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 sequence dna • 3.3k views
ADD COMMENTlink modified 7.0 years ago • written 7.0 years ago by mariusorion50
3

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 REPLYlink written 7.0 years ago by seidel7.0k

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 REPLYlink written 7.0 years ago by mariusorion50
1

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 REPLYlink written 7.0 years ago by Giovanni M Dall'Olio27k

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 REPLYlink written 7.0 years ago by mariusorion50
1

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 REPLYlink written 7.0 years ago by Neilfws48k

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 REPLYlink modified 7.0 years ago • written 7.0 years ago by mariusorion50

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

ADD REPLYlink written 7.0 years ago by Neilfws48k
1

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

ADD REPLYlink written 7.0 years ago by mariusorion50

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 REPLYlink modified 7.0 years ago • written 7.0 years ago by mariusorion50
4
gravatar for ff.cc.cc
7.0 years ago by
ff.cc.cc1.3k
European Union
ff.cc.cc1.3k wrote:

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 COMMENTlink written 7.0 years ago by ff.cc.cc1.3k

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 REPLYlink written 7.0 years ago by mariusorion50
Please log in to add an answer.

Help
Access

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.
Powered by Biostar version 2.3.0
Traffic: 1200 users visited in the last hour