I love Sublime Text 3 but I’m sued to Ctrl + Shift + C to toggle comment the current line or block of lines. The default behaviour of Sublime Text for commenting is:

{ "keys": ["ctrl+/"], "command": "toggle_comment", "args": { "block": false } }
{ "keys": ["ctrl+shift+/"], "command": "toggle_comment", "args": { "block": true } }

I like it to behave like this:

{ "keys": ["ctrl+shift+c"], "command": "toggle_comment", "args": { "block": false } }

So, this lines means that the comments are done by line (not by block) and with the Ctrl + Shift + C key-binding.

Download last version pf the tarball from the oficial page.

Unpack the downloaded file:

cd ~/Downloads
tar xjf sublime_text_3_build_3103_x64.tar.bz2

Once unpacked we move this folder under /opt location:

sudo mv sublime_text_3 /opt/

Then, we create a symbolic link under /usr/bin to call Sublime Text from the command line as subl.

sudo ln -s /opt/sublime_text_3/sublime_text /usr/bin/subl

Finally, to add Sublime Text to the manager‘s menu we create a sublime.desktop file under /usr/share/applications:

sudo subl /usr/share/applications/sublime.desktop

And fulfill the file with this content:

[Desktop Entry]
Version=3.0
Name=Sublime Text 3
GenericName=Text Editor
Exec=sublime
Terminal=false
Icon=/opt/sublime_text_3/Icon/48x48/sublime-text.png
Type=Application
Categories=TextEditor;IDE;Development
X-Ayatana-Desktop-Shortcuts=NewWindow

[NewWindow Shortcut Group]
Name=New Window
Exec=sublime -n

SRA stores all the sequencing from GIO experiments in files in .sra format. These files are managed using the SRA Toolkit.

I recently download some .sra files from this GEO corresponding to paired-end sequencing data. My surprise when I run fastq-dump (from SRA toolkit) utility and I got only one file rather than two.

From the documentation of the tool, it seems that the option --split-files should be enough but not. We need to add the --split-3 option. If we run fastq-dump with this configuration in a single-end experiment a single .fastq files will be create, otherwise two files with suffixes _1 and _2 will be the matched paired read files (.fastq) while a posible third file (no sufix) will contain the non matched reads.

I currently run fastq-dump as:

fastq-dump --split-files --split-3 SRR1813404.sra -O SRR1813404

A long the process of creating and testing R packages I usually need to unload a loaded package. The function to perform this operation is called detach and must be run as:

detach(name="package:rexposome", unload=TRUE)

The name argument needs to be filled with package: and followed by the name of the package to be unload, that can be found at search().

This last week I used lost of Microsoft Excel files that I need in my R scripts. Hence I discovered the excellent and complete package XLConnect. But, for easy and fast working, its not the best solution.

So I codded a wrapper of XLConnect, calling it loadxls that allows to read and write Excel files in an easy way.

loadxls

The R package loadxls can be installed from its github repository with:

devtools::install_github("carleshf/loadxls")

It implements only 4 functions: read_all, read_sheet, write_all and write_sheet.

Functions

read_all

read_all(filename, environment = parent.frame(), verbose = TRUE)

This functions reads a given Excel file and loads each sheet as a data.frame in the current environment. The created objects will have the name of the sheet.

read_sheet

read_sheet(filename, sheetname, varname, environment = parent.frame(), verbose = TRUE)

This functions loads, instead of the full content of a file, only a given sheet. If the argument varname is supplied, the object loaded from the given sheet will take its name.

write_all

write_all(..., filename, verbose = TRUE)

This function writes all the objects given though ... to a new Excel file, saving each objects as a new sheet.

write_sheet

write_sheet(data, sheetname, filename, replace = FALSE, verbose = TRUE)

This function allows to save a single object to and giving the name of the sheet where it will be write.

mc201516

It’s time for the geek christmas card. This year I wrote it in JAVA and it can generate, randomly, one of four different outputs. It is the simplest card I coded but I made it thinking in simplicity.

The source code for that can be found at my christmas-card’s github (link) inside mc201516. If you take care, you will find a two-output version of this card coded in R (-: