Friday, October 15, 2010

Thursday, September 2, 2010

GuruPlug

After a short wait, I received the GuruPlug, this little computer will host the GLiB website (currently down ...).

This is the pretty and elegant package:
and the unpacking:
It include only the GuruPlug, one eth cable and two electric adapters.

The specifications and diagram are:


Of course this machine runs Linux (Debian Lenny) and it includes some basic services: Wifi server, CUPS, LAMP (lighttp + MySQL + PHP), ssh, samba.

This is the GuruPlug in action:
Some action in the terminal:

$ ssh root@192.168.1.1
Warning: Permanently added '192.168.1.1' (RSA) to the list of known hosts.
root@192.168.1.1's password:
Linux sheevaplug-debian 2.6.32-00007-g56678ec #1 PREEMPT Thu Dec 24 03:15:48 PST 2009 armv5tel

The programs included with the Debian GNU/Linux system are free software;
the exact distribution terms for each program are described in the
individual files in /usr/share/doc/*/copyright.

Debian GNU/Linux comes with ABSOLUTELY NO WARRANTY, to the extent
permitted by applicable law.
Last login: Sun Jan 2 23:41:49 2000 from 192.168.0.2
/usr/bin/X11/xauth: creating new authority file /root/.Xauthority
sheevaplug-debian:~# uname -a
Linux sheevaplug-debian 2.6.32-00007-g56678ec #1 PREEMPT Thu Dec 24 03:15:48 PST 2009 armv5tel GNU/Linux
sheevaplug-debian:~# ps -ef
UID PID PPID C STIME TTY TIME CMD
root 1 0 0 20:21 ? 00:00:01 init [2]
root 2 0 0 20:21 ? 00:00:00 [kthreadd]
root 3 2 0 20:21 ? 00:00:00 [ksoftirqd/0]
root 4 2 0 20:21 ? 00:00:00 [watchdog/0]
root 5 2 0 20:21 ? 00:00:00 [events/0]
root 6 2 0 20:21 ? 00:00:00 [khelper]
root 9 2 0 20:21 ? 00:00:00 [async/mgr]
root 127 2 0 20:21 ? 00:00:00 [sync_supers]
root 129 2 0 20:21 ? 00:00:00 [bdi-default]
root 131 2 0 20:21 ? 00:00:00 [kblockd/0]
root 137 2 0 20:21 ? 00:00:00 [ata/0]
root 138 2 0 20:21 ? 00:00:00 [ata_aux]
root 142 2 0 20:21 ? 00:00:00 [ksuspend_usbd]
root 147 2 0 20:21 ? 00:00:00 [khubd]
root 150 2 0 20:21 ? 00:00:00 [kseriod]
root 153 2 0 20:21 ? 00:00:00 [kmmcd]
root 173 2 0 20:21 ? 00:00:00 [rpciod/0]
root 181 2 0 20:21 ? 00:00:00 [khungtaskd]
root 182 2 0 20:21 ? 00:00:00 [kswapd0]
root 229 2 0 20:21 ? 00:00:00 [aio/0]
root 242 2 0 20:21 ? 00:00:00 [nfsiod]
root 250 2 0 20:21 ? 00:00:00 [jfsIO]
root 251 2 0 20:21 ? 00:00:00 [jfsCommit]
root 252 2 0 20:21 ? 00:00:00 [jfsSync]
root 253 2 0 20:21 ? 00:00:00 [crypto/0]
root 429 2 0 20:21 ? 00:00:00 [mtdblockd]
root 447 2 0 20:21 ? 00:00:00 [ubi_bgt0d]
root 448 2 0 20:21 ? 00:00:00 [orion_spi]
root 536 2 0 20:21 ? 00:00:00 [usbhid_resumer]
root 546 2 0 20:21 ? 00:00:00 [ubifs_bgt0_0]
root 621 1 0 20:22 ? 00:00:00 udevd --daemon
root 913 2 0 20:22 ? 00:00:00 [flush-ubifs_0_0]
root 979 2 0 20:22 ? 00:00:00 [bluetooth]
daemon 1193 1 0 20:22 ? 00:00:00 /sbin/portmap
root 1324 1 0 20:22 ? 00:00:00 /usr/sbin/rsyslogd -c3
103 1337 1 0 20:22 ? 00:00:00 /usr/bin/dbus-daemon --system
root 1357 1 0 20:22 ? 00:00:00 /usr/sbin/sshd
root 1400 1 0 20:22 ? 00:00:00 /bin/sh /usr/bin/mysqld_safe
mysql 1439 1400 0 20:22 ? 00:00:02 /usr/sbin/mysqld --basedir=/usr --datadir=/var/lib/mysql --user
root 1440 1400 0 20:22 ? 00:00:00 logger -p daemon.err -t mysqld_safe -i -t mysqld
102 1775 1 0 20:22 ? 00:00:00 /usr/sbin/exim4 -bd -q30m
root 1800 1 0 20:22 ? 00:00:00 /usr/sbin/ifplugd -i eth0 -q -f -u0 -d10 -w -I
www-data 1816 1 0 20:22 ? 00:00:00 /usr/sbin/lighttpd -f /etc/lighttpd/lighttpd.conf
www-data 1820 1816 0 20:22 ? 00:00:00 /usr/bin/php-cgi
www-data 1824 1816 0 20:22 ? 00:00:00 /usr/bin/php-cgi
root 1829 1 0 20:22 ? 00:00:00 /usr/sbin/inetd
root 1840 1 0 20:22 ? 00:00:00 /usr/sbin/nmbd -D
www-data 1844 1824 0 20:22 ? 00:00:00 /usr/bin/php-cgi
www-data 1845 1824 0 20:22 ? 00:00:00 /usr/bin/php-cgi
www-data 1846 1824 0 20:22 ? 00:00:00 /usr/bin/php-cgi
www-data 1847 1824 0 20:22 ? 00:00:00 /usr/bin/php-cgi
www-data 1848 1820 0 20:22 ? 00:00:00 /usr/bin/php-cgi
www-data 1849 1820 0 20:22 ? 00:00:00 /usr/bin/php-cgi
www-data 1850 1820 0 20:22 ? 00:00:00 /usr/bin/php-cgi
www-data 1851 1820 0 20:22 ? 00:00:00 /usr/bin/php-cgi
root 1852 1 0 20:22 ? 00:00:00 /usr/sbin/smbd -D
root 1861 1 0 20:22 ? 00:00:00 /usr/sbin/famd -T 0
root 1872 1852 0 20:22 ? 00:00:00 /usr/sbin/smbd -D
106 1873 1 0 20:22 ? 00:00:00 /usr/sbin/hald
root 1874 1873 0 20:22 ? 00:00:00 hald-runner
root 1914 1 0 20:22 ? 00:00:00 /usr/sbin/cron
root 1933 2 0 20:22 ? 00:00:00 [uap_main_servic]
root 1934 2 0 20:22 ? 00:00:00 [ksdioirqd/mmc0]
root 1977 1 0 20:22 ? 00:00:00 /usr/sbin/udhcpd
dnsmasq 1982 1 0 20:22 ? 00:00:00 /usr/sbin/dnsmasq -u dnsmasq --cache-size=200 --interface=uap0
root 2001 1 0 20:22 ? 00:00:00 /usr/sbin/bluetoothd
root 2009 2 0 20:22 ? 00:00:00 [krfcommd]
root 2028 2 0 20:22 ? 00:00:00 [btmrvl_main_ser]
root 2040 1 0 20:22 ? 00:00:00 /usr/bin/python /usr/bin/mute-agent
root 2056 1 0 20:22 tty1 00:00:00 /sbin/getty 38400 tty1
root 2057 1 0 20:22 tty2 00:00:00 /sbin/getty 38400 tty2
root 2058 1 0 20:22 tty3 00:00:00 /sbin/getty 38400 tty3
root 2059 1 0 20:22 tty4 00:00:00 /sbin/getty 38400 tty4
root 2060 1 0 20:22 tty5 00:00:00 /sbin/getty 38400 tty5
root 2061 1 0 20:22 tty6 00:00:00 /sbin/getty 38400 tty6
root 2062 1 0 20:22 ttyS0 00:00:00 /sbin/getty 115200 ttyS0
root 2074 1357 0 20:33 ? 00:00:00 sshd: root@pts/0


I'm really impressed with this, cheap, simple and functional. I'll be writing about the modification I'll do to this.

Monday, August 23, 2010

Lady Java (Video)


That's why Java is not "popular" (besides the language problems).

Sunday, July 18, 2010

Tuesday, June 15, 2010

Monster chess

Oh my gosh! I love this gigantic robotic chess:



Unfortunately I don't have time with my DNA puzzles.

Tuesday, June 1, 2010

Top 500 2010

The new release of the Top500 is here, but more interesting is the infographic from the BBC News, check the proportions:

Linux still rules.

Via: Gizmodo

Friday, April 9, 2010

Monday, April 5, 2010

Tuesday, February 23, 2010

Egomaniacos mensajes

Ayer deje abierta mi sesión en un cluster remoto, después de un rato de inactividad esta termino la sesión, pero antes de cerrarse me toco ver estos mensajes, supongo que por el sistema de mensajes del MPI y no tengo idea de quien los mando:

Broadcast message from clase_distribuidos_itesm4 (pts/8)
(Mon Feb 22 19:58:07Dominaremos el mundo con pthreads

Broadcast message from clase_distribuidos_itesm13 (pts/14)
(Mon Feb 22 19:58:callate

Broadcast message from clase_distribuidos_itesm4 (pts/8)
(Mon Feb 22 19:58:37Callame

Broadcast message from clase_distribuidos_itesm18 (pts/18)
Mon Feb 22 19:58:bye
}^_

Broadcast message from clase_distribuidos_itesm17 (pts/19)
Mon Feb 22 20:25:largate a Canad?

Me gusto el largate a Canadá, sobre todo con los olímpicos que hay ahora.
Eso me recuerda que varios programadores en su etapa de aprendizaje son bastante ocurrentes (y mal hablados) en sus primeros pininos de código.

Wednesday, February 17, 2010

Maping TFBS in a sequence

I needed to test some sequence for known TFBS, I was looking for: (1) a public database of TFBS and (2) a program to search the motifs in a sequence(s). First I found Jaspar as an alternative to the commercial TransFac DB, I downloaded the matrices for vertebrate.

The second problem was to find a program to search the motifs in any sequence, I did not find any updated program (many are published, but few websites are active nowadays).

So, I decided to write my own program, I share the code if anyone can use it:

#!/usr/bin/perl -w
use strict;
use Getopt::Long;

=head1 NAME

jasparScan.pl

=head1 USAGE

jasparScan.pl -f FASTA -m MATRIX [-s MODELS] [-c CUT_OFF]

OPTIONS:

-h --help Help screen

-f --fasta Fasta file to scan

-m --matrix Jaspar motif matrix

-s --models List of models, separated by ':' [Def: all]

-c --cutoff Similarity cut-off [Def: 0.90]

=head1 DESCRIPTION

Script to map a TF binding site matrix (from Jaspar DB)
into a fasta sequence. The similarity is defined as a
value between 0-1 (1 is the best match). Base by base
are compared in the matrix frequencies and normalized
by the best match expected. This scoring system is based
on a reduced MatInspector similarity matrix (Quandt et
al, 1995).

=cut

# Program parameters
my $fasta = undef;
my $matrix = undef;
my $models = undef;
my $help = undef;
my $cutoff = 0.9;

usage() unless (GetOptions('help|h' =>\$help,
'fasta|f=s' =>\$fasta,
'matrix|m=s'=>\$matrix,
'models|s:s'=>\$models,
'cutoff|c:s'=>\$cutoff ));
usage() if(defined $help);
usage() unless(defined $fasta and defined $matrix);

# Header print
print "# jasperScan.pl\n";
print "# FASTA=$fasta, MATRIX=$matrix, CUTOFF=$cutoff";
if (defined $models) { print ", MODELS=$models"; }
print "\n";

# Global variables
my %seqs = ();
my %mods = ();
my $sid = '';
my $seq = '';
my $num_seq = 0;
my $num_mod = 0;

# Loading sequences
$num_seq = loadSeqs($fasta);
if ($num_seq >= 1) {
print "# loaded $num_seq sequences\n";
} else {
die "no valid sequences\n";
}

# Loading matrix models
if (defined $models) {
$num_mod = loadMods($matrix, $models);
} else {
$num_mod = loadMods($matrix);
}

if ($num_mod <= 1) {
print "# loaded $num_mod models\n"
} else {
die "no valid models\n";
}

print "# SEQ\tPOS\tTFBS\tSIMIL\tRAW_SIM\tBEST_SIM\n";
# Main search
while ( ($sid, $seq) = each %seqs ) {
foreach my $mod (keys %mods) {
my $len = $mods{$mod}{'len'};
my $best = $mods{$mod}{'best'};
for (my $i = 0; $i <= ((length $seq) - $len); $i++) {
my $word = substr($seq, $i, $len);
next if($word =~ /[^ACGT]/);
my $sco = 0;
my $sco_n = 0;
for (my $j = 0; $j <= ($len - 1); $j++) {
my $b = substr($word, $j, 1);
$sco += $mods{$mod}{$b}[$j];
}
$sco /= $len;
$sco_n = $sco / $best;
next unless ($sco_n >= $cutoff);
my $ini = $i + 1;
my $end = $ini + $len;
print "$sid\t$ini-$end\t$mod\t$sco_n\t$sco\t$best\n";
}
}
}


=head1 SUBROUTINES

=cut

sub loadSeqs {
my $f = shift @_;
my $n = 0;
open F, "$f" or die "cannot open $f\n";
while (<F>) {
chomp;
if (/>(.+)/) {
$sid = $1;
$n++;
} else {
$seqs{$sid} .= $_;
}
}
close F;
return $n;
}

sub loadMods {
my $file = shift @_;
my $sel = shift @_;
my %sel = ();
my $n = 0;
if (defined $sel) {
my @sel = split (/:/, $sel);
foreach my $elem (@sel) { $sel{$elem}++; }
}
local $/ = "\n>";
open F, "$file" or die "cannot open $file\n";
while (<F>) {
if (defined $sel) {
/MA\d{4}/;
my $id = $&;
next unless(defined $sel{$id});
}
s/>//g;
s/\]//g;
s/\[//g;
my ($name, $fA, $fC, $fG, $fT) = split (/\n/, $_);
my @fA = split (/\s+/, $fA); shift @fA;
my @fC = split (/\s+/, $fC); shift @fC;
my @fG = split (/\s+/, $fG); shift @fG;
my @fT = split (/\s+/, $fT); shift @fT;
my $best = 0;
my $len = 0;

for (my $i = 0; $i <= $#fA; $i++) {
my $sum = $fA[$i] + $fC[$i] + $fG[$i] + $fT[$i];
$best += max($fA[$i],$fC[$i],$fG[$i],$fT[$i])/$sum;
$mods{$name}{'A'}[$i] = $fA[$i] / $sum;
$mods{$name}{'C'}[$i] = $fC[$i] / $sum;
$mods{$name}{'G'}[$i] = $fG[$i] / $sum;
$mods{$name}{'T'}[$i] = $fT[$i] / $sum;
$len++;
}
$mods{$name}{'best'} = $best / $len;
$mods{$name}{'len'} = $len;
$n++;
}
close F;
return $n;
}

sub max {
my $max = shift @_;
foreach my $x (@_) {
$max = $x if($x > $max);
}
return $max;
}

sub usage {

print <<_THIS_
jasparScan.pl -f FASTA -m MATRIX [-s MODELS] [-c CUT_OFF]

Script to map a TF binding site matrix (from Jaspar DB)
into a fasta sequence.

OPTIONS:
-h --help Help screen
-f --fasta Fasta file to scan
-m --matrix Jaspar motif matrix
-s --models List of model to use, separated by ':' [Def: all]
-c --cutoff Similarity cut-off [Def: 0.9]

Juan Caballero @ ISB 2010

_THIS_
;
exit 1;
}

=head1 AUTHOR

Juan Caballero
Institute for Systems Biology @ 2010

=head1 LICENSE

This is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.

This is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with code. If not, see <http://www.gnu.org/licenses/>.


=cut

Any nice script to color my code inside Blogger?

Wednesday, January 27, 2010

Retro Virus









I agree, I cannot remember the last time I removed a virus.
from: XKCD

Thursday, January 14, 2010

Artificial sequence







Almost perfect.

Monday, January 11, 2010

The ghost


from: http://xkcd.com/686/