Jump to content

Recommended Posts

Posted (edited)

ok....shoot i forgot to change that back one sec...

; build 518 - error handling (add elses after endifs)

; build 518, 519, or 520 - scrolling (no work)

global $from

global $choose

global $input

global $start

global $about

global $progress

global $label

global $output

global $exit

#include <GUIConstants.au3>

main()

Func main()

guicreate("DNA<->RNA Converter 2005 (build 518)",410,250)

$input = guictrlcreateedit("Sequence to Convert",5,5,310,200,$ES_MULTILINE)

$from = guictrlcreatecombo("Convert from",320,5,85)

$choose = guictrlcreatecombo("Convert to",320,30,85)

$start = guictrlcreatebutton("Start",320,75,85)

$about = guictrlcreatebutton("About",320,110,85)

$exit = guictrlcreatebutton("Exit", 320,180,85)

$progress = guictrlcreateprogress(5,210,310,35)

$options = guictrlcreatebutton("Options",320,145,85)

guictrlcreatelabel("Percent Complete: ",320,215)

$label = guictrlcreatelabel("0",320,230)

guictrlsetdata($choose,"DNA 5' to 3'|DNA 3' to 5'|RNA")

guictrlsetdata($from,"DNA 5' to 3'|DNA 3' to 5'|RNA")

guisetstate()

While 1

$msg = guigetmsg()

If $msg = $gui_event_close or $msg = $exit then

exit

endif

If $msg = $gui_event_minimize then

Winsetstate("DNA<->RNA Converter 2005(build 518)","",@SW_MINIMIZE)

endif

If $msg = $about then

MsgBox(0,"About DNA<->RNA Converter 2005 (build 518)","Written by: Centurion_D" & @CRLF & "Dedicated to Jared Rashford - For teaching me many new things, such as this." & @CRLF & @CRLF & "Well... no one has really done this...and I'd like to get into more math-based programs, like this one." & @CRLF & @CRLF & "Thanks again Mr. Rashford! Spread this program to other scientists, teachers, etc. who may find this useful." & @CRLF & @CRLF & "Any bugs found or feature requests can be emailed to me at epsilon045@yahoo.com (or @gmail.com).")

endif

If $msg = $start then

if guictrlread($choose) = "Convert to" or guictrlread($from) = "Convert from" then

MsgBox(0,"Error!","You must choose whether to convert to DNA or RNA!")

guidelete()

main()

else

if $choose = $from then

MsgBox(0,"Error! - Both options cannot be the same!","You need to change either where you're encoding from or where you're converting to.")

guidelete()

main()

else

$input = guictrlread($input)

convert()

endif

endif

endif

Wend

Endfunc

Func convert()

$choose = guictrlread($choose)

$from = guictrlread($from)

$input = stringupper($input)

$output = ""

$percent = 0

If $choose = "RNA" then

if $from = "DNA 5' to 3'" then

for $a = 1 to stringlen($input)

if stringmid($input,$a,1) = "T" then

$output = $output & "U"

else

$output = $output & stringmid($input,$a,1)

endif

$percent = $percent + 100/stringlen($input)

guictrlsetdata($progress,$percent)

guictrlsetdata($label,$percent)

next

view()

endif

if $from = "DNA 3' to 5'" then

for $a = 1 to stringlen($input)

if stringmid($input,$a,1) = "A" then

$output = $output & "U"

elseif stringmid($input,$a,1) = "T" then

$output = $output & "A"

elseif stringmid($input,$a,1) = "C" then

$output = $output & "G"

elseif stringmid($input,$a,1) = "G" then

$output = $output & "C"

else

$output = $output & stringmid($input,$a,1)

endif

$percent = $percent + 100/stringlen($input)

guictrlsetdata($progress,$percent)

guictrlsetdata($label,$percent)

next

view()

endif

endif

If $choose = "DNA 5' to 3'" then

if $from = "RNA" then

for $a = 1 to stringlen($input)

if stringmid($input,$a,1) = "U" then

$output = $output & "T"

else

$output = $output & stringmid($input,$a,1)

endif

$percent = $percent + 100/stringlen($input)

guictrlsetdata($progress,$percent)

guictrlsetdata($label,$percent)

next

view()

endif

if $from = "DNA 3' to 5'" then

for $a = 1 to stringlen($input)

if stringmid($input,$a,1) = "A" then

$output = $output & "T"

elseif stringmid($input,$a,1) = "T" then

$output = $output & "A"

elseif stringmid($input,$a,1) = "C" then

$output = $output & "G"

elseif stringmid($input,$a,1) = "G" then

$output = $output & "C"

endif

$percent = $percent + 100/stringlen($input)

guictrlsetdata($progress,$percent)

guictrlsetdata($label,$percent)

next

view()

endif

endif

if $choose = "DNA 3' to 5'" then

if $from = "RNA" then

for $a = 1 to stringlen($input)

if stringmid($input,$a,1) = "U" then

$output = $output & "A"

elseif stringmid($input,$a,1) = "A" then

$output = $output & "T"

elseif stringmid($input,$a,1) = "C" then

$output = $output & "G"

elseif stringmid($input,$a,1) = "G" then

$output = $output & "C"

else

$output = $output & stringmid($input,$a,1)

endif

$percent = $percent + 100/stringlen($input)

guictrlsetdata($progress,$percent)

guictrlsetdata($label,$percent)

next

view()

endif

if $from = "DNA 5' to 3'" then

for $a = 1 to stringlen($input)

if stringmid($input,$a,1) = "A" then

$output = $output & "T"

elseif stringmid($input,$a,1) = "T" then

$output = $output & "A"

elseif stringmid($input,$a,1) = "C" then

$output = $output & "G"

elseif stringmid($input,$a,1) = "G" then

$output = $output & "C"

endif

$percent = $percent + 100/stringlen($input)

guictrlsetdata($progress,$percent)

guictrlsetdata($label,$percent)

next

view()

endif

endif

Endfunc

Func view()

guidelete()

guicreate("DNA <-> RNA Converter Viewer 2005 (build 518)",410,250)

$view = guictrlcreateedit($output,5,5,310,200,$ES_MULTILINE)

$new = guictrlcreatebutton("New Session",5,210,90)

$save = guictrlcreatebutton("Save Conversion",100,210,90)

$options = guictrlcreatebutton("Options",195,210,90)

$exit = guictrlcreatebutton("Exit",290,210,90)

guictrlsetdata($view,$output)

guisetstate()

While 1

$msg = guigetmsg()

If $msg = $new then

main()

endif

If $msg = $save then

fileopen("Conversion Logs.txt",2)

filewriteline(@mon & " " & @day & " " & @year)

filewriteline($input)

filewriteline($output)

fileclose("Conversion Logs.txt")

endif

If $msg = $options then

options()

endif

If $msg = $gui_event_close or $msg = $exit then

exit

endif

If $msg = $gui_event_minimize then

Winsetstate("DNA<->RNA Converter 2005(build 518)","",@SW_MINIMIZE)

endif

Wend

Endfunc

func options()

Endfunc

Edited by Centurion_D

If my posts or emails are not in the correct format, too bad! Technology is my territory!My Programming Page (I need members!):http://doublexlegion.gwgaming.net/

Posted

Don't know dna, how some data to input.

<{POST_SNAPBACK}>

dont worry about it the dna part, i just need to type a lot of text and the edit box will not let me make a scroll bar...

to test it:

use any combinations of A's, T's, G's, and C's for DNA

A's, U's, G's, and C's for RNA

then you can convert it! whoo...more for scientific use

If my posts or emails are not in the correct format, too bad! Technology is my territory!My Programming Page (I need members!):http://doublexlegion.gwgaming.net/

Posted

try changing your GUICtrlCreateEdit line to:

$input = GUICtrlCreateEdit("Sequence to Convert", 5, 5, 310, 200)

<{POST_SNAPBACK}>

it doesnt work, it stops me at the bottom of the box

If my posts or emails are not in the correct format, too bad! Technology is my territory!My Programming Page (I need members!):http://doublexlegion.gwgaming.net/

Posted (edited)

if you keep pressing enter it should scroll.

i tried this on release version and beta both work.

if your talking about your view function try changing

$view = GUICtrlCreateEdit($output, 5, 5, 310, 200, $ES_MULTILINE)

to

$view = GUICtrlCreateEdit($output, 5, 5, 310, 200)
Edited by gafrost

SciTE for AutoItDirections for Submitting Standard UDFs

 

Don't argue with an idiot; people watching may not be able to tell the difference.

 

Posted

should already be.

from help file:

style [optional]Defines the style of the control. See GUI Control Styles Appendix.

default ( -1) : $ES_WANTRETURN, $WS_VSCROLL, $WS_HSCROLL, $ES_AUTOVSCROLL, $ES_AUTOHSCROLL

forced styles : $ES_MULTILINE, $WS_TABSTOP

SciTE for AutoItDirections for Submitting Standard UDFs

 

Don't argue with an idiot; people watching may not be able to tell the difference.

 

Posted

yes i know,

but when i force the multi-line style the scroll disappears...now i let it be default and the edit box becomes single-line and the scroll bar reappears...

If my posts or emails are not in the correct format, too bad! Technology is my territory!My Programming Page (I need members!):http://doublexlegion.gwgaming.net/

Posted

ok nvm i got it...

; build 524 - error handling (add elses after endifs)
; build 524 - scrolling (no work)

global $from
global $choose
global $input
global $start
global $about
global $progress
global $label
global $output
global $exit

#include <GUIConstants.au3>

main()

Func main()
    guicreate("DNA<->RNA Converter 2005 (build 523)",410,250)

    $input = guictrlcreateedit("Sequence to Convert",5,5,310,200,$ES_AUTOVSCROLL)
    $from = guictrlcreatecombo("Convert from",320,5,85) 
    $choose = guictrlcreatecombo("Convert to",320,30,85)
    $start = guictrlcreatebutton("Start",320,75,85)
    $about = guictrlcreatebutton("About",320,110,85)
    $exit = guictrlcreatebutton("Exit", 320,180,85)
    $progress = guictrlcreateprogress(5,210,310,35)
    $options = guictrlcreatebutton("Options",320,145,85)
    guictrlcreatelabel("Percent Complete: ",320,215)
    $label = guictrlcreatelabel("0",320,230)

    guictrlsetdata($choose,"DNA 5' to 3'|DNA 3' to 5'|RNA")
    guictrlsetdata($from,"DNA 5' to 3'|DNA 3' to 5'|RNA")

    guisetstate()
    
    While 1
        $msg = guigetmsg()
    
        If $msg = $gui_event_close or $msg = $exit then
            exit
        endif

        If $msg = $gui_event_minimize then
            Winsetstate("DNA<->RNA Converter 2005(build 523)","",@SW_MINIMIZE)
        endif
    
        If $msg = $about then
            MsgBox(0,"About DNA<->RNA Converter 2005 (build 523)","Written by: Centurion_D" & @CRLF & "Dedicated to Jared Rashford - For teaching me many new things, such as this." & @CRLF & @CRLF & "Well... no one has really done this...and I'd like to get into more math-based programs, like this one." & @CRLF & @CRLF & "Thanks again Mr. Rashford! Spread this program to other scientists, teachers, etc. who may find this useful." & @CRLF & @CRLF & "Any bugs found or feature requests can be emailed to me at epsilon045@yahoo.com (or @gmail.com).")
        endif
        
        If $msg = $start then
            if guictrlread($choose) = "Convert to" or guictrlread($from) = "Convert from" then
                MsgBox(0,"Error!","You must choose whether to convert to DNA or RNA!")
                guidelete()
                main()
            else
                if $choose = $from then
                    MsgBox(0,"Error! -  Both options cannot be the same!","You need to change either where you're encoding from or where you're converting to.")
                    guidelete()
                    main()
                else
                    $input = guictrlread($input)
                    convert()
                endif
            endif
        endif
    Wend
Endfunc

Func convert()
    $choose = guictrlread($choose)
    $from = guictrlread($from)
    $input = stringupper($input)
    $output = ""    
    $percent = 0
    
    If $choose = "RNA" then
        if $from = "DNA 5' to 3'" then      
            for $a = 1 to stringlen($input)
                if stringmid($input,$a,1) = "T" then
                    $output = $output & "U"
                else
                    $output = $output & stringmid($input,$a,1)
                endif
                $percent = $percent + 100/stringlen($input)
                guictrlsetdata($progress,$percent)
                guictrlsetdata($label,$percent)
            next
            view()
        endif
    
        if $from = "DNA 3' to 5'" then
            for $a = 1 to stringlen($input)
                if stringmid($input,$a,1) = "A" then
                    $output = $output & "U"
                elseif stringmid($input,$a,1) = "T" then
                    $output = $output & "A"
                elseif stringmid($input,$a,1) = "C" then
                    $output = $output & "G"
                elseif stringmid($input,$a,1) = "G" then
                    $output = $output & "C"
                else
                    $output = $output & stringmid($input,$a,1)
                endif
                $percent = $percent + 100/stringlen($input)
                guictrlsetdata($progress,$percent)
                guictrlsetdata($label,$percent)
            next
            view()
        endif
    endif   
    
    If $choose = "DNA 5' to 3'" then
        if $from = "RNA" then
            for $a = 1 to stringlen($input)
                if stringmid($input,$a,1) = "U" then
                    $output = $output & "T"
                else
                    $output = $output & stringmid($input,$a,1)
                endif
                $percent = $percent + 100/stringlen($input)
                guictrlsetdata($progress,$percent)
                guictrlsetdata($label,$percent)
            next
            view()      
        endif
    
        if $from = "DNA 3' to 5'" then
            for $a = 1 to stringlen($input)     
                if stringmid($input,$a,1) = "A" then
                    $output = $output & "T"
                elseif stringmid($input,$a,1) = "T" then
                    $output = $output & "A"
                elseif stringmid($input,$a,1) = "C" then
                    $output = $output & "G"
                elseif stringmid($input,$a,1) = "G" then
                    $output = $output & "C"
                endif
                $percent = $percent + 100/stringlen($input)
                guictrlsetdata($progress,$percent)
                guictrlsetdata($label,$percent)
            next
            view()
        endif
    endif

    if $choose = "DNA 3' to 5'" then
        if $from = "RNA" then
            for $a = 1 to stringlen($input)
                if stringmid($input,$a,1) = "U" then
                    $output = $output & "A"
                elseif stringmid($input,$a,1) = "A" then
                    $output = $output & "T"
                elseif stringmid($input,$a,1) = "C" then
                    $output = $output & "G"
                elseif stringmid($input,$a,1) = "G" then
                    $output = $output & "C"
                else
                    $output = $output & stringmid($input,$a,1)
                endif
                $percent = $percent + 100/stringlen($input)
                guictrlsetdata($progress,$percent)
                guictrlsetdata($label,$percent)
            next
            view()
        endif
        
        if $from = "DNA 5' to 3'" then
            for $a = 1 to stringlen($input)
                if stringmid($input,$a,1) = "A" then
                    $output = $output & "T"
                elseif stringmid($input,$a,1) = "T" then
                    $output = $output & "A"
                elseif stringmid($input,$a,1) = "C" then
                    $output = $output & "G"
                elseif stringmid($input,$a,1) = "G" then
                    $output = $output & "C"
                endif
                $percent = $percent + 100/stringlen($input)
                guictrlsetdata($progress,$percent)
                guictrlsetdata($label,$percent)
            next
            view()
        endif
    endif
Endfunc

Func view()
    guidelete()
    guicreate("DNA <-> RNA Converter Viewer 2005 (build 518)",410,250)
    
    $view = guictrlcreateedit($output,5,5,310,200,$ES_MULTILINE)
    $new = guictrlcreatebutton("New Session",5,210,90)
    $save = guictrlcreatebutton("Save Conversion",100,210,90)
    $options = guictrlcreatebutton("Options",195,210,90)
    $exit = guictrlcreatebutton("Exit",290,210,90)
    guictrlsetdata($view,$output)
    guisetstate()

    While 1
        $msg = guigetmsg()
        If $msg = $new then
            main()
        endif

        If $msg = $save then
            fileopen("Conversion Logs.txt",2)
            filewriteline(@mon & " " & @day & " " & @year)
            filewriteline($input)
            filewriteline($output)
            fileclose("Conversion Logs.txt")
        endif
        
        If $msg = $options then
            options()
        endif
        
        If $msg = $gui_event_close or $msg = $exit then
            exit
        endif

        If $msg = $gui_event_minimize then
            Winsetstate("DNA<->RNA Converter 2005(build 518)","",@SW_MINIMIZE)
        endif
    Wend
Endfunc

func options()

Endfunc

If my posts or emails are not in the correct format, too bad! Technology is my territory!My Programming Page (I need members!):http://doublexlegion.gwgaming.net/

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...