Thursday, 21 April 2011

converting ANSI to HTML. How to convert to html the colored shell output

The main aim of this was able to put in html the ouptut of git log and diff.


Googling around I have found that Perl CPAN has the HTML::FromANSI module. Also, this module installs ansi2html which accepts input from stdin.  

ls --color | ansi2html -p > my_web_page.html

ls --color | ansi2html > my_snpipet_code-no_header-footer.html


But I prefer the default output from ansi2html.sh from pixelbeat


Unfortunately the ls --color get properly converted to HTML but the git one not. No matter which script I use. Could it be bacause the color is defined in the config as color.ui=auto?


git diff HEAD master -- ensembl/sql/CVS/Tag | ansi2html -p  > ~/public_html/htdocs_dev/diff1.html

git diff HEAD master -- ensembl/sql/CVS/Tag | ansi2html.sh --bg=dark  > ~/public_html/htdocs_dev/diff2.html


[UPDATE]
Yes! the problem would be that I have in the configuration color.ui=auto because explicitly having --color in the command make it work:

$ git diff --color HEAD master -- ensembl/sql/CVS/Tag | ansi2html.sh --bg=dark > ~/public_html/htdocs_dev/diff3.html

Tuesday, 19 April 2011

new R-pkg version: R 2.13.0

The new R 2.13 is out and contains the package 'compiler'

o Package compiler is now provided as a standard package.  See
      ?compiler::compile for information on how to use the compiler.
      This package implements a byte code compiler for R: by default
      the compiler is not used in this release.  See the 'R
      Installation and Administration Manual' for how to compile the
      base and recommended packages.


See this page for benchmarking on the use of 'compiler' and it also show how the syntax that you use could affect the efficiency of your code! interesting!

This is like the perl /o option in regular expressions,  you compile your function and from now on it run much faster


  > library(compiler)
  > lf <- cmpfun(f)

Some links with tricks for updating your installed modules

Windows
http://www.r-statistics.com/2011/04/how-to-upgrade-r-on-windows-7/
http://stackoverflow.com/questions/1401904/painless-way-to-install-a-new-version-of-r
Linux

http://nsaunders.wordpress.com/2011/04/15/r-2-12-to-2-13-package-upgrade/



Mac
http://onertipaday.blogspot.com/2008/10/r-upgrade-on-mac-os-x-1055-leopard.html

Sunday, 10 April 2011

git branching model

This is a nice article about git branching model
http://nvie.com/posts/a-successful-git-branching-model/

A Sampling of Linux Desktops/Window Managers

Copied from Linux Journal

The Second-String Desktop

Mar 31, 2011  By Shawn Powers

http://www.linuxjournal.com/article/10946?page=0,2


Table 1. A Sampling of Linux Desktops/Window Managers
Desktop/Window Manager Description Design Goals Based On Advantages Disadvantages
KDE Full desktop environment Full system integration, including applications Uses KWin window manager and Qt libraries Great application integration, highly customizable Distinct look; non-KDE apps often seem awkward
GNOME Full desktop environment Full system integration, including applications Uses Metacity window manager, based on GTK+ libraries Wide variety of native applications, wide adoption in corporate environments Non-GTK apps often look odd and use more RAM
LXDE Lightweight desktop environment Speed and beautiful interface Uses Openbox window manager and GTK+ libraries Works well on older/slower hardware, maintains compatibility Lacks some of the features found in GNOME or KDE
XFCE Lightweight desktop environment Full-featured desktop environment, but light on resources Usually uses XFWM4, but works well with other window managers Somewhat lower system requirements than GNOME or KDE Possibly a bit too resource-hungry for low-end systems
Enlightenment E17 Window manager with the features of a desktop manager Speed and eye candy with integrated functionality A window manager plus a set of libraries for developing apps Fast without sacrificing style Still in beta but quite stable
ROX Desktop Desktop manager based on the ROX-Filer Approaches the OS in a file-centric way ROX-Filer file manager and the OroboBox window manager Unique file-based design makes installing apps drag and drop ROX Desktop is either a love or hate affair
IceWM Hybrid window manager and desktop manager Speed and simplicity Simple menu and taskbar design Fast and easy to make system-wide configuration changes No way to make desktop icons, requires additional software for some features
Blackbox/Fluxbox Very minimalistic window managers Speed and small memory/CPU footprint Fluxbox is based on Blackbox (it's a fork) Blazingly fast Very limited in features, but by design not immaturity
Openbox Very minimalistic window manager Speed and small memory/CPU footprint Originally based on Blackbox, original code since version 3.0 Simple and fast Limited in features by design
AfterStep/Window Maker Clones of the NeXTSTEP interface Functions and looks like NeXTSTEP Designed after the unique design of the NeXTSTEP interface Unique Often difficult to configure, and the interface is an acquired taste
Ratpoison A window manager that doesn't require a mouse Kills the need for a mouse Designed after GNU Screen No need for a mouse Very limited in features, which the developers consider a feature
DWM An extremely minimalist window manager Manages windows and nothing more The ideas of other minimalist window managers Small and fast No configuration files, must edit source code to coconfigure



Resources
AfterStep: www.afterstep.org
Blackbox: blackboxwm.sourceforge.net
CrunchBang Linux: www.crunchbanglinux.org
DWM: dwm.suckless.org
Elive: www.elivecd.org
Enlightenment E17: www.enlightenment.org
Fluxbox: www.fluxbox.org
GNOME: www.gnome.org
IceWM: www.icewm.org
KDE: www.kde.org
Lubuntu: www.lubuntu.net
LXDE: www.lxde.org
Macbuntu: macbuntu.sourceforge.net
Openbox: www.openbox.org
Puppy Linux: www.puppylinux.org
Ratpoison: www.nongnu.org/ratpoison
ROX Desktop: roscidus.com/desktop
Ubuntu: www.ubuntu.com
Window Maker: www.windowmaker.org
XFCE: www.xfce.org
Xubuntu: www.xubuntu.org

Monday, 7 March 2011

Interesting databases in the 2010 NAR issue

NAR 2010 databases


  • Daniel Glez-Peña, Daniel Gómez-Blanco, Miguel Reboiro-Jato, Florentino Fdez-Riverola, and David Posada
            ALTER: program-oriented conversion of DNA and protein alignments
          Nucl. Acids Res. (2010) 38(suppl 2): W14-W18 doi:10.1093/nar/gkq321
Abstract FREE Full Text (HTML) Full Text (PDF) Screen PDF Supplementary Data
  • Alexey V. Antonov, Esther E. Schmidt, Sabine Dietmann, Maria Krestyaninova, and Henning Hermjakob
R spider: a network-based analysis of gene lists by combining signaling and metabolic pathways from Reactome and KEGG databases
          Nucl. Acids Res. (2010) 38(suppl 2): W78-W83 doi:10.1093/nar/gkq482
Abstract FREE Full Text (HTML) Full Text (PDF) Screen PDF
  • Kunlin Zhang, Sijia Cui, Suhua Chang, Liuyan Zhang, and Jing Wang
i-GSEA4GWAS: a web server for identification of pathways/gene sets associated with traits by applying an improved gene set enrichment analysis to genome-wide association study
Nucl. Acids Res. (2010) 38(suppl 2): W90-W95 doi:10.1093/nar/gkq324

  • Vivek Kaimal, Eric E. Bardes, Scott C. Tabar, Anil G. Jegga, and Bruce J. Aronow
ToppCluster: a multiple gene list feature analyzer for comparative enrichment clustering and network-based dissection of biological systems
Nucl. Acids Res. (2010) 38(suppl 2): W96-W102 doi:10.1093/nar/gkq418
  • Jignesh R. Parikh, Bertram Klinger, Yu Xia, Jarrod A. Marto, and Nils Blüthgen
Discovering causal signaling pathways through gene-expression patterns
Nucl. Acids Res. (2010) 38(suppl 2): W109-W117 doi:10.1093/nar/gkq424
Abstract FREE Full Text (HTML) Full Text (PDF) Screen PDF Supplementary Data
  • Y.-T. Wang, Y.-H. Huang, Y.-C. Chen, C.-L. Hsu, and U.-C. Yang
PINT: Pathways INtegration Tool
Nucl. Acids Res. (2010) 38(suppl 2): W124-W131 doi:10.1093/nar/gkq499
Abstract FREE Full Text (HTML) Full Text (PDF) Screen PDF Supplementary Data
  • Ludovic Cottret, David Wildridge, Florence Vinson, Michael P. Barrett, Hubert Charles, Marie-France Sagot, and Fabien Jourdan
MetExplore: a web server to link metabolomic experiments and genome-scale metabolic networks
Nucl. Acids Res. (2010) 38(suppl 2): W132-W137 doi:10.1093/nar/gkq312
Abstract FREE Full Text (HTML) Full Text (PDF) Screen PDF
  • Marija Cvijovic, Roberto Olivares-Hernández, Rasmus Agren, Niklas Dahr, Wanwipa Vongsangnak, Intawat Nookaew, Kiran Raosaheb Patil, and Jens Nielsen
BioMet Toolbox: genome-wide analysis of metabolism
Nucl. Acids Res. (2010) 38(suppl 2): W144-W149 doi:10.1093/nar/gkq404
Abstract FREE Full Text (HTML) Full Text (PDF) Screen PDF
  • Richard Côté, Florian Reisinger, Lennart Martens, Harald Barsnes, Juan Antonio Vizcaino, and Henning Hermjakob
The Ontology Lookup Service: bigger and better
Nucl. Acids Res. (2010) 38(suppl 2): W155-W160 doi:10.1093/nar/gkq331
Abstract FREE Full Text (HTML) Full Text (PDF) Screen PDF
  • Xin He, Yanen Li, Radhika Khetani, Barry Sanders, Yue Lu, Xu Ling, ChengXiang Zhai, and Bruce Schatz
BSQA: integrated text mining using entity relation semantics extracted from biological literature of insects
Nucl. Acids Res. (2010) 38(suppl 2): W175-W181 doi:10.1093/nar/gkq544
Abstract FREE Full Text (HTML) Full Text (PDF) Screen PDF
  • Scott F. Saccone, Raphael Bolze, Prasanth Thomas, Jiaxi Quan, Gaurang Mehta, Ewa Deelman, Jay A. Tischfield, and John P. Rice
SPOT: a web-based tool for using biological databases to prioritize SNPs after a genome-wide association study
Nucl. Acids Res. (2010) 38(suppl 2): W201-W209 doi:10.1093/nar/gkq513
Abstract FREE Full Text (HTML) Full Text (PDF) Screen PDF
  • Ignacio Medina, José Carbonell, Luis Pulido, Sara C. Madeira, Stefan Goetz, Ana Conesa, Joaquín Tárraga, Alberto Pascual-Montano, Ruben Nogales-Cadenas, Javier Santoyo, Francisco García, Martina Marbà, David Montaner, and Joaquín Dopazo
Babelomics: an integrative platform for the analysis of transcriptomics, proteomics and genomic data with advanced functional profiling
Nucl. Acids Res. (2010) 38(suppl 2): W210-W213 doi:10.1093/nar/gkq388
Abstract FREE Full Text (HTML) Full Text (PDF) Screen PDF Supplementary Data
  • Miguel Vazquez, Ruben Nogales-Cadenas, Javier Arroyo, Pedro Botías, Raul García, Jose M. Carazo, Francisco Tirado, Alberto Pascual-Montano, and Pedro Carmona-Saez
MARQ: an online tool to mine GEO for experiments with similar or opposite gene expression signatures
Nucl. Acids Res. (2010) 38(suppl 2): W228-W232 doi:10.1093/nar/gkq476
Abstract FREE Full Text (HTML) Full Text (PDF) Screen PDF Supplementary Data
  • Maria José Nueda, José Carbonell, Ignacio Medina, Joaquín Dopazo, and Ana Conesa
Serial Expression Analysis: a web tool for the analysis of serial gene expression data
Nucl. Acids Res. (2010) 38(suppl 2): W239-W245 doi:10.1093/nar/gkq488
Abstract FREE Full Text (HTML) Full Text (PDF) Screen PDF Supplementary Data
  • Haim Ashkenazy, Elana Erez, Eric Martz, Tal Pupko, and Nir Ben-Tal
ConSurf 2010: calculating evolutionary conservation in sequence and structure of proteins and nucleic acids
Nucl. Acids Res. (2010) 38(suppl 2): W529-W533 doi:10.1093/nar/gkq399
Abstract FREE Full Text (HTML) Full Text (PDF) Screen PDF
  • Gilad Wainreb, Haim Ashkenazy, Yana Bromberg, Alina Starovolsky-Shitrit, Turkan Haliloglu, Eytan Ruppin, Karen B. Avraham, Burkhard Rost, and Nir Ben-Tal
MuD: an interactive web server for the prediction of non-neutral substitutions using protein structural data
Nucl. Acids Res. (2010) 38(suppl 2): W523-W528 doi:10.1093/nar/gkq528
Abstract FREE Full Text (HTML) Full Text (PDF) Screen PDF Supplementary Data
  • Jiten Bhagat, Franck Tanoh, Eric Nzuobontane, Thomas Laurent, Jerzy Orlowski, Marco Roos, Katy Wolstencroft, Sergejs Aleksejevs, Robert Stevens, Steve Pettifer, Rodrigo Lopez, and Carole A. Goble
BioCatalogue: a universal catalogue of web services for the life sciences
Nucl. Acids Res. (2010) 38(suppl 2): W689-W694 doi:10.1093/nar/gkq394
Abstract FREE Full Text (HTML) Full Text (PDF) Screen PDF
  • Mickael Goujon, Hamish McWilliam, Weizhong Li, Franck Valentin, Silvano Squizzato, Juri Paern, and Rodrigo Lopez
A new bioinformatics analysis tools framework at EMBL–EBI
Nucl. Acids Res. (2010) 38(suppl 2): W695-W699 doi:10.1093/nar/gkq313
Abstract FREE Full Text (HTML) Full Text (PDF) Screen PDF
  • Huabin Hou, Fangqing Zhao, LingLin Zhou, Erle Zhu, Huajing Teng, Xiaokun Li, Qiyu Bao, Jinyu Wu, and Zhongsheng Sun
MagicViewer: integrated solution for next-generation sequencing data visualization and genetic variation detection and annotation
Nucl. Acids Res. (2010) 38(suppl 2): W732-W736 doi:10.1093/nar/gkq302
Abstract FREE Full Text (HTML) Full Text (PDF) Screen PDF
  • Dougu Nam, Jin Kim, Seon-Young Kim, and Sangsoo Kim
GSA-SNP: a general approach for gene set analysis of polymorphisms
Nucl. Acids Res. (2010) 38(suppl 2): W749-W754 doi:10.1093/nar/gkq428
Abstract FREE Full Text (HTML) Full Text (PDF) Screen PDF Supplementary Data
  • Zefeng Zhang, Hao Lin, and Bin Ma
ZOOM Lite: next-generation sequencing data mapping and visualization software
Nucl. Acids Res. (2010) 38(suppl 2): W743-W748 doi:10.1093/nar/gkq538
Abstract FREE Full Text (HTML) Full Text (PDF) Screen PDF

Sunday, 20 February 2011

Tell emacs to use git instead svn or cvs when a file is managed by both versions systems.

Stack overflow is wonderfull, I posted a question and it was answered in less than a minute. Was so quick that I needed to wait for 4 minutes before being able to accept it!.

http://stackoverflow.com/questions/5059804/howt-to-tell-emacs-vc-that-i-want-a-file-to-be-managed-by-git-not-by-svn-when-the/5059848#5059848

In short: if you have a file managed by Git and several other versions systems and you want to use emacs VC shortcuts with Git, you need to edit vc-handled-backends and move Git the first one.

'(vc-handled-backends (quote (Git CVS SVN SCCS Bzr Hg Arch MCVS)))

I have also added git.el to my site-lisp

$ cp /usr/share/doc/git/contrib/emacs/git* ~/.emacs.d/site-lisp/

And then added to my .emacs
;; from git.el (complement to vc-git.el)
(require 'git)
(require 'git-blame)

then creating a keybinding (from http://www.michael-hammer.at/blog/emacs_git/)
;keybindindings for git
(global-set-key "\C-xgs" 'git-status)

git.el shortcuts
m - mark the file the cursor is on ATM
M - mark all files in buffer
u/DEL - unmark file below/above
R - resolve conflicts during merge
a - add file to repository
r - remove file
i - add file to ignore list
c - commit
U - Undo -> revert file
l - see log file
g - refresh the status buffer
q - quit status buffer
? - get help!

Sunday, 16 January 2011

Managing script options: Getopt-Long-Descriptive

I use GetOpt::Long for all my scripts, and as many other people I have my own methods to handle some logic for many of the standard options that my scripts have (-verbose -debug -test -run -in_file -out_file -bsub, etc...). Things get complicated when you check if your script has the right options, some times there are incompatible options, or alternative ones, or if you pass -test, many mandatory options are not mandatory anymore. And also you need to provide the right message for each scenario and write the usage message.

Today reading the code of the WWW::PivotalTracker::Command Perl module I have seen that it uses Getopt::Long::Descriptive. This is right away the module that I was looking for. It implements the 'one of these', 'required', etc.., and also writes the usage automatically for you. I have not tried it yet but I will give it a try this week. Any comments about other users experiences would be welcome.



PivotalTracker perl module

I like XP and Agile programming style. And I am very fond of day and week to-do lists to mark project goals achievements. I have recently started to use PivotalTraker for managing my projects tasks and recod completion velocity and I am very happy with it. I use it as a companion to the workplace Jira (old version with no extensions so a very handicaped Jira.). Therefore I am using PivotalTraker as a pseudo jira extension ( when I finish a week I export the stories to CSV and paste into Jira).

I love the approach of PivotalTraker and also is good that it is easy to import/export data. Also it has perl bindings to its API: WWW-PivotalTracker . I will try it soon.

Monday, 8 November 2010

firefox 4.0

the beta5 is working fairly well, and my favorite plugins like no-script, foxy-proxy and firebug work well. Firebug seems to have some documented minor issues but this does not affect to me.

FF4 has two big visible changes, the tabs on top (like google's chrome) and panorama view for grouping tabs (upper-right corner). This is a nice feature, but when you create several groups I have not found how to cycle between them without the mouse. For me is easier to put tabs in different windows and in my mac I can F10 to see the windows and select one (like in panorama when selecting between groups) but I can also alt-` to cycle between ff4 windows, so I can change swiftly between conceptualy grouped tabs, for example from the journals window to the bloger-mail window when writing an entry in my blog.

What I miss is an option to list all windows and tabs opened and be able to select the wanted one. This is just the opposit of when you start firefox from a stored session and an error occur and gives you the list of all the windows and tabs so you can deselect the unwanted one. This options should be somewhere but I have not discovered yet.

Sunday, 7 November 2010

firefox 4.0 beta 6 (how to use it along firefox 3)

The firefox 4.0 beta is in the 6th release. This is the first ff4 release that I have tested.

Firefox uses only one process for all windows, so you can not open two different firefox at the same time. Well, you can but not with the same profile. So in order to use ff4 without losing my ff3 plugins and usability I need to create first a new profile and then a symlink to launch ff4.

  1.  first of all install ff4 with another name
    • I tried to raname ff4 in the dmg installer but was not possible, so used the terminal in my mac
    • cp -r firefox.app /Volumes/Macintosh\ HD/Applications/Firefox-4.0.app
  1.  Create a new profile
    • In my macOS (change your path for  linux or windows), open the terminal and type:
    • /Volumes/Macintosh\ HD/Applications/Firefox-4.0.app/Contents/MacOS/firefox-bin -profilemanager -no-remote
    • Then add a new profile "ff4"
  1. Create an alias in your .bashrc
    • alias ff4='/Volumes/Macintosh\ HD/Applications/Firefox-4.0.app/Contents/MacOS/firefox-bin -P ff4 -no-remote'
    • -no-remote tells firefox not to use the running instance but create a new one. You can use only one profile at a time though.
Note: you can copy your data from the older profile to the new one if you wish, or create a backup:
  • rsync -av ~/Library/Application\ Support/Firefox/Profiles/n6jajvmu.default  ~/personal/firefox_backup