I keep forgetting where my scripts were in my home directories. Below is my ruby script to split a large FASTA [1] sequence into N sequences per file:
#!/usr/bin/env ruby
#
# Script: dumpseq.rb
# Description: Parses the a BLAST Fasta file and dumps each sequence to a
# file.
# Usage: dumpseq.rb [fasta_file]
require 'fileutils'
fasta_db = File.new(ARGV[0])
sno = 0
d = 0
file = nil
while true
x = fasta_db.readline("n>").sub(/>$/, "")
x =~ />(.*)n/
if sno % N == 0 # N seqs per query
file.close if file != nil
dir = sprintf("D%04d000", d / 1000)
FileUtils.mkdir_p dir
# short filenames
fname = sprintf "SEQ%07d.fasta", d
d += 1
file = File.new("#{dir}/#{fname}","w")
end
file << x
sno += 1
fasta_db.ungetc ?>
end
Its pretty hackish-looking. But then I found out that BioRuby [2] wrappers for parsing FASTA files.
[1] http://en.wikipedia.org/wiki/Fasta
[2] http://www.bioruby.org
Related Posts Related Websites
I presented last Feb 23 a paper documenting the commissioning of our new Beowulf cluster. The 8th Philippine Computing Congress was held in University of the Philippines–Diliman. My presentation was held at the new Computer Science building (beside the EEE building).
Here is a short description of the paper:
Title: Building and Benchmarking a New Beowulf Cluster for Grid Computing and Other Applications
Authors: Allan Espinosa and Rafael Saldana
Abstract
In this paper, we report our upgrade of our AGILA Beowulf cluster. Commodity desktop computers were used for the compute nodes. The server node was set-up as a high-end server class machine to house terabytes of data from the university’s scientific computing applications such as cellular automata, molecular dynamics, mesoscale climate modeling, and computational models requiring high performance computing infrastructures.
Embedded below is my presentation. Enjoy!
Technorati tags: Beowulf, computing, clusters
Related Posts Related Websites
I was in the department this morning when something caught my attention: one of the workstations display the Google webpage. Their logo was made up of LEGO bricks! Later on, Slashdot posted the article about the 50th Anniversary of the LEGO brick. So that was the occassion. LEGO made a significant contribution in my life. Aside from having the toy bricks during childhood, my research career came from a LEGO related project:
- Robotag: The Implementation of a Robotic Kit that Combines Primitive Behavior to Promote Higher Levels of Competence - this was the title of my senior research project in Philippine Science High School. It brought me to places like the Intel Philippine Science Fair. I enjoyed meeting from around the Philippines and some of which I met during college.
- My project gave me enough experience to be a facilitator for PSHS-SEI (Science Education Institute) robotics workshop. It was a summer workshop for science teachers around the Philippine to prepare them for teaching a robotics elective in their respective high schools. The government gave away LEGO Mindstorms kits to each school. This was also my first paycheck as a “professional”!
- I was invited to give a talk on mechanical design of robots using LEGO bricks. It was an introductory workshop for high school teachers to prepare for the Philippine Robot Olympiad. The event was sponsored by Felta, Inc. the distributor of LEGO Dacta, the educational kit version of the Mindstorms system. The PSHS-SEI robotics program on the other hand used the commercial editions of the set distributed by Giftgate.
Here is my presentation on mechanical design a few years back. I discussed different types of joints and elaborated on the weakness and stress of the different types. It was basically a vector mechanics lecture using LEGO bricks for visualization. Additional slides are included elaborating on documenting your creations using LEGO cad software like MLCad and ldraw.
Technorati Tags: lego, mindstorms, bricks
Powered by ScribeFire.
Related Posts Related Websites
The department has quite a number of GPIB-interfaceable intstruments but the problem is that we no longer have a workstation with the legacy ISA card slots. We conducted an archaeology expedition in one of our laboratories and found cards in mint condition! Deniz Wong of the Chemistry department showed me some of their toys and their only workstation with the interface card. Even though this machine is very old, it still has great value to their lab because of its capability to instrument with their equipment.
We recently bought two Prologix v4.2 GPIB-USB controllers. This removed the need to find legacy workstations to be able to log data. All we need now are USB ports. The controller is basically an IEEE 488 to USB B adapter. Version 2.6 of the Linux kernel has a built in driver for it (ftd_sio). In my Gutsy workstation, it creates a serial device name “ttyUSB0″. Using serial communications software, I was able to talk to the device.

To test the controller, I tried to record voltage readings from a 5-18 volt power supply as shown in the Figure above. The numerical reading below is the current DC level of one of the power supplies made by students in the ECE 21 Workshop class. The controller was setup in device mode or listen mode which as activated using the “++mode 0″ command in the serial terminal. The HP 34401A multimeter was then set to talk mode to send data to the device controller. According to the manual, the HP-IB address should be set to address 31 to activate talk mode. HP-IB was also selected as the interface in the settings instead of the default RS-232. To simulate fluctuating voltage reading, I swung the resistance knob to vary the data recordings. Below is a plot of the terminal session:
The next would be to consider the sampling time in obtaining the data to incorporate a voltage versus time reading. These recordings will be useful in obtaining the natural response of the circuits.
Related Posts Related Websites
This is a relatively overdue post. I will use this to introduce myself in the Philippine Cubers Association (PCA) forum.
I bought a Rubik’s Cube a few months ago from national bookstore. It was too late when I found a factory defect. The center face cube was broken and is not attached firmly into the kernel (the internal piece that makes the cube work). Gluing it was not an option since it will immobilize a face on the cube. Thinking on the constraints made me think of an idea: a fused cube!
There are already a lot of fused versions of the Rubik’s cube. A simple Google search will gives you Rubik’s Fusion, Rubik’s Fusion+, Siamese Cubes. Some of these “cube mods” are actually available online. I also found DIY sites on how to make them. And the easiest to build was called a “Fused Cube” in TwistyPuzzles.com.
Constructing the cube was fairly simple. As seen in Ton’s Puzzle Building Corner, One has to first create quarter circle grooves on the 3 center faces of each cube. Here is a picture of the kernel found on his site:

I made the grooves as found in the picture by drilling the initial cuts on the center faces. The final sculpturing for finishing the quarter circle cut was made using a grinder and a file. The image below shows both modded kernels pre-assembled with the other cube pieces.

Both cubes were attached together using Mighty Bond (superglue). Solving this cube was more challenging and requires more thinking because of you cannot move the center pies. I will make another post regarding my solution for solving this fused cube.

Technorati Tags: diy, rubik’s cube, modding, cubing, craft
Related Posts Related Websites
Recent Comments