Name:
[799] chingav
Member:
40 months
Authored:
6 videos
Description:
Chinmoy is a computer engineering student at The University of Texas at Austin. His hobbies are tennis and handball. His programming blog is located at http://gavmacprogramming.wordpress.com/screencasts/ ...
Introduction to Ruby II [ID:197] (2/6)
in series: Ruby Introductions
video tutorial by chingav, added 04/07
Name:
[799] chingav
Member:
40 months
Authored:
6 videos
Description:
Chinmoy is a computer engineering student at The University of Texas at Austin. His hobbies are tennis and handball. His programming blog is located at http://gavmacprogramming.wordpress.com/screencas ...
Our authors tell us that feedback from you is a big motivator. Please take a few moments to let them know what you think of their work.
This video is about creating one's own classes. I walk through a bioinformatics class I ported from here: http://www.onlamp.com/pub/a/python/2002/10/17/biopython.html (Oreilly online's Beginning Python for Bioinformatics).
I talk about def initialize, instance variables, class variables, and a very quick note on regular expressions(which I talk more about in the third video).
Link to src: http://gavmacprogramming.wordpress.com/2007/04/21/ruby-scripts-related-to-screencasts/
Got any questions?
Get answers in the ShowMeDo Learners Google Group.
Video statistics:
- Video's rank shown in the most popular listing
- Video plays: 1299 (since July 30th)
- Plays in last week: 5
- Published: 40 months ago
Thank-yous, questions and comments
If this video tutorial was helpful please take some time to say thank-you to the authors for their hard work. Feel free to ask questions. Let the author know why their video tutorial was useful - what are you learning about? Did the video tutorial save you time? Would you like to see more?
You may also want to see our ShowMeDo Google Group to speak to our active users and authors.
All comments excluding tick-boxed quick-comments
it very good indeed, I understand 90%.
very good
Thanks again!!.
Great!!!! I like those tutorials !
thanks, i've gone through your first 2 tutorials and honestly this has been more helpful than anything else i've found so far. they're much appreciated
Hi, thank you so much for your series! I'm experiencing some problems when trying to use the DNA methods though. In your commented lines, you suggest using these methods as in dna.transcribe. But that does not return any output on the screen. So, in this case, do we need to insert a puts method somewhere inside the method definition? Thank you so much and sorry such a basic question (I'm a ruby newbie).
Thank you
Hi Ref,
Glad you enjoyed the videos.
In regards to question 1: // works equally well instead of /\B/ (there must have been a typo somewhere). But basically /\B/ means "non-word boundary". But (//) seems to be better suited for extracting each character, so I would just use that (for example you see)
"words\t\nbleh blah".split(//)
=> ["w", "o", "r", "d", "s", "\t", "\n", "b", "l", "e", "h", " ", " ", " ", "b", "l", "a", "h"]
while
"words\t\nbleh blah".split(/\B/)
=> ["w", "o", "r", "d", "s\t", "\nb", "l", "e", "h ", " ", " b", "l", "a", "h"]
2.) You're absolutely right. @seq will not be modified even if I use collect!, so I might as well have used collect instead.
Regards,
Chinmoy.
Hello chingav,
Thanks for this great series. These videos really helped clarify some stuff for me but I have two itches that need further clarification :)
1-) What does string.split(/B/) do or rather how is it different from string.split(//) ?
( Actually I was playing around with this code and split(/B/) wasn't working for me.
I checked ruby-doc.org and the example there uses split(//) to split "hello" into "h","e","l","l","o" so I changed /B/ to // and it started working.
Now, since I am a total ruby newb who is clueless about regex I am left wondering what was the /B/ supposed to do :) )
2-) Why are you using collect! ? I mean collect! is supposed to change the original object you are operating on right? Well that's not what you really need in this case I guess. I mean the original DNA sequence should not change everytime we ask for its complement. AND collect! can't really change the @seq because we split it into 5 different strings and convert those strings to an array. I don't know the innards of ruby but I guess the string object we start with is not the same object as the array object we end up with so using collect! or collect should have no difference. Am I right?
Actually now that I think about it... Isn't collect about applying a function to each member of a set and producing a different set which maps 1 to 1 to the source set? If it's about producing a new set, is there a reason to have collect! ?
Thanks again for the great series!
Cheers,
Ref
Hi Chinmoy - great, debugging videos will be an excellent addition! That's a skill that is always hard to learn by reading and so much easier to learn by seeing!
Ian.
Hello everyone,
Coming Soon-->Screencast 6 and 7: I made them, but I will have to edit them, upload them, etc.
These cover using the built-in ruby debugger, using ruby-debug from the Data Noise blog, using the Tracer library to trace the execution of code and help pinpoint trouble spots, Unit Testing your code, and a really quick overview on showing the differences between Tkinter and Ruby/Tk when it comes to drawing lines on a canvas(I'll get into the details of this in a later screencast.
I haven't forgotten about the CSV library either. I will cover it later(there were a lot of votes for debugging, so I went ahead and covered those.
Some of you might have had trouble accessing the Box widget on my blog. It should be fixed now. Let me know if you have trouble.
Hello again,
I just remembered that I ported another Python script(this one was harder to do, so it might be more interesting). If anyone wants to look at it before I incorporate it into a future screencast, it is available at http://gavmacprogramming.wordpress.com/2007/04/19/porting-peter-norvigs-martin-shuffle-algorithm/
It is a Markov Decision Process experiment ported from the Python code in Dr.Peter Norvig's article (he is a famous Google researcher)
Regards,
Chinmoy.
Hi Ian and everybody,
Sure. I'll try to work in more ported code as examples.
Regards,
Chinmoy.
Hi again Chinmoy. Great to see you show a bit of ported Python bioinformatics code!
Showing how to get started converting code to another language is nice, I hope we can get more of this sort of content (e.g. from Java to xxx...).
Cheers,
Ian.
