Differences

This shows you the differences between two versions of the page.

part15 [2009/05/22 10:38]
nuin
part15 [2009/05/22 11:28] (current)
nuin
Line 668: Line 668:
 +==== Final ====
 +
 +We can say that this would be our final version of the script. There are many nice wxPython programming resources, and one is a very good book called [[http://manning.com/rappin/ | wxPython in Action]], which is co-written by Robin Dunn, the wxPython maintainer. Go check it out.
 +
 +So for the last entry in this series, we just need to add a couple of changes to our interface and motif finding scripts. Basically on the interface script we need to add a line that gets the value entered (or the default one, if not changed) in the motif width input box. And we can do that by including the line below in the <code>run_finder</code> function.
 +
 +<code python>width = self.motif_width.GetValue()</code>
 +
 +This line tells the script to get the value of the box and assign to the variable width. This method will get whatever is inside the input box and save as a string to the variable assigned. Now, we need to create the structure to actually send this value to the motif finder functions. Last version of our function //calculate_motifs// received two parameters, we need to add an extra one, and also change the lines that call the function that get the quorums. Basically the first lines of the function will be
 +
 +<code python>def calculate_motifs(input_seqs, input_seqs2, width):
 +    
 +    print input_seqs, input_seqs2
 +    input_seqs = fasta.read_seqs(open(input_seqs).readlines())
 +    input_seqs2 = fasta.read_seqs(open(input_seqs2).readlines())
 +
 +    foreground = get_quorums(input_seqs, width)
 +    background = get_quorums(input_seqs2, width)</code>
 +
 +And that's it. Our simple interface is ready to prime time. OK, not prime prime time, we didn't add a series of features that will make it useful by everyone. For instance, there is no error control, so someone could enter 'ABC' in the width input box and that value would be sent and an error will occur. Also you can click the run button without any file selected. And we could go on and on. But this is just a primer, and we can build from it.
 +
 +The code is on [[http://github.com/nuin/beginning-python-for-bioinformatics/tree/master/scripts%2Fmotifs | Github]], so get it there and have fun.
 
part15.txt · Last modified: 2009/05/22 11:28 by nuin
 
Except where otherwise noted, content on this wiki is licensed under the following license:CC Attribution-Noncommercial-Share Alike 3.0 Unported
Recent changes RSS feed Donate Powered by PHP Valid XHTML 1.0 Valid CSS Driven by DokuWiki